diff --git a/README.md b/README.md index 354948d41..0c17e73dc 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,15 @@ **This is for 1.7.10!** For 1.12, check out these projects: -* NTM Community Edition (WarFactory): https://github.com/MisterNorwood/Hbm-s-Nuclear-Tech-CE +* NTM Community Edition (WarFactory): https://github.com/MisterNorwood/Hbm-s-Nuclear-Tech-CE/releases * NTM Extended Edition (Alcater): https://github.com/Alcatergit/Hbm-s-Nuclear-Tech-GIT/releases * NTM Reloaded: https://github.com/TheOriginalGolem/Hbm-s-Nuclear-Tech-GIT/releases -For 1.18, try Martin's remake: https://codeberg.org/MartinTheDragon/Nuclear-Tech-Mod-Remake/releases +For further ports, try: + +* NTM Remake on 1.18.2: https://codeberg.org/MartinTheDragon/Nuclear-Tech-Mod-Remake/releases +* HBM Modernized on 1.20.1: https://github.com/Raptor324/HBM-Modernized/releases +* NTM Neo on 1.21.1: https://github.com/ohiomannnn/HBMsNTM-NEO-EDITION/releases ## Downloading pre-compiled versions from GitHub diff --git a/changelog b/changelog index 0bda761d0..86f9c9ddb 100644 --- a/changelog +++ b/changelog @@ -10,6 +10,10 @@ * More efficient than MEU but with less durability * Has a new thermal coefficient mechanic, once the core heat exceeds 1000°C, reactivity drops down * Very high diffusion, meaning the core is considerably colder than on most fuels +* RBMK Display panel + * Single block that shows a 7x7 view of a linked RBMK + * Doesn't have a GUI or tooltips or anything, only acts as a monitor + * Ideal for >15x15 reactor monitoring, since the displays are tileable ## Changed * Updated RBMK visuals @@ -44,13 +48,22 @@ * Cold PFM is used up at a steady rate, even if the reactor is already cold * The RBMK structural column recipe now uses only half as many metal plates, and rubber instead of insulator * Changed the way reasim RBMK fuel channels work - * Instead of six randomized neutron streams, reasim rods now use eight half strength streams in an even star pattern + * Instead of six randomized neutron streams, reasim rods now use eight 75% strength streams in an even star pattern * The pattern is rotated in a random multiple of 9° (i.e. four possible angle variations) * RBMK steam channels now spawn steam particles if water is voided due to the steam buffer not being emptied in time * Rebalanced 528 mode * Increased the chance for most precision assembler recipes to succeed * Increased the chance for items to be salvaged by recycling * In expensive mode, the chances have been increased drastically compared to the old values +* Added RoR functionality to some RBMK columns + * Manual control rods can have their target height set, allowing them to be remote controlled without a console + * All fuel channels can now provide values such as column heat, fuel skin heat, depletion and xenon poison +* RBMK consoles and displays no longer show the temperature value of control rods as a red gradient, instead they show the control rods' color grouping +* RBMK fuel rods can no longer be removed by hand if the skin temp exceeds 200°C +* RBMK fuel rods can no longer be cycled via autoloader if the skin temp exceeds 1,000°C + * For fully automated high powered reactors, it may now be necessary to read the depletion via RoR and then throttle the reactor with control rods + * RBMK cranes can still remove any fuel, no matter how hot it is +* RBMK fuel channels will now undergo meltdown if it is broken when a fuel rod is still loaded with a heat temperature of at least 1,500°C ## Fixed * Fixed NBTStack serialization omitting the stack size most of the time, preventing deserialization (mainly in the precision assembler config) @@ -63,3 +76,5 @@ * Fixed fluid output direction being incorrect on boilers, causing them to break with pipe anchors * Fixed an issue where the industrial turbine's tendency to round up the possible operation counter would cause it to use up steam it doesn't actually have * Fixed yet another issue with the settings tool when copying automatic control rod settings +* Fixed quad rocket launcher steering not working right +* Fixed standard and industrial boilers not respecting the heating efficiency value of the fluid trait diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index abeb51912..38559a227 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -1096,6 +1096,7 @@ public class ModBlocks { public static Block rbmk_heater; public static Block rbmk_console; public static Block rbmk_crane_console; + public static Block rbmk_display; public static Block rbmk_autoloader; public static Block rbmk_loader; public static Block rbmk_steam_inlet; @@ -1433,8 +1434,8 @@ public class ModBlocks { deco_lead = new BlockDecoCT(Material.iron).noFortune().setBlockName("deco_lead").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_lead"); deco_beryllium = new BlockDecoCT(Material.iron).noFortune().setBlockName("deco_beryllium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_beryllium"); deco_asbestos = new BlockOutgas(Material.cloth, true, 5, true).noFortune().setBlockName("deco_asbestos").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_asbestos"); - deco_rbmk = new BlockGeneric(Material.iron).setBlockName("deco_rbmk").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(100.0F).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_side"); - deco_rbmk_smooth = new BlockGeneric(Material.iron).setBlockName("deco_rbmk_smooth").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(100.0F).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_top"); + deco_rbmk = new BlockGeneric(Material.iron).setBlockName("deco_rbmk").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(100.0F).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_top"); + deco_rbmk_smooth = new BlockGeneric(Material.iron).setBlockName("deco_rbmk_smooth").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(100.0F).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_blank_top"); deco_emitter = new BlockEmitter().setBlockName("deco_emitter").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(20.0F).setBlockTextureName(RefStrings.MODID + ":emitter"); part_emitter = new PartEmitter().setBlockName("part_emitter").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(20.0F).setBlockTextureName(RefStrings.MODID + ":part_top"); @@ -2115,6 +2116,7 @@ public class ModBlocks { rbmk_heater = new RBMKHeater().setBlockName("rbmk_heater").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_heater"); rbmk_console = new RBMKConsole().setBlockName("rbmk_console").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_console"); rbmk_crane_console = new RBMKCraneConsole().setBlockName("rbmk_crane_console").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_crane_console"); + rbmk_display = new RBMKDisplay().setBlockName("rbmk_display").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_display"); rbmk_autoloader = new RBMKAutoloader().setBlockName("rbmk_autoloader").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(60.0F).setBlockTextureName(RefStrings.MODID + ":rbmk_autoloader"); rbmk_loader = new RBMKLoader(Material.iron).setBlockName("rbmk_loader").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(60.0F).setBlockTextureName(RefStrings.MODID + ":rbmk_loader"); rbmk_steam_inlet = new RBMKInlet(Material.iron).setBlockName("rbmk_steam_inlet").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(60.0F).setBlockTextureName(RefStrings.MODID + ":rbmk_steam_inlet"); @@ -3106,6 +3108,7 @@ public class ModBlocks { GameRegistry.registerBlock(rbmk_heater, rbmk_heater.getUnlocalizedName()); GameRegistry.registerBlock(rbmk_console, rbmk_console.getUnlocalizedName()); GameRegistry.registerBlock(rbmk_crane_console, rbmk_crane_console.getUnlocalizedName()); + register(rbmk_display); register(rbmk_autoloader); register(rbmk_loader); register(rbmk_steam_inlet); diff --git a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKControl.java b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKControl.java index 8f26b37d8..754b95599 100644 --- a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKControl.java +++ b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKControl.java @@ -1,6 +1,7 @@ package com.hbm.blocks.machine.rbmk; import com.hbm.blocks.ModBlocks; +import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControlManual; import cpw.mods.fml.relauncher.Side; @@ -40,6 +41,7 @@ public class RBMKControl extends RBMKPipedBase { @Override public TileEntity createNewTileEntity(World world, int meta) { if(meta >= this.offset) return new TileEntityRBMKControlManual(); + if(meta >= this.extra) return new TileEntityProxyCombo(); return null; } diff --git a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKDisplay.java b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKDisplay.java new file mode 100644 index 000000000..fae8a9e8c --- /dev/null +++ b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKDisplay.java @@ -0,0 +1,96 @@ +package com.hbm.blocks.machine.rbmk; + +import org.lwjgl.opengl.GL11; + +import com.hbm.render.block.ISBRHUniversal; +import com.hbm.render.util.RenderBlocksNT; +import com.hbm.tileentity.machine.rbmk.TileEntityRBMKDisplay; + +import api.hbm.block.IToolable; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class RBMKDisplay extends BlockContainer implements ISBRHUniversal, IToolable { + + public RBMKDisplay() { + super(Material.iron); + } + + @Override public int getRenderType() { return renderID; } + @Override public boolean isOpaqueCube() { return false; } + @Override public boolean renderAsNormalBlock() { return false; } + + @Override + @SideOnly(Side.CLIENT) + public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) { + return true; + } + + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityRBMKDisplay(); + } + + @Override + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { + int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + if(i == 0) world.setBlockMetadataWithNotify(x, y, z, 2, 2); + if(i == 1) world.setBlockMetadataWithNotify(x, y, z, 5, 2); + if(i == 2) world.setBlockMetadataWithNotify(x, y, z, 3, 2); + if(i == 3) world.setBlockMetadataWithNotify(x, y, z, 4, 2); + } + + @Override + public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) { + if(tool != ToolType.SCREWDRIVER) + return false; + if(!world.isRemote) { + TileEntity tile = world.getTileEntity(x, y, z); + if (tile instanceof TileEntityRBMKDisplay) { + ((TileEntityRBMKDisplay) tile).rotate(); + } + } + return true; + } + + @Override + public void renderInventoryBlock(Block block, int meta, int modelId, Object renderBlocks) { + + GL11.glPushMatrix(); + RenderBlocks renderer = (RenderBlocks) renderBlocks; + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + + renderer.setRenderBounds(0.25D, 0D, 0D, 1D, 1D, 1D); + RenderBlocksNT.renderStandardInventoryBlock(block, meta, renderer); + GL11.glPopMatrix(); + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, Object renderBlocks) { + RenderBlocksNT renderer = RenderBlocksNT.INSTANCE.setWorld(world); + + Tessellator tessellator = Tessellator.instance; + tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z)); + tessellator.setColorOpaque_F(1, 1, 1); + + int meta = world.getBlockMetadata(x, y, z); + + renderer.setRenderBounds(meta == 4 ? 0.25D : 0D, 0D, meta == 2 ? 0.25D : 0D, meta == 5 ? 0.75D : 1D, 1D, meta == 3 ? 0.75D : 1D); + renderer.renderStandardBlock(block, x, y, z); + + return true; + } +} diff --git a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKRod.java b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKRod.java index 2d574562e..184b571fa 100644 --- a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKRod.java +++ b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKRod.java @@ -10,6 +10,7 @@ import com.hbm.tileentity.machine.rbmk.TileEntityRBMKRod; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; @@ -38,6 +39,20 @@ public class RBMKRod extends RBMKBase { return null; } + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + if(meta >= this.offset) { + TileEntityRBMKRod tile = (TileEntityRBMKRod) world.getTileEntity(x, y, z); + if(tile != null) { + if(tile.slots[0] != null && tile.slots[0].getItem() instanceof ItemRBMKRod && ItemRBMKRod.getHullHeat(tile.slots[0]) >= 1500) { + tile.meltdown(); + } + } + } + super.breakBlock(world, x, y, z, block, meta); + world.removeTileEntity(x, y, z); + } + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister reg) { diff --git a/src/main/java/com/hbm/entity/projectile/EntityChemical.java b/src/main/java/com/hbm/entity/projectile/EntityChemical.java index 7c4470d7a..b9ebc5e72 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityChemical.java +++ b/src/main/java/com/hbm/entity/projectile/EntityChemical.java @@ -454,21 +454,24 @@ public class EntityChemical extends EntityThrowableNT { } } - Block block = worldObj.getBlock(x, y, z); if(type == Fluids.SEEDSLURRY) { - if(block == Blocks.dirt || block == ModBlocks.waste_earth || block == ModBlocks.dirt_dead || block == ModBlocks.dirt_oily) { - - if(worldObj.getBlockLightValue(x, y + 1, z) >= 9 && worldObj.getBlockLightOpacity(x, y + 1, z) <= 2) { - worldObj.setBlock(x, y, z, Blocks.grass); + + for(int i = -1; i <= 1; i++) for(int j = -1; j <= 1; j++) for(int k = -1; k <= 1; k++) { + Block block = worldObj.getBlock(x + i, y + j, z + k); + if(block == Blocks.dirt || block == ModBlocks.waste_earth || block == ModBlocks.dirt_dead || block == ModBlocks.dirt_oily) { + + if(worldObj.getBlockLightValue(x + i, y + j + 1, z + k) >= 9 && worldObj.getBlockLightOpacity(x + i, y + j + 1, z + k) <= 2) { + worldObj.setBlock(x + i, y + j, z + k, Blocks.grass); + } } + int meta = worldObj.getBlockMetadata(x + i, y + j, z + k); + if(block == Blocks.cobblestone) worldObj.setBlock(x + i, y + j, z + k, Blocks.mossy_cobblestone); + if(block == Blocks.stonebrick && meta == 0) worldObj.setBlock(x + i, y + j, z + k, Blocks.stonebrick, 1, 3); + if(block == ModBlocks.waste_earth) worldObj.setBlock(x + i, y + j, z + k, Blocks.grass); + if(block == ModBlocks.brick_concrete) worldObj.setBlock(x + i, y + j, z + k, ModBlocks.brick_concrete_mossy); + if(block == ModBlocks.concrete_brick_slab && meta % 8 == 0) worldObj.setBlock(x + i, y + j, z + k, ModBlocks.concrete_brick_slab, meta + 1, 3); + if(block == ModBlocks.brick_concrete_stairs) worldObj.setBlock(x + i, y + j, z + k, ModBlocks.brick_concrete_mossy_stairs, meta, 3); } - int meta = worldObj.getBlockMetadata(x, y, z); - if(block == Blocks.cobblestone) worldObj.setBlock(x, y, z, Blocks.mossy_cobblestone); - if(block == Blocks.stonebrick && meta == 0) worldObj.setBlock(x, y, z, Blocks.stonebrick, 1, 3); - if(block == ModBlocks.waste_earth) worldObj.setBlock(x, y, z, Blocks.grass); - if(block == ModBlocks.brick_concrete) worldObj.setBlock(x, y, z, ModBlocks.brick_concrete_mossy); - if(block == ModBlocks.concrete_brick_slab && meta % 8 == 0) worldObj.setBlock(x, y, z, ModBlocks.concrete_brick_slab, meta + 1, 3); - if(block == ModBlocks.brick_concrete_stairs) worldObj.setBlock(x, y, z, ModBlocks.brick_concrete_mossy_stairs, meta, 3); } this.setDead(); diff --git a/src/main/java/com/hbm/inventory/container/ContainerRBMKRod.java b/src/main/java/com/hbm/inventory/container/ContainerRBMKRod.java index 48724764c..73a8bc7b6 100644 --- a/src/main/java/com/hbm/inventory/container/ContainerRBMKRod.java +++ b/src/main/java/com/hbm/inventory/container/ContainerRBMKRod.java @@ -29,7 +29,27 @@ public class ContainerRBMKRod extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) { + public ItemStack slotClick(int index, int button, int mode, EntityPlayer player) { + + if(index == 0) { + + if(rbmk.coldEnoughForManual()) { + return super.slotClick(index, button, mode, player); + } else { + + Slot slot = this.getSlot(index); + ItemStack ret = null; + + if(slot.getHasStack()) ret = slot.getStack().copy(); + return ret; + } + } + + return super.slotClick(index, button, mode, player); + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int par2) { ItemStack var3 = null; Slot var4 = (Slot) this.inventorySlots.get(par2); @@ -38,6 +58,7 @@ public class ContainerRBMKRod extends Container { var3 = var5.copy(); if(par2 <= rbmk.getSizeInventory() - 1) { + if(!rbmk.coldEnoughForManual()) return null; if(!this.mergeItemStack(var5, rbmk.getSizeInventory(), this.inventorySlots.size(), true)) { return null; } diff --git a/src/main/java/com/hbm/inventory/gui/GUIMachineShredder.java b/src/main/java/com/hbm/inventory/gui/GUIMachineShredder.java index ef433374e..d7df00134 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIMachineShredder.java +++ b/src/main/java/com/hbm/inventory/gui/GUIMachineShredder.java @@ -32,11 +32,8 @@ public class GUIMachineShredder extends GuiInfoContainer { boolean flag = false; - if(diFurnace.getGearLeft() == 0 || diFurnace.getGearLeft() == 3) - flag = true; - - if(diFurnace.getGearRight() == 0 || diFurnace.getGearRight() == 3) - flag = true; + if(diFurnace.getGearLeft() == 0 || diFurnace.getGearLeft() == 3) flag = true; + if(diFurnace.getGearRight() == 0 || diFurnace.getGearRight() == 3) flag = true; if(flag) { String[] text = new String[] { "Error: Shredder blades are broken or missing!" }; diff --git a/src/main/java/com/hbm/inventory/gui/GUIRBMKRod.java b/src/main/java/com/hbm/inventory/gui/GUIRBMKRod.java index da68f7b76..0b56a13ff 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIRBMKRod.java +++ b/src/main/java/com/hbm/inventory/gui/GUIRBMKRod.java @@ -8,12 +8,11 @@ import com.hbm.lib.RefStrings; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKRod; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; -public class GUIRBMKRod extends GuiContainer { +public class GUIRBMKRod extends GuiInfoContainer { private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/reactors/gui_rbmk_element.png"); private TileEntityRBMKRod rod; @@ -26,6 +25,16 @@ public class GUIRBMKRod extends GuiContainer { this.ySize = 186; } + @Override + public void drawScreen(int mouseX, int mouseY, float f) { + super.drawScreen(mouseX, mouseY, f); + + if(!rod.coldEnoughForAutoloader()) + this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 20, 16, 16, guiLeft - 8, guiTop + 20 + 16, "Fuel skin temperature has exceeded 1,000°C,", "autoloaders can no longer cycle fuel!"); + if(!rod.coldEnoughForManual()) + this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, "Fuel skin temperature has exceeded 200°C,", "fuel can no longer be removed by hand!"); + } + @Override protected void drawGuiContainerForegroundLayer(int i, int j) { String name = this.rod.hasCustomInventoryName() ? this.rod.getInventoryName() : I18n.format(this.rod.getInventoryName()); @@ -51,5 +60,8 @@ public class GUIRBMKRod extends GuiContainer { int x = (int)(xenon * 58); drawTexturedModalRect(guiLeft + 126, guiTop + 82 - x, 212, 58 - x, 14, x); } + + if(!rod.coldEnoughForAutoloader()) this.drawInfoPanel(guiLeft - 16, guiTop + 20, 16, 16, 6); + if(!rod.coldEnoughForManual()) this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 7); } } diff --git a/src/main/java/com/hbm/items/tool/ItemRBMKTool.java b/src/main/java/com/hbm/items/tool/ItemRBMKTool.java index def28215e..48b03ac97 100644 --- a/src/main/java/com/hbm/items/tool/ItemRBMKTool.java +++ b/src/main/java/com/hbm/items/tool/ItemRBMKTool.java @@ -8,6 +8,7 @@ import com.hbm.blocks.ModBlocks; import com.hbm.blocks.machine.rbmk.RBMKBase; import com.hbm.tileentity.machine.rbmk.TileEntityCraneConsole; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole; +import com.hbm.tileentity.machine.rbmk.TileEntityRBMKDisplay; import com.hbm.util.i18n.I18nUtil; import net.minecraft.block.Block; @@ -48,6 +49,7 @@ public class ItemRBMKTool extends Item { return true; } + //TODO: at this point just add a fucking interface if(b == ModBlocks.rbmk_console && stack.hasTagCompound()) { if(!world.isRemote) { @@ -82,6 +84,21 @@ public class ItemRBMKTool extends Item { return true; } + if(b == ModBlocks.rbmk_display && stack.hasTagCompound()) { + + if(!world.isRemote) { + + TileEntityRBMKDisplay console = (TileEntityRBMKDisplay) world.getTileEntity(x, y, z); + int tx = stack.stackTagCompound.getInteger("posX"); + int ty = stack.stackTagCompound.getInteger("posY"); + int tz = stack.stackTagCompound.getInteger("posZ"); + console.setTarget(tx, ty, tz); + player.addChatComponentMessage(new ChatComponentTranslation(this.getUnlocalizedName() + ".set").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW))); + } + + return true; + } + return false; } diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryRocket.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryRocket.java index c490f4836..014e97148 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryRocket.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryRocket.java @@ -60,7 +60,7 @@ public class XFactoryRocket { }; public static Consumer LAMBDA_STEERING_ACCELERATE = (entity) -> { EntityBulletBaseMK4 bullet = (EntityBulletBaseMK4) entity; - if(!(entity instanceof EntityPlayer)) { + if(!(bullet.getThrower() instanceof EntityPlayer)) { if(bullet.accel < 7) bullet.accel += 0.4D; return; } diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index 40e158e17..e97bca89e 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -410,6 +410,7 @@ public class ClientProxy extends ServerProxy { ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKControlAuto.class, new RenderRBMKControlRod()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCraneConsole.class, new RenderCraneConsole()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKConsole.class, new RenderRBMKConsole()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKDisplay.class, new RenderRBMKDisplay()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKRod.class, new RenderRBMKFuelChannel()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKRodReaSim.class, new RenderRBMKFuelChannel()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKAutoloader.class, new RenderRBMKAutoloader()); diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index ea38c37bc..1353e2891 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -791,6 +791,7 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModBlocks.rbmk_loader, 1), new Object[] { "SCS", "CBC", "SCS", 'S', STEEL.plate(), 'C', CU.ingot(), 'B', ModItems.tank_steel }); addRecipeAuto(new ItemStack(ModBlocks.rbmk_steam_inlet, 1), new Object[] { "SCS", "CBC", "SCS", 'S', STEEL.ingot(), 'C', IRON.plate(), 'B', ModItems.tank_steel }); addRecipeAuto(new ItemStack(ModBlocks.rbmk_steam_outlet, 1), new Object[] { "SCS", "CBC", "SCS", 'S', STEEL.ingot(), 'C', CU.plate(), 'B', ModItems.tank_steel }); + addRecipeAuto(new ItemStack(ModBlocks.rbmk_display, 1), new Object[] { "B", "C", "D", 'B', B.ingot(), 'D', ModBlocks.deco_rbmk, 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.VACUUM_TUBE) }); //addRecipeAuto(new ItemStack(ModBlocks.rbmk_heatex, 1), new Object[] { "SCS", "CBC", "SCS", 'S', STEEL.ingot(), 'C', CU.plate(), 'B', ModItems.pipes_steel }); addRecipeAuto(new ItemStack(ModBlocks.deco_rbmk, 8), new Object[] { "R", 'R', ModBlocks.rbmk_blank }); diff --git a/src/main/java/com/hbm/particle/ParticleRBMKSteam.java b/src/main/java/com/hbm/particle/ParticleRBMKSteam.java index d98e27163..3ea7d0cb1 100644 --- a/src/main/java/com/hbm/particle/ParticleRBMKSteam.java +++ b/src/main/java/com/hbm/particle/ParticleRBMKSteam.java @@ -25,7 +25,7 @@ public class ParticleRBMKSteam extends EntityFX { public ParticleRBMKSteam(TextureManager texman, World world, double x, double y, double z) { super(world, x, y, z); this.theRenderEngine = texman; - this.particleMaxAge = 30; + this.particleMaxAge = 10; this.particleAlpha = 0.25F; this.particleScale = 4F; } @@ -80,10 +80,10 @@ public class ParticleRBMKSteam extends EntityFX { GL11.glTranslatef(pX + x, pY + y, pZ + z); GL11.glRotatef(-RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F); - tess.addVertexWithUV(this.particleScale * -0.25 - 1, -0.25, 0, uMax, vMax); - tess.addVertexWithUV(this.particleScale * -0.25 - 1, this.particleScale - 0.25, 0, uMax, vMin); - tess.addVertexWithUV(this.particleScale * 0.25 - 1, this.particleScale - 0.25, 0, uMin, vMin); - tess.addVertexWithUV(this.particleScale * 0.25 - 1, -0.25, 0, uMin, vMax); + tess.addVertexWithUV(this.particleScale * -0.25 - 0.9375, -0.25, 0, uMax, vMax); + tess.addVertexWithUV(this.particleScale * -0.25 - 0.9375, this.particleScale - 0.25, 0, uMax, vMin); + tess.addVertexWithUV(this.particleScale * 0.25 - 0.9375, this.particleScale - 0.25, 0, uMin, vMin); + tess.addVertexWithUV(this.particleScale * 0.25 - 0.9375, -0.25, 0, uMin, vMax); tess.draw(); diff --git a/src/main/java/com/hbm/render/block/ISBRHUniversal.java b/src/main/java/com/hbm/render/block/ISBRHUniversal.java index a401083b3..592f93970 100644 --- a/src/main/java/com/hbm/render/block/ISBRHUniversal.java +++ b/src/main/java/com/hbm/render/block/ISBRHUniversal.java @@ -8,6 +8,6 @@ public interface ISBRHUniversal { public static int renderID = RenderingRegistry.getNextAvailableRenderId(); - public void renderInventoryBlock(Block block, int metadata, int modelId, Object renderBlocks); + public void renderInventoryBlock(Block block, int meta, int modelId, Object renderBlocks); public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, Object renderBlocks); } diff --git a/src/main/java/com/hbm/render/tileentity/RenderRBMKConsole.java b/src/main/java/com/hbm/render/tileentity/RenderRBMKConsole.java index 2e0933a12..8360fc6ec 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderRBMKConsole.java +++ b/src/main/java/com/hbm/render/tileentity/RenderRBMKConsole.java @@ -60,8 +60,21 @@ public class RenderRBMKConsole extends TileEntitySpecialRenderer { double kx = -0.3725D; double ky = -(i / 15) * 0.125 + 3.625; double kz = -(i % 15) * 0.125 + 0.125D * 7; + + if(col.data.hasKey("color") && col.data.getByte("color") >= 0) { + byte color = col.data.getByte("color"); + if(color == 0) tess.setColorOpaque_I(0xFF0000); + if(color == 1) tess.setColorOpaque_I(0xFFFF00); + if(color == 2) tess.setColorOpaque_I(0x008000); + if(color == 3) tess.setColorOpaque_I(0x0000FF); + if(color == 4) tess.setColorOpaque_I(0x8000FF); + } else { + double heat = col.data.getDouble("heat") / col.data.getDouble("maxHeat"); + double color = 0.65D + (i % 2) * 0.05D; + tess.setColorOpaque_F((float) (color + ((1 - color) * heat)), (float) color, (float) color); + } - drawColumn(tess, kx, ky, kz, (float)(0.65D + (i % 2) * 0.05D), col.data.getDouble("heat") / col.data.getDouble("maxHeat")); + drawColumn(tess, kx, ky, kz, 0, 0); switch(col.type) { case FUEL: @@ -123,7 +136,6 @@ public class RenderRBMKConsole extends TileEntitySpecialRenderer { double width = 0.0625D * 0.75; - tess.setColorOpaque_F((float) (color + ((1 - color) * heat)), color, color); tess.addVertex(x, y + width, z - width); tess.addVertex(x, y + width, z + width); tess.addVertex(x, y - width, z + width); diff --git a/src/main/java/com/hbm/render/tileentity/RenderRBMKDisplay.java b/src/main/java/com/hbm/render/tileentity/RenderRBMKDisplay.java new file mode 100644 index 000000000..676e106f8 --- /dev/null +++ b/src/main/java/com/hbm/render/tileentity/RenderRBMKDisplay.java @@ -0,0 +1,127 @@ +package com.hbm.render.tileentity; + +import org.lwjgl.opengl.GL11; + +import com.hbm.tileentity.machine.rbmk.TileEntityRBMKDisplay; +import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.RBMKColumn; + +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; + +public class RenderRBMKDisplay extends TileEntitySpecialRenderer { + + @Override + public void renderTileEntityAt(TileEntity te, double x, double y, double z, float interp) { + + GL11.glPushMatrix(); + GL11.glTranslated(x + 0.5, y, z + 0.5); + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glEnable(GL11.GL_LIGHTING); + + switch(te.getBlockMetadata()) { + case 2: GL11.glRotatef(90, 0F, 1F, 0F); break; + case 4: GL11.glRotatef(180, 0F, 1F, 0F); break; + case 3: GL11.glRotatef(270, 0F, 1F, 0F); break; + case 5: GL11.glRotatef(0, 0F, 1F, 0F); break; + } + + TileEntityRBMKDisplay display = (TileEntityRBMKDisplay) te; + + GL11.glTranslated(0, 0.5, 0); + GL11.glScaled(1, 8D / 7D, 8D / 7D); + GL11.glTranslated(0, -0.5, 0); + + Tessellator tess = Tessellator.instance; + GL11.glDisable(GL11.GL_TEXTURE_2D); + tess.startDrawingQuads(); + tess.setBrightness(240); + tess.setNormal(1, 0, 0); + + for(int i = 0; i < display.columns.length; i++) { + + RBMKColumn col = display.columns[i]; + + if(col == null) continue; + + double kx = 0.28125D; + double ky = -(i / 7) * 0.125 + 0.875; + double kz = -(i % 7) * 0.125 + 0.125D * 3; + + if(col.data.hasKey("color") && col.data.getByte("color") >= 0) { + byte color = col.data.getByte("color"); + if(color == 0) tess.setColorOpaque_I(0xFF0000); + if(color == 1) tess.setColorOpaque_I(0xFFFF00); + if(color == 2) tess.setColorOpaque_I(0x008000); + if(color == 3) tess.setColorOpaque_I(0x0000FF); + if(color == 4) tess.setColorOpaque_I(0x8000FF); + } else { + double heat = col.data.getDouble("heat") / col.data.getDouble("maxHeat"); + double color = 0.65D + (i % 2) * 0.05D; + tess.setColorOpaque_F((float) (color + ((1 - color) * heat)), (float) color, (float) color); + } + + drawColumn(tess, kx, ky, kz); + + switch(col.type) { + case FUEL: + case FUEL_SIM: drawFuel(tess, kx + 0.01, ky, kz, col.data.getDouble("enrichment")); break; + case CONTROL: drawControl(tess, kx + 0.01, ky, kz, col.data.getDouble("level")); break; + case CONTROL_AUTO: drawControlAuto(tess, kx + 0.01, ky, kz, col.data.getDouble("level")); break; + default: + } + } + + tess.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + + GL11.glPopMatrix(); + } + + private void drawColumn(Tessellator tess, double x, double y, double z) { + + double width = 0.0625D * 0.75; + + tess.addVertex(x, y + width, z - width); + tess.addVertex(x, y + width, z + width); + tess.addVertex(x, y - width, z + width); + tess.addVertex(x, y - width, z - width); + } + + private void drawFuel(Tessellator tess, double x, double y, double z, double enrichment) { + this.drawDot(tess, x, y, z, 0F, 0.25F + (float) (enrichment * 0.75D), 0F); + } + + private void drawControl(Tessellator tess, double x, double y, double z, double level) { + this.drawDot(tess, x, y, z, (float) level, (float) level, 0F); + } + + private void drawControlAuto(Tessellator tess, double x, double y, double z, double level) { + this.drawDot(tess, x, y, z, (float) level, 0F, (float) level); + } + + private void drawDot(Tessellator tess, double x, double y, double z, float r, float g, float b) { + + double width = 0.03125D; + double edge = 0.022097D; + + tess.setColorOpaque_F(r, g, b); + + tess.addVertex(x, y + width, z); + tess.addVertex(x, y + edge, z + edge); + tess.addVertex(x, y, z + width); + tess.addVertex(x, y - edge, z + edge); + + tess.addVertex(x, y + edge, z - edge); + tess.addVertex(x, y + width, z); + tess.addVertex(x, y - edge, z - edge); + tess.addVertex(x, y, z - width); + + tess.addVertex(x, y + width, z); + tess.addVertex(x, y - edge, z + edge); + tess.addVertex(x, y - width, z); + tess.addVertex(x, y - edge, z - edge); + + tess.setColorOpaque_F(1F, 1F, 1F); + } +} diff --git a/src/main/java/com/hbm/tileentity/TileMappings.java b/src/main/java/com/hbm/tileentity/TileMappings.java index 1f5aa5bda..ea00242cb 100644 --- a/src/main/java/com/hbm/tileentity/TileMappings.java +++ b/src/main/java/com/hbm/tileentity/TileMappings.java @@ -402,6 +402,7 @@ public class TileMappings { put(TileEntityRBMKStorage.class, "tileentity_rbmk_storage"); put(TileEntityCraneConsole.class, "tileentity_rbmk_crane_console"); put(TileEntityRBMKConsole.class, "tileentity_rbmk_console"); + put(TileEntityRBMKDisplay.class, "tileentity_rbmk_display"); put(TileEntityRBMKInlet.class, "tileentity_rbmk_inlet"); put(TileEntityRBMKOutlet.class, "tileentity_rbmk_outlet"); put(TileEntityRBMKAutoloader.class, "tileentity_rbmk_autoloader"); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityHeatBoiler.java b/src/main/java/com/hbm/tileentity/machine/TileEntityHeatBoiler.java index b1602f53e..28e150fea 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityHeatBoiler.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityHeatBoiler.java @@ -215,15 +215,16 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements IBufPa if(trait.getEfficiency(HeatingType.BOILER) > 0) { HeatingStep entry = trait.getFirstStep(); + int heatReq = (int) Math.max(entry.heatReq / trait.getEfficiency(HeatingType.BOILER), 1); int inputOps = this.tanks[0].getFill() / entry.amountReq; int outputOps = (this.tanks[1].getMaxFill() - this.tanks[1].getFill()) / entry.amountProduced; - int heatOps = this.heat / entry.heatReq; + int heatOps = this.heat / heatReq; int ops = Math.min(inputOps, Math.min(outputOps, heatOps)); this.tanks[0].setFill(this.tanks[0].getFill() - entry.amountReq * ops); this.tanks[1].setFill(this.tanks[1].getFill() + entry.amountProduced * ops); - this.heat -= entry.heatReq * ops; + this.heat -= heatReq * ops; if(ops > 0 && worldObj.rand.nextInt(400) == 0) { worldObj.playSoundEffect(xCoord + 0.5, yCoord + 2, zCoord + 0.5, "hbm:block.boilerGroan", 0.5F, 1.0F); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityHeatBoilerIndustrial.java b/src/main/java/com/hbm/tileentity/machine/TileEntityHeatBoilerIndustrial.java index e7bd7bace..fcb675dea 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityHeatBoilerIndustrial.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityHeatBoilerIndustrial.java @@ -201,15 +201,16 @@ public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase impleme if(trait.getEfficiency(HeatingType.BOILER) > 0) { HeatingStep entry = trait.getFirstStep(); + int heatReq = (int) Math.max(entry.heatReq / trait.getEfficiency(HeatingType.BOILER), 1); int inputOps = this.tanks[0].getFill() / entry.amountReq; int outputOps = (this.tanks[1].getMaxFill() - this.tanks[1].getFill()) / entry.amountProduced; - int heatOps = this.heat / entry.heatReq; + int heatOps = this.heat / heatReq; int ops = Math.min(inputOps, Math.min(outputOps, heatOps)); this.tanks[0].setFill(this.tanks[0].getFill() - entry.amountReq * ops); this.tanks[1].setFill(this.tanks[1].getFill() + entry.amountProduced * ops); - this.heat -= entry.heatReq * ops; + this.heat -= heatReq * ops; if(ops > 0 && worldObj.rand.nextInt(400) == 0) { worldObj.playSoundEffect(xCoord + 0.5, yCoord + 2, zCoord + 0.5, "hbm:block.boilerGroan", 0.5F, 1.0F); diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKAutoloader.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKAutoloader.java index 8ba45ef55..f564eb3db 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKAutoloader.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKAutoloader.java @@ -72,8 +72,10 @@ public class TileEntityRBMKAutoloader extends TileEntityMachineBase implements I TileEntity tile = worldObj.getTileEntity(pos[0], pos[1], pos[2]); if(tile instanceof TileEntityRBMKRod) { TileEntityRBMKRod rod = (TileEntityRBMKRod) tile; - if(rod.slots[0] == null || (rod.slots[0] != null && rod.slots[0].getItem() instanceof ItemRBMKRod && ItemRBMKRod.getEnrichment(rod.slots[0]) * 100 < cycle)) { - this.isRetracting = false; + if(rod.coldEnoughForAutoloader()) { + if(rod.slots[0] == null || (rod.slots[0] != null && rod.slots[0].getItem() instanceof ItemRBMKRod && ItemRBMKRod.getEnrichment(rod.slots[0]) * 100 < cycle)) { + this.isRetracting = false; + } } } } diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBoiler.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBoiler.java index c638a75b9..a32131591 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBoiler.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBoiler.java @@ -103,7 +103,8 @@ public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements I data.setString("type", "rbmksteam"); PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, xCoord + 0.25 + worldObj.rand.nextInt(2) * 0.5, yCoord + RBMKDials.getColumnHeight(worldObj), zCoord + 0.25 + worldObj.rand.nextInt(2) * 0.5), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 100)); MainRegistry.proxy.effectNT(data); - this.ventDelay = 20; + this.ventDelay = 20 + worldObj.rand.nextInt(10); + this.worldObj.playSoundEffect(xCoord, yCoord + RBMKDials.getColumnHeight(worldObj), zCoord, "hbm:block.steamEngineOperate", 2F, 1F + worldObj.rand.nextFloat() * 0.25F); } } @@ -112,7 +113,7 @@ public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements I this.trySubscribe(feed.getTankType(), worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y); for(DirPos pos : getOutputPos()) { - if(this.steam.getFill() > 0) this.sendFluid(steam, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); + if(this.steam.getFill() > 0) this.tryProvide(steam, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKControlManual.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKControlManual.java index 6788dce16..0792215f3 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKControlManual.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKControlManual.java @@ -8,6 +8,7 @@ import com.hbm.inventory.gui.GUIRBMKControl; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType; import com.hbm.util.EnumUtil; +import api.hbm.redstoneoverradio.IRORInteractive; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -22,7 +23,7 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import net.minecraft.world.World; -public class TileEntityRBMKControlManual extends TileEntityRBMKControl implements IControlReceiver, ICopiable { +public class TileEntityRBMKControlManual extends TileEntityRBMKControl implements IControlReceiver, ICopiable, IRORInteractive { public RBMKColor color; public double startingLevel; @@ -193,4 +194,24 @@ public class TileEntityRBMKControlManual extends TileEntityRBMKControl implement public void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) { if(nbt.hasKey("color")) color = EnumUtil.grabEnumSafely(RBMKColor.class, nbt.getInteger("color")); } + + @Override + public String[] getFunctionInfo() { + return new String[] { + PREFIX_FUNCTION + "setrods" + NAME_SEPARATOR + "percent" + }; + } + + @Override + public String runRORFunction(String name, String[] params) { + + if((PREFIX_FUNCTION + "setrods").equals(name) && params.length > 0) { + int percent = IRORInteractive.parseInt(params[0], 0, 100); + this.targetLevel = percent / 100D; + this.markDirty(); + return null; + } + + return null; + } } diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKDisplay.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKDisplay.java new file mode 100644 index 000000000..6349419d0 --- /dev/null +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKDisplay.java @@ -0,0 +1,147 @@ +package com.hbm.tileentity.machine.rbmk; + +import com.hbm.tileentity.TileEntityLoadedBase; +import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType; +import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.RBMKColumn; +import com.hbm.util.BufferUtil; +import com.hbm.util.Compat; + +import io.netty.buffer.ByteBuf; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + +public class TileEntityRBMKDisplay extends TileEntityLoadedBase { + + private int targetX; + private int targetY; + private int targetZ; + + private byte rotation; + + public RBMKColumn[] columns = new RBMKColumn[7 * 7]; + + @Override + public void updateEntity() { + + if(!worldObj.isRemote) { + + if(this.worldObj.getTotalWorldTime() % 10 == 0) { + rescan(); + this.networkPackNT(50); + } + } + } + + public void setTarget(int x, int y, int z) { + this.targetX = x; + this.targetY = y; + this.targetZ = z; + this.markDirty(); + } + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + + for(RBMKColumn column : this.columns) { + if(column == null || column.type == null) + buf.writeByte(-1); + else { + buf.writeByte((byte) column.type.ordinal()); + BufferUtil.writeNBT(buf, column.data); + } + } + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + + for(int i = 0; i < this.columns.length; i++) { + byte ordinal = buf.readByte(); + if(ordinal == -1) + this.columns[i] = null; + else + this.columns[i] = new RBMKColumn(ColumnType.values()[ordinal], BufferUtil.readNBT(buf)); + } + } + + private void rescan() { + + for(int index = 0; index < columns.length; index++) { + int rx = getXFromIndex(index); + int rz = getZFromIndex(index); + + TileEntity te = Compat.getTileStandard(worldObj, targetX + rx, targetY, targetZ + rz); + + if(te instanceof TileEntityRBMKBase) { + + TileEntityRBMKBase rbmk = (TileEntityRBMKBase)te; + + columns[index] = new RBMKColumn(rbmk.getConsoleType(), rbmk.getNBTForConsole()); + columns[index].data.setDouble("heat", rbmk.heat); + columns[index].data.setDouble("maxHeat", rbmk.maxHeat()); + + if(te instanceof TileEntityRBMKControlManual) { + TileEntityRBMKControlManual control = (TileEntityRBMKControlManual) te; + if(control.color != null) { + columns[index].data.setByte("color", (byte) control.color.ordinal()); + } else { + columns[index].data.setByte("color", (byte) -1); + } + } + + } else { + columns[index] = null; + } + } + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + this.targetX = nbt.getInteger("tX"); + this.targetY = nbt.getInteger("tY"); + this.targetZ = nbt.getInteger("tZ"); + this.rotation = nbt.getByte("rotation"); + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + nbt.setInteger("tX", this.targetX); + nbt.setInteger("tY", this.targetY); + nbt.setInteger("tZ", this.targetZ); + nbt.setByte("rotation", this.rotation); + } + + public void rotate() { + rotation = (byte)((rotation + 1) % 4); + } + + public int getXFromIndex(int col) { + int i = col % 7 - 3; + int j = col / 7 - 3; + switch (rotation) { + case 0: return i; + case 1: return -j; + case 2: return -i; + case 3: return j; + } + return i; + } + + public int getZFromIndex(int col) { + int i = col % 7 - 3; + int j = col / 7 - 3; + switch (rotation) { + case 0: return j; + case 1: return i; + case 2: return -j; + case 3: return -i; + } + return j; + } +} 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 ca7814eda..45612c190 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRod.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRod.java @@ -20,6 +20,7 @@ import com.hbm.util.BufferUtil; import com.hbm.util.CompatEnergyControl; import com.hbm.util.ParticleUtil; +import api.hbm.redstoneoverradio.IRORValueProvider; import api.hbm.tile.IInfoProviderEC; import com.hbm.util.fauxpointtwelve.BlockPos; import cpw.mods.fml.common.Optional; @@ -43,7 +44,7 @@ import java.util.ArrayList; import java.util.List; @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")}) -public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBMKFluxReceiver, IRBMKLoadable, IInfoProviderEC, SimpleComponent, CompatHandler.OCComponent { +public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBMKFluxReceiver, IRBMKLoadable, IInfoProviderEC, SimpleComponent, CompatHandler.OCComponent, IRORValueProvider { // New system!! // Used for receiving flux (calculating outbound flux/burning rods) @@ -88,6 +89,28 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM fluxFastRatio = (fastFlux + fastFluxIn) / fluxQuantity; } + public boolean coldEnoughForAutoloader() { + if(slots[0] != null && slots[0].getItem() instanceof ItemRBMKRod) { + return ItemRBMKRod.getHullHeat(slots[0]) <= 1_000; + } + return true; + } + public boolean coldEnoughForManual() { + if(slots[0] != null && slots[0].getItem() instanceof ItemRBMKRod) { + return ItemRBMKRod.getHullHeat(slots[0]) <= 200; + } + return true; + } + + @Override + public void invalidate() { + super.invalidate(); + + if(slots[0] != null && slots[0].getItem() instanceof ItemRBMKRod && ItemRBMKRod.getHullHeat(slots[0]) >= 150) { + this.meltdown(); + } + } + @Override public void updateEntity() { @@ -104,13 +127,8 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM // Experimental flux ratio curve rods! // Again, nothing really uses this so its just idle code at the moment. if(rod.specialFluxCurve) { - fluxRatioOut = rod.fluxRatioOut(this.fluxFastRatio, ItemRBMKRod.getEnrichment(slots[0])); - - double fluxIn; - - fluxIn = rod.fluxFromRatio(this.fluxQuantity, this.fluxFastRatio); - + double fluxIn = rod.fluxFromRatio(this.fluxQuantity, this.fluxFastRatio); fluxQuantityOut = rod.burn(worldObj, slots[0], fluxIn); } else { NType rType = rod.rType; @@ -527,4 +545,25 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM data.setDouble(CompatEnergyControl.D_MELT_C, ((ItemRBMKRod) slots[0].getItem()).meltingPoint); } } + + @Override + public String[] getFunctionInfo() { + return new String[] { + PREFIX_VALUE + "columnheat", + PREFIX_VALUE + "rodheat", + PREFIX_VALUE + "depletion", + PREFIX_VALUE + "xenon" + }; + } + + @Override + public String provideRORValue(String name) { + if((PREFIX_VALUE + "columnheat").equals(name)) return "" + this.heat; + if(slots[0] != null && slots[0].getItem() instanceof ItemRBMKRod) { + if((PREFIX_VALUE + "rodheat").equals(name)) return "" + ItemRBMKRod.getHullHeat(slots[0]); + if((PREFIX_VALUE + "depletion").equals(name)) return "" + (100 - ItemRBMKRod.getEnrichment(slots[0]) * 100); + if((PREFIX_VALUE + "xenon").equals(name)) return "" + (ItemRBMKRod.getPoison(slots[0]) * 100); + } + return null; + } } diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRodReaSim.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRodReaSim.java index 9ef055227..47652db81 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRodReaSim.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRodReaSim.java @@ -44,7 +44,7 @@ public class TileEntityRBMKRodReaSim extends TileEntityRBMKRod { Vec3NT vec = new Vec3NT(1, 0, 0); vec.rotateAroundYDeg(worldObj.rand.nextInt(4) * 9D); for(int i = 0; i < 8; i++) { - new RBMKNeutronHandler.RBMKNeutronStream(node, vec, flux * 0.5, ratio); + new RBMKNeutronHandler.RBMKNeutronStream(node, new Vec3NT(vec), flux * 0.75, ratio); vec.rotateAroundYDeg(45D); } } diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index ffd4abecc..16739e94d 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -4884,7 +4884,10 @@ tile.rbmk_console.name=RBMK Konsole tile.rbmk_control.name=RBMK Steuerstäbe tile.rbmk_control_auto.name=RBMK Automatische Steuerstäbe tile.rbmk_control_mod.name=RBMK Moderierte Steuerstäbe +tile.rbmk_control_reasim.name=RBMK Steuerstäbe (ReaSim) +tile.rbmk_control_reasim_auto.name=RBMK Automatische Steuerstäbe (ReaSim) tile.rbmk_crane_console.name=RBMK Kransteuerung +tile.rbmk_display.name=RBMK Anzeigepanel tile.rbmk_heater.name=RBMK-Heizer tile.rbmk_loader.name=RBMK-Dampfadapter tile.rbmk_moderator.name=RBMK Graphitmoderator diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index e19b29926..9c2c889f3 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -6163,7 +6163,10 @@ tile.rbmk_cooler.name=RBMK Cooler tile.rbmk_control.name=RBMK Control Rods tile.rbmk_control_auto.name=RBMK Automatic Control Rods tile.rbmk_control_mod.name=RBMK Moderated Control Rods +tile.rbmk_control_reasim.name=RBMK Control Rods (ReaSim) +tile.rbmk_control_reasim_auto.name=RBMK Automatic Control Rods (ReaSim) tile.rbmk_crane_console.name=RBMK Crane Console +tile.rbmk_display.name=RBMK Display Panel tile.rbmk_heater.name=RBMK Fluid Heater tile.rbmk_loader.name=RBMK Steam Connector tile.rbmk_loader.desc=Allows RBMKs to have both water and steam connections at the bottom$Place one water pipe below the RBMK column, then the connector,$then connect the steam duct to the connector. @@ -6226,6 +6229,14 @@ tile.rbmk.dodd.steam_amt=Steam Amount tile.rbmk.dodd.cryo_amt=Cryo Amount tile.rbmk.dodd.gas_amt=Gas Amount tile.rbmk.dodd.fuel_amt=Fuel Amount +tile.rbmk.dodd.t0=Cold PFM Amount +tile.rbmk.dodd.t0_max=Cold PFM Capacity +tile.rbmk.dodd.t0_type=Cold PFM Type +tile.rbmk.dodd.t0_p=Cold PFM Pressure +tile.rbmk.dodd.t1=PFM Amount +tile.rbmk.dodd.t1_max=PFM Capacity +tile.rbmk.dodd.t1_type=PFM Type +tile.rbmk.dodd.t1_p=PFM Pressure tile.reactor_computer.name=Reactor Control tile.reactor_conductor.name=Reactor Boiler tile.reactor_control.name=Control Rods diff --git a/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_display.png b/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_display.png new file mode 100644 index 000000000..3d7b115b4 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_display.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_element_cover_top.png b/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_element_cover_top.png index 227abb0d1..99662cef4 100644 Binary files a/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_element_cover_top.png and b/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_element_cover_top.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_element_mod_cover_top.png b/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_element_mod_cover_top.png index c1e771dcf..24cfdce2c 100644 Binary files a/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_element_mod_cover_top.png and b/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_element_mod_cover_top.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_element_reasim_cover_top.png b/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_element_reasim_cover_top.png index 6f0e6da20..77d3398ab 100644 Binary files a/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_element_reasim_cover_top.png and b/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_element_reasim_cover_top.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_element_reasim_mod_cover_top.png b/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_element_reasim_mod_cover_top.png index 074a9ed31..c7fb9a602 100644 Binary files a/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_element_reasim_mod_cover_top.png and b/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_element_reasim_mod_cover_top.png differ