diff --git a/src/main/java/com/hbm/blocks/machine/MachineStirling.java b/src/main/java/com/hbm/blocks/machine/MachineStirling.java index de2731c53..aaab916fa 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineStirling.java +++ b/src/main/java/com/hbm/blocks/machine/MachineStirling.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; import com.hbm.blocks.BlockDummyable; +import com.hbm.blocks.IBlockMulti; import com.hbm.blocks.ILookOverlay; import com.hbm.blocks.ITooltipProvider; import com.hbm.items.ModItems; @@ -23,7 +24,7 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; import net.minecraftforge.common.util.ForgeDirection; -public class MachineStirling extends BlockDummyable implements ILookOverlay, ITooltipProvider { +public class MachineStirling extends BlockDummyable implements ILookOverlay, ITooltipProvider, IBlockMulti { public MachineStirling() { super(Material.iron); @@ -182,4 +183,9 @@ public class MachineStirling extends BlockDummyable implements ILookOverlay, ITo public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { this.addStandardInfo(stack, player, list, ext); } + + @Override + public int getSubCount() { + return 0; + } } diff --git a/src/main/java/com/hbm/entity/effect/EntityFalloutRain.java b/src/main/java/com/hbm/entity/effect/EntityFalloutRain.java index 92b21609a..de26d22ce 100644 --- a/src/main/java/com/hbm/entity/effect/EntityFalloutRain.java +++ b/src/main/java/com/hbm/entity/effect/EntityFalloutRain.java @@ -170,12 +170,14 @@ public class EntityFalloutRain extends Entity { } } - if(dist < 65 && b.getBlockHardness(worldObj, x, y, z) <= Blocks.stonebrick.getExplosionResistance(null)) { + float hardness = b.getBlockHardness(worldObj, x, y, z); + if(dist < 65 && hardness <= Blocks.stonebrick.getExplosionResistance(null) && hardness >= 0) { Block bl = worldObj.getBlock(x, y - 1, z); if(bl == Blocks.air) { for(int i = 0; i <= depth; i++) { - if(worldObj.getBlock(x, y + i, z).getBlockHardness(worldObj, x, y + i, z) <= Blocks.stonebrick.getExplosionResistance(null)) { + hardness = worldObj.getBlock(x, y + i, z).getBlockHardness(worldObj, x, y + i, z); + if(hardness <= Blocks.stonebrick.getExplosionResistance(null) && hardness >= 0) { EntityFallingBlock entityfallingblock = new EntityFallingBlock(worldObj, x + 0.5D, y + 0.5D + i, z + 0.5D, worldObj.getBlock(x, y + i, z), worldObj.getBlockMetadata(x, y + i, z)); worldObj.spawnEntityInWorld(entityfallingblock); } diff --git a/src/main/java/com/hbm/handler/EntityEffectHandler.java b/src/main/java/com/hbm/handler/EntityEffectHandler.java index 9194f6b0d..78c037158 100644 --- a/src/main/java/com/hbm/handler/EntityEffectHandler.java +++ b/src/main/java/com/hbm/handler/EntityEffectHandler.java @@ -67,6 +67,9 @@ public class EntityEffectHandler { pprps.shield += Math.min(pprps.maxShield - pprps.shield, 0.005F * tsd); } + if(pprps.shield > pprps.maxShield) + pprps.shield = pprps.maxShield; + props.saveNBTData(data); pprps.saveNBTData(data); PacketDispatcher.wrapper.sendTo(new ExtPropPacket(data), (EntityPlayerMP) entity); diff --git a/src/main/java/com/hbm/handler/nei/AnvilRecipeHandler.java b/src/main/java/com/hbm/handler/nei/AnvilRecipeHandler.java index b1c9e4712..4df799a33 100644 --- a/src/main/java/com/hbm/handler/nei/AnvilRecipeHandler.java +++ b/src/main/java/com/hbm/handler/nei/AnvilRecipeHandler.java @@ -86,14 +86,6 @@ public class AnvilRecipeHandler extends TemplateRecipeHandler { } for(int i = 0; i < in.size(); i++) { - - if(in.get(i) instanceof List) { - List array = (List) in.get(i); - - for(ItemStack stack : array) - System.out.println(stack); - } - this.input.add(new PositionedStack(in.get(i), inOX + 18 * (i % inLine), inOY + 18 * (i / inLine))); } diff --git a/src/main/java/com/hbm/hazard/HazardRegistry.java b/src/main/java/com/hbm/hazard/HazardRegistry.java index ff496604f..9bca608eb 100644 --- a/src/main/java/com/hbm/hazard/HazardRegistry.java +++ b/src/main/java/com/hbm/hazard/HazardRegistry.java @@ -467,8 +467,8 @@ public class HazardRegistry { /* * Blacklist */ - HazardSystem.blacklist(TH232.ore()); - HazardSystem.blacklist(U.ore()); + for(String ore : TH232.ores()) HazardSystem.blacklist(ore); + for(String ore : U.ores()) HazardSystem.blacklist(ore); /* diff --git a/src/main/java/com/hbm/inventory/OreDictManager.java b/src/main/java/com/hbm/inventory/OreDictManager.java index 06bf60ac5..67858355b 100644 --- a/src/main/java/com/hbm/inventory/OreDictManager.java +++ b/src/main/java/com/hbm/inventory/OreDictManager.java @@ -685,6 +685,7 @@ public class OreDictManager { public void registerStack(String tag, ItemStack stack) { for(String mat : mats) { + OreDictionary.registerOre(tag + mat, stack); if(!hazards.isEmpty() && hazMult > 0F) { @@ -697,6 +698,16 @@ public class OreDictManager { HazardSystem.register(tag + mat, data); } } + + /* + * Fix for a small oddity in nuclearcraft: many radioactive elements do not have an ore prefix and the sizes + * seem generally inconsistent (TH and U are 20 "tiny"s per ingot while boron is 12), so we assume those to be ingots. + * Therefore we register all ingots a second time but without prefix. TODO: add a config option to disable this compat. + * I'd imagine greg's OD system might not like things without prefixes. + */ + if("ingot".equals(tag)) { + registerStack("", stack); + } } } diff --git a/src/main/java/com/hbm/inventory/gui/GUIRBMKConsole.java b/src/main/java/com/hbm/inventory/gui/GUIRBMKConsole.java index d4947437c..bd2599747 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIRBMKConsole.java +++ b/src/main/java/com/hbm/inventory/gui/GUIRBMKConsole.java @@ -15,6 +15,7 @@ import com.hbm.packet.PacketDispatcher; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.RBMKColumn; +import com.hbm.util.I18nUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; @@ -22,6 +23,7 @@ import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiTextField; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; @@ -90,7 +92,14 @@ public class GUIRBMKConsole extends GuiScreen { this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 61, guiTop + 70, 10, 10, mouseX, mouseY, new String[]{ "Select all control rods" } ); this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 72, guiTop + 70, 10, 10, mouseX, mouseY, new String[]{ "Deselect all" } ); - this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 6, guiTop + 8, 76, 60, mouseX, mouseY, new String[]{ "ignore all this for now" } ); + + for(int i = 0; i < 3; i++) { + for(int j = 0; j < 2; j++) { + int id = i * 2 + j + 1; + this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 6 + 40 * j, guiTop + 8 + 21 * i, 18, 18, mouseX, mouseY, new String[]{ EnumChatFormatting.YELLOW + I18nUtil.resolveKey("rbmk.console." + console.screens[id - 1].type.name().toLowerCase(), id) } ); + this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 24 + 40 * j, guiTop + 8 + 21 * i, 18, 18, mouseX, mouseY, new String[]{ I18nUtil.resolveKey("rbmk.console.assign", id) } ); + } + } this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 6, guiTop + 70, 10, 10, mouseX, mouseY, new String[]{ "Select red group" } ); this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 17, guiTop + 70, 10, 10, mouseX, mouseY, new String[]{ "Select yellow group" } ); @@ -114,6 +123,7 @@ public class GUIRBMKConsole extends GuiScreen { int bY = 11; int size = 10; + //toggle column selection if(guiLeft + 86 <= mouseX && guiLeft + 86 + 150 > mouseX && guiTop + 11 < mouseY && guiTop + 11 + 150 >= mouseY) { int index = ((mouseX - bX - guiLeft) / size + (mouseY - bY - guiTop) / size * 15); @@ -126,12 +136,14 @@ public class GUIRBMKConsole extends GuiScreen { } } + //clear selection if(guiLeft + 72 <= mouseX && guiLeft + 72 + 10 > mouseX && guiTop + 70 < mouseY && guiTop + 70 + 10 >= mouseY) { this.selection = new boolean[15 * 15]; mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 0.5F)); return; } + //select all control rods if(guiLeft + 61 <= mouseX && guiLeft + 61 + 10 > mouseX && guiTop + 70 < mouseY && guiTop + 70 + 10 >= mouseY) { this.selection = new boolean[15 * 15]; @@ -145,6 +157,7 @@ public class GUIRBMKConsole extends GuiScreen { return; } + //select color groups for(int k = 0; k < 5; k++) { if(guiLeft + 6 + k * 11 <= mouseX && guiLeft + 6 + k * 11 + 10 > mouseX && guiTop + 70 < mouseY && guiTop + 70 + 10 >= mouseY) { @@ -162,6 +175,7 @@ public class GUIRBMKConsole extends GuiScreen { } } + //AZ-5 if(guiLeft + 30 <= mouseX && guiLeft + 30 + 28 > mouseX && guiTop + 138 < mouseY && guiTop + 138 + 28 >= mouseY) { if(az5Lid) { @@ -185,6 +199,7 @@ public class GUIRBMKConsole extends GuiScreen { return; } + //save control rod setting if(guiLeft + 48 <= mouseX && guiLeft + 48 + 12 > mouseX && guiTop + 82 < mouseY && guiTop + 82 + 12 >= mouseY) { double level; @@ -208,6 +223,39 @@ public class GUIRBMKConsole extends GuiScreen { PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(control, console.xCoord, console.yCoord, console.zCoord)); mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1F)); } + + //submit selection for status screen + + for(int j = 0; j < 3; j++) { + for(int k = 0; k < 2; k++) { + + int id = j * 2 + k; + + if(guiLeft + 6 + 40 * k <= mouseX && guiLeft + 6 + 40 * k + 18 > mouseX && guiTop + 8 + 21 * j < mouseY && guiTop + 8 + 21 * j + 18 >= mouseY) { + NBTTagCompound control = new NBTTagCompound(); + control.setByte("toggle", (byte) id); + PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(control, console.xCoord, console.yCoord, console.zCoord)); + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 0.5F)); + return; + } + + if(guiLeft + 24 + 40 * k <= mouseX && guiLeft + 24 + 40 * k + 18 > mouseX && guiTop + 8 + 21 * j < mouseY && guiTop + 8 + 21 * j + 18 >= mouseY) { + + NBTTagCompound control = new NBTTagCompound(); + control.setByte("id", (byte) id); + + for(int s = 0; s < selection.length; s++) { + if(selection[s]) { + control.setBoolean("s" + s, true); + } + } + + PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(control, console.xCoord, console.yCoord, console.zCoord)); + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 0.75F)); + return; + } + } + } } @SuppressWarnings("incomplete-switch") //shut up @@ -220,6 +268,13 @@ public class GUIRBMKConsole extends GuiScreen { drawTexturedModalRect(guiLeft + 30, guiTop + 138, 228, 172, 28, 28); } + for(int j = 0; j < 3; j++) { + for(int k = 0; k < 2; k++) { + int id = j * 2 + k; + drawTexturedModalRect(guiLeft + 6 + 40 * k, guiTop + 8 + 21 * j, this.console.screens[id].type.offset, 238, 18, 18); + } + } + int bX = 86; int bY = 11; int size = 10; diff --git a/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java b/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java index 8c9599857..2d7f13c6f 100644 --- a/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java @@ -65,7 +65,7 @@ public class AnvilRecipes { smithingRecipes.add(new AnvilSmithingHotRecipe(3, new ItemStack(ModItems.meteorite_sword_reforged, 1), new ComparableStack(ModItems.meteorite_sword_seared), new ComparableStack(ModItems.ingot_meteorite_forged))); smithingRecipes.add(new AnvilSmithingRecipe(1, new ItemStack(ModItems.gun_ar15, 1), new ComparableStack(ModItems.gun_thompson), new ComparableStack(ModItems.pipe_lead))); smithingRecipes.add(new AnvilSmithingRecipe(1916169, new ItemStack(ModItems.wings_murk, 1), new ComparableStack(ModItems.wings_limp), new ComparableStack(ModItems.particle_tachyon))); - smithingRecipes.add(new AnvilSmithingRecipe(4, new ItemStack(ModItems.flask_infusion, EnumInfusion.SHIELD.ordinal()), new ComparableStack(ModItems.gem_alexandrite), new ComparableStack(ModItems.bottle_nuka))); + smithingRecipes.add(new AnvilSmithingRecipe(4, new ItemStack(ModItems.flask_infusion, 1, EnumInfusion.SHIELD.ordinal()), new ComparableStack(ModItems.gem_alexandrite), new ComparableStack(ModItems.bottle_nuka))); smithingRecipes.add(new AnvilSmithingCyanideRecipe()); smithingRecipes.add(new AnvilSmithingRenameRecipe()); diff --git a/src/main/java/com/hbm/render/tileentity/RenderRBMKConsole.java b/src/main/java/com/hbm/render/tileentity/RenderRBMKConsole.java index 65650bde2..c149f2089 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderRBMKConsole.java +++ b/src/main/java/com/hbm/render/tileentity/RenderRBMKConsole.java @@ -1,14 +1,17 @@ package com.hbm.render.tileentity; import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; import com.hbm.blocks.BlockDummyable; import com.hbm.main.ResourceManager; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.RBMKColumn; -import com.hbm.tileentity.machine.storage.TileEntityMachineFENSU; +import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.RBMKScreen; +import com.hbm.util.I18nUtil; -import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; @@ -72,6 +75,47 @@ public class RenderRBMKConsole extends TileEntitySpecialRenderer { tess.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); + FontRenderer font = Minecraft.getMinecraft().fontRenderer; + GL11.glTranslatef(-0.42F, 3.5F, 1.75F); + GL11.glDepthMask(false); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + + for(int i = 0; i < console.screens.length; i++) { + + GL11.glPushMatrix(); + + if(i % 2 == 1) + GL11.glTranslatef(0, 0, 1.75F * -2); + + GL11.glTranslatef(0, -0.75F * (i / 2), 0); + + RBMKScreen screen = console.screens[i]; + String text = screen.display; + + if(text != null && ! text.isEmpty()) { + + String[] parts = text.split("="); + + if(parts.length == 2) { + text = I18nUtil.resolveKey(parts[0], parts[1]); + } + + int width = font.getStringWidth(text); + int height = font.FONT_HEIGHT; + + float f3 = Math.min(0.03F, 0.8F / Math.max(width, 1)); + GL11.glScalef(f3, -f3, f3); + GL11.glNormal3f(0.0F, 0.0F, -1.0F); + GL11.glRotatef(90, 0, 1, 0); + + font.drawString(text, - width / 2, - height / 2, 0x00ff00); + } + GL11.glPopMatrix(); + } + + GL11.glDepthMask(true); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); } diff --git a/src/main/java/com/hbm/render/tileentity/RendererObjTester.java b/src/main/java/com/hbm/render/tileentity/RendererObjTester.java index aa1ba0f02..53dcfb817 100644 --- a/src/main/java/com/hbm/render/tileentity/RendererObjTester.java +++ b/src/main/java/com/hbm/render/tileentity/RendererObjTester.java @@ -1,6 +1,11 @@ package com.hbm.render.tileentity; +import java.nio.ByteBuffer; +import java.nio.FloatBuffer; + +import org.lwjgl.BufferUtils; import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; import com.hbm.lib.RefStrings; import com.hbm.main.ResourceManager; @@ -11,6 +16,7 @@ import com.hbm.render.util.BeamPronter.EnumWaveType; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; @@ -168,23 +174,64 @@ public class RendererObjTester extends TileEntitySpecialRenderer { GL11.glDepthMask(true); GL11.glShadeModel(GL11.GL_FLAT);*/ - - GL11.glShadeModel(GL11.GL_SMOOTH); - - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glEnable(GL11.GL_LIGHTING); - - bindTexture(ResourceManager.soyuz_module_dome_tex); - ResourceManager.soyuz_module.renderPart("Dome"); - bindTexture(ResourceManager.soyuz_module_lander_tex); - ResourceManager.soyuz_module.renderPart("Capsule"); - bindTexture(ResourceManager.soyuz_module_propulsion_tex); - ResourceManager.soyuz_module.renderPart("Propulsion"); - bindTexture(ResourceManager.soyuz_module_solar_tex); - ResourceManager.soyuz_module.renderPart("Solar"); - - GL11.glShadeModel(GL11.GL_FLAT); + GL11.glTranslated(0D, 4D, 0D); + GL11.glRotated(System.currentTimeMillis() % 3600 / 10D, 0, 0, 1); + GL11.glTranslated(0D, -4D, 0D); + GL11.glRotated(System.currentTimeMillis() % 3600 / 10D, 0, 1, 0); + + GL11.glShadeModel(GL11.GL_SMOOTH); + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glEnable(GL11.GL_LIGHTING); + + //GL11.glDisable(GL11.GL_TEXTURE_2D); + RenderHelper.disableStandardItemLighting(); + RenderHelper.enableStandardItemLighting(); + GL11.glColor4d(1, 1, 1, 1); + GL11.glClearColor(0, 0, 0, 0); + + float amb = 2F; + float dif = 2F; + float spe = 2F; + float shi = 1F; + FloatBuffer iamb = (FloatBuffer) BufferUtils.createFloatBuffer(8).put(new float[] { amb, amb, amb, 1F }).flip(); + FloatBuffer idif = (FloatBuffer) BufferUtils.createFloatBuffer(8).put(new float[] { dif, dif, dif, 1F }).flip(); + FloatBuffer ispe = (FloatBuffer) BufferUtils.createFloatBuffer(8).put(new float[] { spe, spe, spe, 1F }).flip(); + FloatBuffer mamb = (FloatBuffer) BufferUtils.createFloatBuffer(8).put(new float[] { amb, amb, amb, 1F }).flip(); + FloatBuffer mdif = (FloatBuffer) BufferUtils.createFloatBuffer(8).put(new float[] { dif, dif, dif, 1F }).flip(); + FloatBuffer mspe = (FloatBuffer) BufferUtils.createFloatBuffer(8).put(new float[] { spe, spe, spe, 1F }).flip(); + float msh = 128F * shi; + FloatBuffer mem = (FloatBuffer) BufferUtils.createFloatBuffer(8).put(new float[] { 1F, 1F, 1F, 1F }).flip(); + + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glShadeModel(GL11.GL_SMOOTH); + GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT, iamb); + GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, idif); + GL11.glLight(GL11.GL_LIGHT0, GL11.GL_SPECULAR, ispe); + GL11.glLight(GL11.GL_LIGHT1, GL11.GL_AMBIENT, iamb); + GL11.glLight(GL11.GL_LIGHT1, GL11.GL_DIFFUSE, idif); + GL11.glLight(GL11.GL_LIGHT1, GL11.GL_SPECULAR, ispe); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT, mamb); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_DIFFUSE, mdif); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_SPECULAR, mspe); + GL11.glMaterialf(GL11.GL_FRONT, GL11.GL_SHININESS, msh); + GL11.glMaterial(GL11.GL_FRONT, GL11.GL_EMISSION, mem); + GL11.glLightModeli(GL12.GL_LIGHT_MODEL_COLOR_CONTROL, GL12.GL_SEPARATE_SPECULAR_COLOR); + + + bindTexture(ResourceManager.soyuz_module_dome_tex); + ResourceManager.soyuz_module.renderPart("Dome"); + bindTexture(ResourceManager.soyuz_module_lander_tex); + ResourceManager.soyuz_module.renderPart("Capsule"); + bindTexture(ResourceManager.soyuz_module_propulsion_tex); + ResourceManager.soyuz_module.renderPart("Propulsion"); + bindTexture(ResourceManager.soyuz_module_solar_tex); + ResourceManager.soyuz_module.renderPart("Solar"); + + GL11.glShadeModel(GL11.GL_FLAT); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glColor3f(1F, 1F, 1F); + /*GL11.glDisable(GL11.GL_CULL_FACE); GL11.glShadeModel(GL11.GL_SMOOTH); @@ -282,6 +329,7 @@ public class RendererObjTester extends TileEntitySpecialRenderer { }*/ GL11.glPopMatrix(); + RenderHelper.enableStandardItemLighting(); } } \ No newline at end of file diff --git a/src/main/java/com/hbm/tileentity/TileEntityProxyCombo.java b/src/main/java/com/hbm/tileentity/TileEntityProxyCombo.java index df0ebaf0f..e64e5c12f 100644 --- a/src/main/java/com/hbm/tileentity/TileEntityProxyCombo.java +++ b/src/main/java/com/hbm/tileentity/TileEntityProxyCombo.java @@ -198,13 +198,13 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy public long transferPower(long power) { if(!this.power) - return 0; + return power; if(getTile() instanceof IEnergyConnector) { return ((IEnergyConnector)getTile()).transferPower(power); } - return 0; + return power; } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityStirling.java b/src/main/java/com/hbm/tileentity/machine/TileEntityStirling.java index dd30f6e98..29578af85 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityStirling.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityStirling.java @@ -160,7 +160,9 @@ public class TileEntityStirling extends TileEntityLoadedBase implements INBTPack } @Override - public void setPower(long power) { } + public void setPower(long power) { + this.powerBuffer = power; + } @Override public long getPower() { diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKConsole.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKConsole.java index 8e87230c0..ac442c39a 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKConsole.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKConsole.java @@ -1,6 +1,7 @@ package com.hbm.tileentity.machine.rbmk; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Set; @@ -9,6 +10,7 @@ import com.hbm.inventory.fluid.Fluids; import com.hbm.tileentity.TileEntityMachineBase; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControlManual.RBMKColor; import com.hbm.util.I18nUtil; +import com.hbm.util.Tuple.Triplet; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -30,9 +32,15 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon //made this one-dimensional because it's a lot easier to serialize public RBMKColumn[] columns = new RBMKColumn[15 * 15]; + + public RBMKScreen[] screens = new RBMKScreen[6]; public TileEntityRBMKConsole() { super(0); + + for(int i = 0; i < screens.length; i++) { + screens[i] = new RBMKScreen(); + } } @Override @@ -50,9 +58,10 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon this.worldObj.theProfiler.startSection("rbmkConsole_rescan"); rescan(); this.worldObj.theProfiler.endSection(); - - prepareNetworkPack(); + prepareScreenInfo(); } + + prepareNetworkPack(); } } @@ -93,19 +102,103 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon this.fluxBuffer[19] = (int) flux; } + private void prepareScreenInfo() { + + for(RBMKScreen screen : this.screens) { + + if(screen.type == ScreenType.NONE) { + screen.display = null; + continue; + } + + double value = 0; + int count = 0; + + for(Integer i : screen.columns) { + + RBMKColumn col = this.columns[i]; + + if(col == null) + continue; + + switch(screen.type) { + case COL_TEMP: + count++; + value += col.data.getDouble("heat"); + break; + case FUEL_DEPLETION: + if(col.data.hasKey("enrichment")) { + count++; + value += (100D - (col.data.getDouble("enrichment") * 100D)); + } + break; + case FUEL_POISON: + if(col.data.hasKey("xenon")) { + count++; + value += col.data.getDouble("xenon") * 100D; + } + break; + case FUEL_TEMP: + if(col.data.hasKey("c_heat")) { + count++; + value += col.data.getDouble("c_heat"); + } + break; + case ROD_EXTRACTION: + if(col.data.hasKey("level")) { + count++; + value += col.data.getDouble("level") * 100; + } + break; + } + } + + double result = value / (double) count; + String text = ((int)(result * 10)) / 10D + ""; + + switch(screen.type) { + case COL_TEMP: text = "rbmk.screen.temp=" + text + "°C"; break; + case FUEL_DEPLETION: text = "rbmk.screen.depletion=" + text + "%"; break; + case FUEL_POISON: text = "rbmk.screen.xenon=" + text + "%"; break; + case FUEL_TEMP: text = "rbmk.screen.core=" + text + "°C"; break; + case ROD_EXTRACTION: text = "rbmk.screen.rod=" + text + "%"; break; + } + + screen.display = text; + } + } + private void prepareNetworkPack() { NBTTagCompound data = new NBTTagCompound(); + - for(int i = 0; i < columns.length; i++) { + if(this.worldObj.getTotalWorldTime() % 10 == 0) { - if(this.columns[i] != null) { - data.setTag("column_" + i, this.columns[i].data); - data.setShort("type_" + i, (short)this.columns[i].type.ordinal()); + data.setBoolean("full", true); + + for(int i = 0; i < columns.length; i++) { + + if(this.columns[i] != null) { + data.setTag("column_" + i, this.columns[i].data); + data.setShort("type_" + i, (short)this.columns[i].type.ordinal()); + } + } + + data.setIntArray("flux", this.fluxBuffer); + + for(int i = 0; i < this.screens.length; i++) { + RBMKScreen screen = screens[i]; + if(screen.display != null) { + data.setString("t" + i, screen.display); + } } } - data.setIntArray("flux", this.fluxBuffer); + for(int i = 0; i < this.screens.length; i++) { + RBMKScreen screen = screens[i]; + data.setByte("s" + i, (byte) screen.type.ordinal()); + } this.networkPack(data, 50); } @@ -113,16 +206,28 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon @Override public void networkUnpack(NBTTagCompound data) { - this.columns = new RBMKColumn[15 * 15]; - - for(int i = 0; i < columns.length; i++) { + if(data.getBoolean("full")) { + this.columns = new RBMKColumn[15 * 15]; - if(data.hasKey("type_" + i)) { - this.columns[i] = new RBMKColumn(ColumnType.values()[data.getShort("type_" + i)], (NBTTagCompound)data.getTag("column_" + i)); + for(int i = 0; i < columns.length; i++) { + + if(data.hasKey("type_" + i)) { + this.columns[i] = new RBMKColumn(ColumnType.values()[data.getShort("type_" + i)], (NBTTagCompound)data.getTag("column_" + i)); + } + } + + this.fluxBuffer = data.getIntArray("flux"); + + for(int i = 0; i < this.screens.length; i++) { + RBMKScreen screen = screens[i]; + screen.display = data.getString("t" + i); } } - this.fluxBuffer = data.getIntArray("flux"); + for(int i = 0; i < this.screens.length; i++) { + RBMKScreen screen = screens[i]; + screen.type = ScreenType.values()[data.getByte("s" + i)]; + } } @Override @@ -155,6 +260,27 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon } } } + + if(data.hasKey("toggle")) { + int slot = data.getByte("toggle"); + int next = this.screens[slot].type.ordinal() + 1; + ScreenType type = ScreenType.values()[next % ScreenType.values().length]; + this.screens[slot].type = type; + } + + if(data.hasKey("id")) { + int slot = data.getByte("id"); + List list = new ArrayList(); + + for(int i = 0; i < 15 * 15; i++) { + if(data.getBoolean("s" + i)) { + list.add(i); + } + } + + Integer[] cols = list.toArray(new Integer[0]); + this.screens[slot].columns = cols; + } } @Override @@ -182,6 +308,11 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon this.targetX = nbt.getInteger("tX"); this.targetY = nbt.getInteger("tY"); this.targetZ = nbt.getInteger("tZ"); + + for(int i = 0; i < this.screens.length; i++) { + this.screens[i].type = ScreenType.values()[nbt.getByte("t" + i)]; + this.screens[i].columns = Arrays.stream(nbt.getIntArray("s" + i)).boxed().toArray(Integer[]::new); + } } @Override @@ -191,6 +322,11 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon nbt.setInteger("tX", this.targetX); nbt.setInteger("tY", this.targetY); nbt.setInteger("tZ", this.targetZ); + + for(int i = 0; i < this.screens.length; i++) { + nbt.setByte("t" + i, (byte) this.screens[i].type.ordinal()); + nbt.setIntArray("s" + i, Arrays.stream(this.screens[i].columns).mapToInt(Integer::intValue).toArray()); + } } public static class RBMKColumn { @@ -292,4 +428,32 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon this.offset = offset; } } + + public class RBMKScreen { + public ScreenType type = ScreenType.NONE; + public Integer[] columns = new Integer[0]; + public String display = null; + + public RBMKScreen() { } + public RBMKScreen(ScreenType type, Integer[] columns, String display) { + this.type = type; + this.columns = columns; + this.display = display; + } + } + + public static enum ScreenType { + NONE(0 * 18), + COL_TEMP(1 * 18), + ROD_EXTRACTION(2 * 18), + FUEL_DEPLETION(3 * 18), + FUEL_POISON(4 * 18), + FUEL_TEMP(5 * 18); + + public int offset; + + private ScreenType(int offset) { + this.offset = offset; + } + } } diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKOutgasser.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKOutgasser.java index 780abe209..44d309f01 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKOutgasser.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKOutgasser.java @@ -91,7 +91,7 @@ public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implement recipes.put(new ComparableStack(Items.mushroom_stew), new ItemStack(ModItems.glowing_stew)); } - private boolean canProcess() { + public boolean canProcess() { if(slots[0] == null) return false; diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRod.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRod.java index 5e46da82d..ed3c69a31 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRod.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRod.java @@ -175,6 +175,15 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM return 0; } } + + if(te instanceof TileEntityRBMKOutgasser) { + TileEntityRBMKOutgasser rod = (TileEntityRBMKOutgasser)te; + + if(!rod.canProcess()) { + return flux; + } + } + if(te instanceof IRBMKFluxReceiver) { IRBMKFluxReceiver rod = (IRBMKFluxReceiver)te; rod.receiveFlux(stream, flux); diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 9ba6c7c94..1dfb75ba8 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -3349,6 +3349,13 @@ rbmk.heat=Column temperature: %s rbmk.boiler.water=Feedwater: %s / %s rbmk.boiler.steam=Steam: %s / %s rbmk.boiler.type=Compressor: %s +rbmk.console.assign=Assign selected columns to screen #%s +rbmk.console.none=Off +rbmk.console.col_temp=Monitor average column temperature +rbmk.console.rod_extraction=Monitor average control rod extraction +rbmk.console.fuel_depletion=Monitor average fuel depletion +rbmk.console.fuel_poison=Monitor average xenon poisoning +rbmk.console.fuel_temp=Monitor average fuel temperature rbmk.control.level=%s rbmk.control.red=§cRed Group rbmk.control.yellow=§eYellow Group @@ -3360,6 +3367,11 @@ rbmk.rod.depletion=Depletion: %s rbmk.rod.xenon=Xenon poison: %s rbmk.rod.coreTemp=Core temperature: %s rbmk.rod.skinTemp=Skin temperature: %s / %s +rbmk.screen.core=Core: %s +rbmk.screen.depletion=Depl: %s +rbmk.screen.rod=Control: %s +rbmk.screen.temp=Temp: %s +rbmk.screen.xenon=Xenon: %s soundCategory.ntmMachines=NTM Machines diff --git a/src/main/resources/assets/hbm/textures/gui/reactors/gui_rbmk_console.png b/src/main/resources/assets/hbm/textures/gui/reactors/gui_rbmk_console.png index 352ca62f5..877132937 100644 Binary files a/src/main/resources/assets/hbm/textures/gui/reactors/gui_rbmk_console.png and b/src/main/resources/assets/hbm/textures/gui/reactors/gui_rbmk_console.png differ diff --git a/src/main/resources/assets/hbm/textures/models/machines/mixer.png b/src/main/resources/assets/hbm/textures/models/machines/mixer.png new file mode 100644 index 000000000..39101a8da Binary files /dev/null and b/src/main/resources/assets/hbm/textures/models/machines/mixer.png differ diff --git a/src/main/resources/assets/hbm/textures/models/machines/rbmk_control.png b/src/main/resources/assets/hbm/textures/models/machines/rbmk_control.png index ad6377034..203602b6b 100644 Binary files a/src/main/resources/assets/hbm/textures/models/machines/rbmk_control.png and b/src/main/resources/assets/hbm/textures/models/machines/rbmk_control.png differ diff --git a/src/main/resources/assets/hbm/textures/models/projectiles/himars_single.png b/src/main/resources/assets/hbm/textures/models/projectiles/himars_single.png new file mode 100644 index 000000000..2f97a307d Binary files /dev/null and b/src/main/resources/assets/hbm/textures/models/projectiles/himars_single.png differ diff --git a/src/main/resources/assets/hbm/textures/models/projectiles/himars_standard.png b/src/main/resources/assets/hbm/textures/models/projectiles/himars_standard.png new file mode 100644 index 000000000..79604841b Binary files /dev/null and b/src/main/resources/assets/hbm/textures/models/projectiles/himars_standard.png differ diff --git a/src/main/resources/assets/hbm/textures/models/turrets/himars.png b/src/main/resources/assets/hbm/textures/models/turrets/himars.png new file mode 100644 index 000000000..1d468f355 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/models/turrets/himars.png differ