diff --git a/assets/hbm/lang/de_DE.lang b/assets/hbm/lang/de_DE.lang index 97cf58d78..0112c90bf 100644 --- a/assets/hbm/lang/de_DE.lang +++ b/assets/hbm/lang/de_DE.lang @@ -413,6 +413,8 @@ tile.machine_selenium.name=Hochleistungs-Sternmotor container.machineSelenium=Hochleistungs-Sternmotor tile.machine_reactor_small.name=Atomreaktor container.reactorSmall=Atomreaktor +tile.machine_controller.name=Reaktorfernsteuerung +container.reactorControl=Reaktorfernsteuerung tile.broadcaster_pc.name=Korrupter Sender @@ -1822,6 +1824,7 @@ item.crystal_energy.name=Energiekristall item.pellet_coolant.name=Kühlcluster item.linker.name=Telelinker +item.reactor_sensor.name=Reaktor-Fernsensor item.oil_detector.name=Ölvorkommen-Detektor item.geiger_counter.name=Mobiler Geigerzähler tile.geiger.name=Geigerzähler diff --git a/assets/hbm/lang/en_US.lang b/assets/hbm/lang/en_US.lang index 0485935b0..0cdbde8dd 100644 --- a/assets/hbm/lang/en_US.lang +++ b/assets/hbm/lang/en_US.lang @@ -322,8 +322,8 @@ container.puf6_tank=PuF6 Tank tile.machine_reactor.name=Breeding Reactor tile.machine_reactor_on.name=Breeding Reactor container.reactor=Breeding Reactor -tile.machine_nuke_furnace_off.name=Nuclear Powered Furnace -tile.machine_nuke_furnace_on.name=Nuclear Powered Furnace +tile.machine_nuke_furnace_off.name=Nuclear Furnace +tile.machine_nuke_furnace_on.name=Nuclear Furnace container.nukeFurnace=Nuclear Powered Furnace tile.machine_rtg_furnace_off.name=RTG Furnace tile.machine_rtg_furnace_on.name=RTG Furnace @@ -413,6 +413,8 @@ tile.machine_selenium.name=Radial Performance Engine container.machineSelenium=Radial Performance Engine tile.machine_reactor_small.name=Nuclear Reactor container.reactorSmall=Nuclear Reactor +tile.machine_controller.name=Reactor Remote Control Block +container.reactorControl=Reactor Remote Control Block tile.broadcaster_pc.name=Corrupted Broadcaster @@ -1822,6 +1824,7 @@ item.crystal_energy.name=Energy Crystal item.pellet_coolant.name=Coolant Cluster item.linker.name=Telelinker +item.reactor_sensor.name=Reactor Remote Sensor item.oil_detector.name=Oil Reservoir Detector item.geiger_counter.name=Handheld Geiger Counter tile.geiger.name=Geiger Counter diff --git a/assets/hbm/textures/blocks/machine_controller.png b/assets/hbm/textures/blocks/machine_controller.png new file mode 100644 index 000000000..9b642494b Binary files /dev/null and b/assets/hbm/textures/blocks/machine_controller.png differ diff --git a/assets/hbm/textures/blocks/machine_controller_back.png b/assets/hbm/textures/blocks/machine_controller_back.png new file mode 100644 index 000000000..6c37af125 Binary files /dev/null and b/assets/hbm/textures/blocks/machine_controller_back.png differ diff --git a/assets/hbm/textures/blocks/machine_controller_side.png b/assets/hbm/textures/blocks/machine_controller_side.png new file mode 100644 index 000000000..85afb7147 Binary files /dev/null and b/assets/hbm/textures/blocks/machine_controller_side.png differ diff --git a/assets/hbm/textures/blocks/machine_controller_top.png b/assets/hbm/textures/blocks/machine_controller_top.png new file mode 100644 index 000000000..9a395535b Binary files /dev/null and b/assets/hbm/textures/blocks/machine_controller_top.png differ diff --git a/assets/hbm/textures/gui/gui_reactor_control.png b/assets/hbm/textures/gui/gui_reactor_control.png index b05342546..0d5e3040d 100644 Binary files a/assets/hbm/textures/gui/gui_reactor_control.png and b/assets/hbm/textures/gui/gui_reactor_control.png differ diff --git a/assets/hbm/textures/items/reactor_sensor.png b/assets/hbm/textures/items/reactor_sensor.png new file mode 100644 index 000000000..4a07e928e Binary files /dev/null and b/assets/hbm/textures/items/reactor_sensor.png differ diff --git a/com/hbm/blocks/ModBlocks.java b/com/hbm/blocks/ModBlocks.java index 0c34ba6a4..22eb39b10 100644 --- a/com/hbm/blocks/ModBlocks.java +++ b/com/hbm/blocks/ModBlocks.java @@ -979,7 +979,7 @@ public class ModBlocks { machine_press = new MachinePress(Material.iron).setBlockName("machine_press").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_press"); machine_selenium = new MachineSeleniumEngine(Material.iron).setBlockName("machine_selenium").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_selenium"); machine_reactor_small = new MachineReactorSmall(Material.iron).setBlockName("machine_reactor_small").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_reactor_small"); - machine_controller = new MachineReactorControl(Material.iron).setBlockName("machine_controller").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":code"); + machine_controller = new MachineReactorControl(Material.iron).setBlockName("machine_controller").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); machine_boiler_off = new MachineBoiler(false).setBlockName("machine_boiler_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_boiler_off"); machine_boiler_on = new MachineBoiler(true).setBlockName("machine_boiler_on").setHardness(5.0F).setResistance(10.0F).setLightLevel(1.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":machine_boiler_on"); diff --git a/com/hbm/blocks/machine/MachineReactorControl.java b/com/hbm/blocks/machine/MachineReactorControl.java index bbe0474af..67137b91d 100644 --- a/com/hbm/blocks/machine/MachineReactorControl.java +++ b/com/hbm/blocks/machine/MachineReactorControl.java @@ -3,22 +3,136 @@ package com.hbm.blocks.machine; import java.util.Random; import com.hbm.blocks.ModBlocks; +import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; import com.hbm.tileentity.machine.TileEntityReactorControl; 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.block.BlockContainer; import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class MachineReactorControl extends BlockContainer { + + @SideOnly(Side.CLIENT) + private IIcon iconTop; + @SideOnly(Side.CLIENT) + private IIcon iconFront; + @SideOnly(Side.CLIENT) + private IIcon iconBack; + + private final Random field_149933_a = new Random(); + private Random rand; + private static boolean keepInventory; public MachineReactorControl(Material p_i45386_1_) { super(p_i45386_1_); } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconRegister) { + this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":machine_controller_top"); + this.iconFront = iconRegister.registerIcon(RefStrings.MODID + ":machine_controller"); + this.iconBack = iconRegister.registerIcon(RefStrings.MODID + ":machine_controller_back"); + this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_controller_side"); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int metadata) { + + if(metadata == 0) + metadata = 3; + + if(metadata == side) + return iconFront; + + if(side == 0 || side == 1) + return iconTop; + + if(metadata == 2 && side == 3 || + metadata == 3 && side == 2 || + metadata == 4 && side == 5 || + metadata == 5 && side == 4) + return iconBack; + + return blockIcon; + } + + private void setDefaultDirection(World world, int x, int y, int z) { + if(!world.isRemote) + { + Block block1 = world.getBlock(x, y, z - 1); + Block block2 = world.getBlock(x, y, z + 1); + Block block3 = world.getBlock(x - 1, y, z); + Block block4 = world.getBlock(x + 1, y, z); + + byte b0 = 3; + + if(block1.func_149730_j() && !block2.func_149730_j()) + { + b0 = 3; + } + if(block2.func_149730_j() && !block1.func_149730_j()) + { + b0 = 2; + } + if(block3.func_149730_j() && !block4.func_149730_j()) + { + b0 = 5; + } + if(block4.func_149730_j() && !block3.func_149730_j()) + { + b0 = 4; + } + + world.setBlockMetadataWithNotify(x, y, z, b0, 2); + } + } + + @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); + } + + if(itemStack.hasDisplayName()) + { + ((TileEntityReactorControl)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName()); + } + } @Override public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { @@ -31,6 +145,58 @@ public class MachineReactorControl extends BlockContainer { return Item.getItemFromBlock(this); } + @Override + public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) + { + if (!keepInventory) + { + ISidedInventory tileentityfurnace = (ISidedInventory)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); + + if (tileentityfurnace != null) + { + for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) + { + ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); + + if (itemstack != null) + { + float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + + while (itemstack.stackSize > 0) + { + int j1 = this.field_149933_a.nextInt(21) + 10; + + if (j1 > itemstack.stackSize) + { + j1 = itemstack.stackSize; + } + + itemstack.stackSize -= j1; + EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + + if (itemstack.hasTagCompound()) + { + entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); + } + + float f3 = 0.05F; + entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3; + entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3; + p_149749_1_.spawnEntityInWorld(entityitem); + } + } + } + + p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); + } + } + + super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); + } + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) @@ -49,4 +215,23 @@ public class MachineReactorControl extends BlockContainer { } } + @Override + public boolean hasComparatorInputOverride() + { + return true; + } + + @Override + public int getComparatorInputOverride(World world, int x, int y, int z, int p_149736_5_) + { + TileEntityReactorControl entity = (TileEntityReactorControl) world.getTileEntity(x, y, z); + + if(entity != null) + { + return (int)Math.ceil((double)entity.coreHeat * 15D / 50000D); + } + + return 0; + } + } diff --git a/com/hbm/blocks/machine/MachineRtgFurnace.java b/com/hbm/blocks/machine/MachineRtgFurnace.java index 9cb4290fe..c73d57b9f 100644 --- a/com/hbm/blocks/machine/MachineRtgFurnace.java +++ b/com/hbm/blocks/machine/MachineRtgFurnace.java @@ -9,6 +9,7 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -177,7 +178,7 @@ public class MachineRtgFurnace extends BlockContainer { { if (!keepInventory) { - TileEntityRtgFurnace tileentityfurnace = (TileEntityRtgFurnace)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); + ISidedInventory tileentityfurnace = (ISidedInventory)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); if (tileentityfurnace != null) { diff --git a/com/hbm/inventory/gui/GUIReactorControl.java b/com/hbm/inventory/gui/GUIReactorControl.java index ed7cfbfd2..306e15539 100644 --- a/com/hbm/inventory/gui/GUIReactorControl.java +++ b/com/hbm/inventory/gui/GUIReactorControl.java @@ -30,8 +30,46 @@ public class GUIReactorControl extends GuiInfoContainer { @Override public void drawScreen(int mouseX, int mouseY, float f) { super.drawScreen(mouseX, mouseY, f); + + this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 34, 88, 4, new String[] { "Fuel: " + control.fuel + "%" }); + this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 40, 88, 4, new String[] { "Water: " + control.water + "/" + control.maxWater + "mB" }); + this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 46, 88, 4, new String[] { "Coolant: " + control.cool + "/" + control.maxCool + "mB" }); - this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 114, 88, 4, new String[] { "Hull Temperature:", " " + Math.round((control.hullHeat) * 0.00001 * 980 + 20) + "°C" }); + + this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 7, guiTop + 16, 18, 18, new String[] { "Reactor Status: " + (control.isOn ? "ON" : "OFF") }); + this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 43, guiTop + 16, 18, 18, new String[] { "Automatic Shutdown: " + (control.auto ? "ENABLED" : "DISABLED") }); + + + if(!control.isLinked) { + this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 79, guiTop + 16, 18, 18, new String[] { "Reactor link not found!" }); + } + + if(control.water < control.maxWater * 0.1) { + this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 79 + 18, guiTop + 16, 18, 18, new String[] { "Water level low!" }); + } + + if(control.cool < control.maxCool * 0.1) { + this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 79 + 18 * 2, guiTop + 16, 18, 18, new String[] { "Coolant level low!" }); + } + + if(control.steam > control.maxSteam * 0.95) { + this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 79 + 18 * 3, guiTop + 16, 18, 18, new String[] { "Steam buffer full!" }); + } + + if(control.coreHeat > (50000 * 0.85)) { + this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 79 + 18 * 4, guiTop + 16, 18, 18, new String[] { "CORE TEMPERATURE CRITICAL!!" }); + } + + String s = ""; + switch(control.compression) { + case 0: s = "Steam"; break; + case 1: s = "Dense Steam"; break; + case 2: s = "Super Dense Steam"; break; + } + this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 52, 88, 4, new String[] { s + ": " + control.steam + "/" + control.maxSteam + "mB" }); + + this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 58, 88, 4, new String[] { "Hull Heat: " + Math.round((control.hullHeat) * 0.00001 * 980 + 20) + "°C" }); + this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 64, 88, 4, new String[] { "Core Heat: " + Math.round((control.coreHeat) * 0.00002 * 980 + 20) + "°C" }); } protected void mouseClicked(int x, int y, int i) { @@ -42,6 +80,18 @@ public class GUIReactorControl extends GuiInfoContainer { mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(control.xCoord, control.yCoord, control.zCoord, control.isOn ? 0 : 1, 0)); } + + if(guiLeft + 43 <= x && guiLeft + 43 + 18 > x && guiTop + 16 < y && guiTop + 16 + 18 >= y) { + + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(control.xCoord, control.yCoord, control.zCoord, control.auto ? 0 : 1, 1)); + } + + if(guiLeft + 63 <= x && guiLeft + 63 + 14 > x && guiTop + 52 < y && guiTop + 52 + 18 >= y) { + + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(control.xCoord, control.yCoord, control.zCoord, (control.compression + 1) % 3, 2)); + } } @Override @@ -128,15 +178,15 @@ public class GUIReactorControl extends GuiInfoContainer { drawTexturedModalRect(guiLeft + 79 + 18 * 2, guiTop + 16, 88 + 18 * 2, 166, 18, 18); } - if(control.steam > control.maxSteam * 0.9) { + if(control.steam > control.maxSteam * 0.95) { drawTexturedModalRect(guiLeft + 79 + 18 * 3, guiTop + 16, 88 + 18 * 3, 166, 18, 18); } - if(control.coreHeat > (50000 * 0.9)) { + if(control.coreHeat > (50000 * 0.85)) { drawTexturedModalRect(guiLeft + 79 + 18 * 4, guiTop + 16, 88 + 18 * 4, 166, 18, 18); } - if(control.rods == control.maxRods) { + if(control.rods == control.maxRods && control.rods != 0) { drawTexturedModalRect(guiLeft + 25, guiTop + 16, 176, 18, 18, 18); } else if(control.rods > 0) { drawTexturedModalRect(guiLeft + 25, guiTop + 16, 194, 18, 18, 18); diff --git a/com/hbm/items/ModItems.java b/com/hbm/items/ModItems.java index e81db3c72..db269c781 100644 --- a/com/hbm/items/ModItems.java +++ b/com/hbm/items/ModItems.java @@ -706,6 +706,7 @@ public class ModItems { public static Item designator_range; public static Item designator_manual; public static Item linker; + public static Item reactor_sensor; public static Item oil_detector; public static Item geiger_counter; public static Item survey_scanner; @@ -2459,6 +2460,7 @@ public class ModItems { remote = new ItemRamManipulator().setUnlocalizedName("remote").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":remote"); chopper = new ItemChopper().setUnlocalizedName("chopper").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":chopper"); linker = new ItemTeleLink().setUnlocalizedName("linker").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":linker"); + reactor_sensor = new ItemReactorSensor().setUnlocalizedName("reactor_sensor").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":reactor_sensor"); oil_detector = new ItemOilDetector().setUnlocalizedName("oil_detector").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":oil_detector"); turret_control = new ItemTurretControl().setUnlocalizedName("turret_control").setFull3D().setMaxStackSize(1).setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":turret_control"); turret_chip = new ItemTurretChip().setUnlocalizedName("turret_chip").setMaxStackSize(1).setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":turret_chip"); @@ -3572,6 +3574,7 @@ public class ModItems { GameRegistry.registerItem(turret_chip, turret_chip.getUnlocalizedName()); GameRegistry.registerItem(turret_biometry, turret_biometry.getUnlocalizedName()); GameRegistry.registerItem(linker, linker.getUnlocalizedName()); + GameRegistry.registerItem(reactor_sensor, reactor_sensor.getUnlocalizedName()); GameRegistry.registerItem(oil_detector, oil_detector.getUnlocalizedName()); GameRegistry.registerItem(survey_scanner, survey_scanner.getUnlocalizedName()); GameRegistry.registerItem(geiger_counter, geiger_counter.getUnlocalizedName()); diff --git a/com/hbm/items/tool/ItemReactorSensor.java b/com/hbm/items/tool/ItemReactorSensor.java new file mode 100644 index 000000000..5c619c14c --- /dev/null +++ b/com/hbm/items/tool/ItemReactorSensor.java @@ -0,0 +1,55 @@ +package com.hbm.items.tool; + +import java.util.List; + +import com.hbm.blocks.ModBlocks; +import com.hbm.tileentity.machine.TileEntityMachineTeleporter; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChatComponentText; +import net.minecraft.world.World; + +public class ItemReactorSensor extends Item { + + @Override + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, + float p_77648_8_, float p_77648_9_, float p_77648_10_) { + + Block b = world.getBlock(x, y, z); + + if (b == ModBlocks.machine_reactor_small || b == ModBlocks.dummy_block_reactor_small + || b == ModBlocks.dummy_port_reactor_small) { + + if (stack.stackTagCompound == null) + stack.stackTagCompound = new NBTTagCompound(); + + stack.stackTagCompound.setInteger("x", x); + stack.stackTagCompound.setInteger("y", y); + stack.stackTagCompound.setInteger("z", z); + + world.playSoundAtEntity(player, "hbm:item.techBoop", 1.0F, 1.0F); + + player.swingItem(); + return true; + + } + + return false; + } + + @Override + public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) { + if (itemstack.stackTagCompound != null) { + list.add("x: " + itemstack.stackTagCompound.getInteger("x")); + list.add("y: " + itemstack.stackTagCompound.getInteger("y")); + list.add("z: " + itemstack.stackTagCompound.getInteger("z")); + } else { + list.add("No reactor selected!"); + } + } +} diff --git a/com/hbm/main/CraftingManager.java b/com/hbm/main/CraftingManager.java index 3fbc339ae..119530e25 100644 --- a/com/hbm/main/CraftingManager.java +++ b/com/hbm/main/CraftingManager.java @@ -798,6 +798,10 @@ public class CraftingManager { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.assembly_iron, 16), new Object[] { " I", "GC", " P", 'I', "ingotIron", 'G', Items.gunpowder, 'C', ModItems.casing_357, 'P', ModItems.primer_357 })); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.assembly_steel, 16), new Object[] { " I", "GC", " P", 'I', "ingotLead", 'G', Items.gunpowder, 'C', ModItems.casing_357, 'P', ModItems.primer_357 })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.assembly_lead, 16), new Object[] { " I", "GC", " P", 'I', ModItems.ingot_u235, 'G', Items.gunpowder, 'C', "paneGlassColorless", 'P', ModItems.primer_357 })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.assembly_lead, 16), new Object[] { " I", "GC", " P", 'I', ModItems.ingot_pu239, 'G', Items.gunpowder, 'C', "paneGlassColorless", 'P', ModItems.primer_357 })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.assembly_lead, 16), new Object[] { " I", "GC", " P", 'I', ModItems.trinitite, 'G', Items.gunpowder, 'C', "paneGlassColorless", 'P', ModItems.primer_357 })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.assembly_lead, 16), new Object[] { " I", "GC", " P", 'I', ModItems.nuclear_waste, 'G', Items.gunpowder, 'C', "paneGlassColorless", 'P', ModItems.primer_357 })); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.assembly_gold, 16), new Object[] { " I", "GC", " P", 'I', "ingotGold", 'G', Items.gunpowder, 'C', ModItems.casing_357, 'P', ModItems.primer_357 })); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.assembly_schrabidium, 16), new Object[] { " I ", "GCN", " P ", 'I', "ingotSchrabidium", 'G', Items.gunpowder, 'C', ModItems.casing_357, 'P', ModItems.primer_357, 'N', Items.nether_star })); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.assembly_nightmare, 16), new Object[] { " I", "GC", " P", 'I', "ingotTungsten", 'G', Items.gunpowder, 'C', ModItems.casing_357, 'P', ModItems.primer_357 })); @@ -811,6 +815,11 @@ public class CraftingManager { GameRegistry.addRecipe(new ItemStack(ModItems.gun_revolver_nightmare2_ammo, 8), new Object[] { "I", "C", "P", 'I', ModItems.powder_power, 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot }); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.assembly_calamity, 8), new Object[] { " I ", "GCG", " P ", 'I', "ingotLead", 'G', Items.gunpowder, 'C', ModItems.casing_50, 'P', ModItems.primer_50 })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.stamp_357, 1), new Object[] { "RSR", "III", " C ", 'R', "dustRedstone", 'S', ModItems.stamp_iron_flat, 'I', ModItems.plate_polymer, 'C', ModItems.casing_357 })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.stamp_44, 1), new Object[] { "RSR", "III", " C ", 'R', "dustRedstone", 'S', ModItems.stamp_iron_flat, 'I', ModItems.plate_polymer, 'C', ModItems.casing_44 })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.stamp_9, 1), new Object[] { "RSR", "III", " C ", 'R', "dustRedstone", 'S', ModItems.stamp_iron_flat, 'I', ModItems.plate_polymer, 'C', ModItems.casing_9 })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.stamp_50, 1), new Object[] { "RSR", "III", " C ", 'R', "dustRedstone", 'S', ModItems.stamp_iron_flat, 'I', ModItems.plate_polymer, 'C', ModItems.casing_50 })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.casing_357, 1), new Object[] { " P ", " ", "P P", 'P', "plateCopper" })); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.casing_44, 1), new Object[] { "P", " ", "P", 'P', "plateCopper" })); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.casing_9, 1), new Object[] { "P", "P", 'P', "plateCopper" })); @@ -1376,6 +1385,8 @@ public class CraftingManager { //GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gun_calamity_ammo, 8), new Object[] { "S", "C", "G", 'S', "plateSteel", 'C', "plateCopper", 'G', Items.gunpowder })); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.analyzer, 1), new Object[] { " S ", "SGS", " S ", 'S', "plateSteel", 'G', "paneGlassColorless" })); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.custom_fall, 1), new Object[] { "IIP", "CHW", "IIP", 'I', ModItems.plate_polymer, 'P', "plateSaturnite", 'C', ModItems.circuit_red_copper, 'H', ModItems.hull_small_steel, 'W', ModItems.coil_copper })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.reactor_sensor, 1), new Object[] { "WPW", "CMC", "PPP", 'W', ModItems.wire_tungsten, 'P', "plateLead", 'C', ModItems.circuit_targeting_tier3, 'M', ModItems.magnetron })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.machine_controller, 1), new Object[] { "PGP", "ICI", "PRP", 'P', "plateDesh", 'G', "paneGlass", 'I', "ingotPolymer", 'R', "blockRedstone", 'C', ModItems.circuit_targeting_tier4 })); GameRegistry.addShapelessRecipe(new ItemStack(Items.paper, 1), new Object[] { new ItemStack(ModItems.assembly_template, 1, OreDictionary.WILDCARD_VALUE) }); GameRegistry.addShapelessRecipe(new ItemStack(Items.paper, 1), new Object[] { new ItemStack(ModItems.chemistry_template, 1, OreDictionary.WILDCARD_VALUE) }); diff --git a/com/hbm/packet/AuxButtonPacket.java b/com/hbm/packet/AuxButtonPacket.java index ae66cc8ee..d7cc27ecb 100644 --- a/com/hbm/packet/AuxButtonPacket.java +++ b/com/hbm/packet/AuxButtonPacket.java @@ -124,13 +124,33 @@ public class AuxButtonPacket implements IMessage { if (te instanceof TileEntityReactorControl) { TileEntityReactorControl control = (TileEntityReactorControl)te; + if(m.id == 1) + control.auto = m.value == 1; + TileEntity reac = p.worldObj.getTileEntity(control.linkX, control.linkY, control.linkZ); if (reac instanceof TileEntityMachineReactorSmall) { TileEntityMachineReactorSmall reactor = (TileEntityMachineReactorSmall)reac; - + if(m.id == 0) reactor.retracting = m.value == 0; + + if(m.id == 2) { + FluidType type = FluidType.STEAM; + int fill = reactor.tanks[2].getFill(); + + switch(m.value) { + case 0: type = FluidType.STEAM; fill = (int)Math.floor(fill * 100); break; + case 1: type = FluidType.HOTSTEAM; fill = (int)Math.floor(fill / 10D); break; + case 2: type = FluidType.SUPERHOTSTEAM; fill = (int)Math.floor(fill / 10D); break; + } + + if(fill > reactor.tanks[2].getMaxFill()) + fill = reactor.tanks[2].getMaxFill(); + + reactor.tanks[2].setTankType(type); + reactor.tanks[2].setFill(fill); + } } } diff --git a/com/hbm/tileentity/machine/TileEntityMachineTurbine.java b/com/hbm/tileentity/machine/TileEntityMachineTurbine.java index 60180c582..7a801474e 100644 --- a/com/hbm/tileentity/machine/TileEntityMachineTurbine.java +++ b/com/hbm/tileentity/machine/TileEntityMachineTurbine.java @@ -45,8 +45,8 @@ public class TileEntityMachineTurbine extends TileEntity implements ISidedInvent public TileEntityMachineTurbine() { slots = new ItemStack[7]; tanks = new FluidTank[2]; - tanks[0] = new FluidTank(FluidType.STEAM, 16000, 0); - tanks[1] = new FluidTank(FluidType.WATER, 32000, 1); + tanks[0] = new FluidTank(FluidType.STEAM, 64000, 0); + tanks[1] = new FluidTank(FluidType.WATER, 128000, 1); } @Override @@ -219,15 +219,13 @@ public class TileEntityMachineTurbine extends TileEntity implements ISidedInvent if(!worldObj.isRemote) { age++; - if(age >= 10) + if(age >= 2) { age = 0; } - if(age == 4 || age == 9) { - fillFluidInit(tanks[1].getTankType()); - ffgeuaInit(); - } + fillFluidInit(tanks[1].getTankType()); + ffgeuaInit(); tanks[0].setType(0, 1, slots); tanks[0].loadTank(2, 3, slots); @@ -239,7 +237,7 @@ public class TileEntityMachineTurbine extends TileEntity implements ISidedInvent } else { tanks[1].setTankType((FluidType) outs[0]); - for(int i = 0; i < tanks[0].getFill() / 1000 + 1; i++) { + for(int i = 0; i < 1200; i++) { if(tanks[0].getFill() >= (Integer)outs[2] && tanks[1].getFill() + (Integer)outs[1] <= tanks[1].getMaxFill()) { tanks[0].setFill(tanks[0].getFill() - (Integer)outs[2]); tanks[1].setFill(tanks[1].getFill() + (Integer)outs[1]); @@ -248,6 +246,8 @@ public class TileEntityMachineTurbine extends TileEntity implements ISidedInvent if(power > maxPower) power = maxPower; + } else { + break; } } } @@ -295,7 +295,7 @@ public class TileEntityMachineTurbine extends TileEntity implements ISidedInvent @Override public boolean getTact() { - if(age >= 0 && age < 5) + if(age == 0) { return true; } diff --git a/com/hbm/tileentity/machine/TileEntityReactorControl.java b/com/hbm/tileentity/machine/TileEntityReactorControl.java index a46fd86d8..23c5f77d4 100644 --- a/com/hbm/tileentity/machine/TileEntityReactorControl.java +++ b/com/hbm/tileentity/machine/TileEntityReactorControl.java @@ -7,6 +7,7 @@ import com.hbm.packet.PacketDispatcher; import com.hbm.packet.TEControlPacket; import net.minecraft.block.Block; +import net.minecraft.block.BlockRedstoneComparator; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.inventory.ISidedInventory; @@ -126,6 +127,8 @@ public class TileEntityReactorControl extends TileEntity implements ISidedInvent super.readFromNBT(nbt); NBTTagList list = nbt.getTagList("items", 10); + redstoned = nbt.getBoolean("red"); + slots = new ItemStack[getSizeInventory()]; for(int i = 0; i < list.tagCount(); i++) @@ -144,6 +147,8 @@ public class TileEntityReactorControl extends TileEntity implements ISidedInvent super.writeToNBT(nbt); NBTTagList list = new NBTTagList(); + nbt.setBoolean("red", redstoned); + for(int i = 0; i < slots.length; i++) { if(slots[i] != null) @@ -192,13 +197,14 @@ public class TileEntityReactorControl extends TileEntity implements ISidedInvent public boolean isOn; public boolean auto; public boolean isLinked; + public boolean redstoned; @Override public void updateEntity() { if(!worldObj.isRemote) { - if(slots[0] != null && slots[0].getItem() == ModItems.detonator && + if(slots[0] != null && slots[0].getItem() == ModItems.reactor_sensor && slots[0].stackTagCompound != null) { int xCoord = slots[0].stackTagCompound.getInteger("x"); @@ -248,6 +254,21 @@ public class TileEntityReactorControl extends TileEntity implements ISidedInvent compression = 0; break; } + if(!redstoned) { + if(worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) { + redstoned = true; + reactor.retracting = !reactor.retracting; + } + } else { + if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) { + redstoned = false; + } + } + + if(auto && (water < 100 || cool < 100 || coreHeat > (50000 * 0.95)) && fuel > 0) { + reactor.retracting = true; + } + } else { hullHeat = 0; coreHeat = 0; @@ -264,6 +285,19 @@ public class TileEntityReactorControl extends TileEntity implements ISidedInvent compression = 0; isLinked = false; } + + if(worldObj.getBlock(xCoord, yCoord, zCoord + 1) instanceof BlockRedstoneComparator) { + worldObj.scheduleBlockUpdate(xCoord, yCoord, zCoord + 1, worldObj.getBlock(xCoord, yCoord, zCoord + 1), 1); + } + if(worldObj.getBlock(xCoord, yCoord, zCoord - 1) instanceof BlockRedstoneComparator) { + worldObj.scheduleBlockUpdate(xCoord, yCoord, zCoord - 1, worldObj.getBlock(xCoord, yCoord, zCoord - 1), 1); + } + if(worldObj.getBlock(xCoord + 1, yCoord, zCoord) instanceof BlockRedstoneComparator) { + worldObj.scheduleBlockUpdate(xCoord + 1, yCoord, zCoord, worldObj.getBlock(xCoord + 1, yCoord, zCoord), 1); + } + if(worldObj.getBlock(xCoord - 1, yCoord, zCoord) instanceof BlockRedstoneComparator) { + worldObj.scheduleBlockUpdate(xCoord - 1, yCoord, zCoord, worldObj.getBlock(xCoord - 1, yCoord, zCoord), 1); + } PacketDispatcher.wrapper.sendToAll(new TEControlPacket(xCoord, yCoord, zCoord, hullHeat, coreHeat, fuel, water, cool, steam, maxWater, maxCool, maxSteam, compression, rods, maxRods, isOn, auto, isLinked)); }