diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index ce6f41570..08cc45eb9 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -1186,7 +1186,6 @@ public class ModBlocks { public static Block dummy_port_reactor_small; public static Block dummy_block_vault; public static Block dummy_block_blast; - public static Block dummy_block_gascent; public static Block dummy_block_uf6; public static Block dummy_block_puf6; public static Block dummy_plate_compact_launcher; @@ -1702,7 +1701,7 @@ public class ModBlocks { machine_difurnace_rtg_on = new MachineDiFurnaceRTG(true).setBlockName("machine_difurnace_rtg_on").setHardness(5.0F).setResistance(10.0F).setLightLevel(2.0F).setCreativeTab(null); machine_centrifuge = new MachineCentrifuge(Material.iron).setBlockName("machine_centrifuge").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); - machine_gascent = new MachineGasCent(Material.iron).setBlockName("machine_gascent").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); + machine_gascent = new MachineGasCent(Material.iron).setBlockName("machine_gascent").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); machine_fel = new MachineFEL(Material.iron).setBlockName("machine_fel").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); machine_silex = new MachineSILEX(Material.iron).setBlockName("machine_silex").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); machine_crystallizer = new MachineCrystallizer(Material.iron).setBlockName("machine_crystallizer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_crystallizer"); @@ -2189,7 +2188,6 @@ public class ModBlocks { dummy_port_reactor_small = new DummyBlockMachine(Material.iron, guiID_reactor_small, machine_reactor_small, false).setBlockName("dummy_port_reactor_small").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel"); dummy_block_vault = new DummyBlockVault(Material.iron).setBlockName("dummy_block_vault").setHardness(10.0F).setResistance(10000.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel"); dummy_block_blast = new DummyBlockBlast(Material.iron).setBlockName("dummy_block_blast").setHardness(10.0F).setResistance(10000.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel"); - dummy_block_gascent = new DummyBlockMachine(Material.iron, guiID_gascent, machine_gascent, false).setBlockName("dummy_block_gascent").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel"); dummy_block_uf6 = new DummyBlockMachine(Material.iron, guiID_uf6_tank, machine_uf6_tank, false).setBlockName("dummy_block_uf6").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_titanium"); dummy_block_puf6 = new DummyBlockMachine(Material.iron, guiID_puf6_tank, machine_puf6_tank, false).setBlockName("dummy_block_puf6").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel"); dummy_plate_compact_launcher = new DummyBlockMachine(Material.iron, guiID_compact_launcher, compact_launcher, false).setBounds(0, 16, 0, 16, 16, 16).setBlockName("dummy_plate_compact_launcher").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel"); @@ -3153,7 +3151,6 @@ public class ModBlocks { GameRegistry.registerBlock(dummy_port_reactor_small, dummy_port_reactor_small.getUnlocalizedName()); GameRegistry.registerBlock(dummy_block_vault, dummy_block_vault.getUnlocalizedName()); GameRegistry.registerBlock(dummy_block_blast, dummy_block_blast.getUnlocalizedName()); - GameRegistry.registerBlock(dummy_block_gascent, dummy_block_gascent.getUnlocalizedName()); GameRegistry.registerBlock(dummy_block_uf6, dummy_block_uf6.getUnlocalizedName()); GameRegistry.registerBlock(dummy_block_puf6, dummy_block_puf6.getUnlocalizedName()); GameRegistry.registerBlock(dummy_plate_compact_launcher, dummy_plate_compact_launcher.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/blocks/gas/BlockGasMeltdown.java b/src/main/java/com/hbm/blocks/gas/BlockGasMeltdown.java index 0298a5780..1525d379a 100644 --- a/src/main/java/com/hbm/blocks/gas/BlockGasMeltdown.java +++ b/src/main/java/com/hbm/blocks/gas/BlockGasMeltdown.java @@ -15,7 +15,6 @@ import com.hbm.util.ContaminationUtil.HazardType; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -79,10 +78,12 @@ public class BlockGasMeltdown extends BlockGasBase { if(rand.nextInt(7) == 0 && world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) == Blocks.air) { world.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, ModBlocks.gas_radon_dense); } - - ChunkRadiationManager.proxy.incrementRad(world, x, y, z, 5); - - if(rand.nextInt(450) == 0) { + + if (world.canBlockSeeTheSky(x, y, z)) { + ChunkRadiationManager.proxy.incrementRad(world, x, y, z, 5); + } + + if(rand.nextInt(400) == 0) { world.setBlockToAir(x, y, z); return; } diff --git a/src/main/java/com/hbm/blocks/machine/MachineGasCent.java b/src/main/java/com/hbm/blocks/machine/MachineGasCent.java index 806f0abc6..8ea3ad35c 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineGasCent.java +++ b/src/main/java/com/hbm/blocks/machine/MachineGasCent.java @@ -2,11 +2,14 @@ package com.hbm.blocks.machine; import java.util.Random; +import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ModBlocks; import com.hbm.handler.MultiblockHandler; +import com.hbm.handler.MultiblockHandlerXR; import com.hbm.interfaces.IMultiblock; import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; +import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntityMachineGasCent; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; @@ -25,127 +28,24 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; -public class MachineGasCent extends BlockContainer implements IMultiblock { - - private final Random field_149933_a = new Random(); - private static boolean keepInventory; +public class MachineGasCent extends BlockDummyable implements IMultiblock { - public MachineGasCent(Material p_i45386_1_) { - super(p_i45386_1_); - } - - @Override - public int getRenderType(){ - return -1; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public boolean renderAsNormalBlock() { - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconregister) { - this.blockIcon = iconregister.registerIcon(RefStrings.MODID + ":machine_gascent"); + public MachineGasCent(Material mat) { + super(mat); } @Override - public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { - return new TileEntityMachineGasCent(); + public TileEntity createNewTileEntity(World world, int meta) { + + if(meta >= 12) + return new TileEntityMachineGasCent(); + if(meta >= 6) + return new TileEntityProxyCombo(false, true, true); + + return null; } - - @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { - return Item.getItemFromBlock(ModBlocks.machine_gascent); - } - - @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(MultiblockHandler.checkSpace(world, x, y, z, MultiblockHandler.centDimension)) { - MultiblockHandler.fillUp(world, x, y, z, MultiblockHandler.centDimension, ModBlocks.dummy_block_gascent); - - } else - world.func_147480_a(x, y, z, true); - } - - @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) - { - TileEntityMachineGasCent tileentityfurnace = (TileEntityMachineGasCent)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) { @@ -154,14 +54,29 @@ public class MachineGasCent extends BlockContainer implements IMultiblock { return true; } else if(!player.isSneaking()) { - TileEntityMachineGasCent entity = (TileEntityMachineGasCent) world.getTileEntity(x, y, z); - if(entity != null) - { - FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_gascent, world, x, y, z); - } + int[] pos = this.findCore(world, x, y, z); + + if(pos == null) + return false; + + FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_gascent, world, pos[0], pos[1], pos[2]); return true; } else { return false; } } + + @Override + public int[] getDimensions() { + return new int[] {2, 0, 0, 0, 0, 0,}; + } + + @Override + public int getOffset() { + return 0; + } + + protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { + super.fillSpace(world, x, y, z, dir, o); + } } diff --git a/src/main/java/com/hbm/crafting/MineralRecipes.java b/src/main/java/com/hbm/crafting/MineralRecipes.java index 88009f6ba..2fa962c2b 100644 --- a/src/main/java/com/hbm/crafting/MineralRecipes.java +++ b/src/main/java/com/hbm/crafting/MineralRecipes.java @@ -118,9 +118,8 @@ public class MineralRecipes { GameRegistry.addShapelessRecipe(new ItemStack(ModItems.billet_thorium_fuel, 3), new Object[] { ModItems.billet_th232, ModItems.billet_th232, ModItems.billet_u233 }); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_thorium_fuel, 1), new Object[] { "nuggetThorium232", "nuggetThorium232", "nuggetThorium232", "nuggetThorium232", "nuggetUranium233", "nuggetUranium233" })); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_thorium_fuel, 1), new Object[] { "tinyTh232", "tinyTh232", "tinyTh232", "tinyTh232", "tinyU233", "tinyU233" })); - GameRegistry.addShapelessRecipe(new ItemStack(ModItems.billet_uranium_fuel, 3), new Object[] { ModItems.billet_u238, ModItems.billet_u238, ModItems.billet_u235 }); - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_uranium_fuel, 1), new Object[] { "nuggetUranium238", "nuggetUranium238", "nuggetUranium238", "nuggetUranium238", "nuggetUranium235", "nuggetUranium235" })); - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_uranium_fuel, 1), new Object[] { "tinyU238", "tinyU238", "tinyU238", "tinyU238", "tinyU235", "tinyU235" })); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_uranium_fuel, 1), new Object[] { "nuggetUranium238", "nuggetUranium238", "nuggetUranium238", "nuggetUranium238", "nuggetUranium238", "nuggetUranium235" })); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_uranium_fuel, 1), new Object[] { "tinyU238", "tinyU238", "tinyU238", "tinyU238", "tinyU238", "tinyU235" })); GameRegistry.addShapelessRecipe(new ItemStack(ModItems.billet_plutonium_fuel, 3), new Object[] { ModItems.billet_u238, ModItems.billet_pu_mix, ModItems.billet_pu_mix }); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_plutonium_fuel, 1), new Object[] { ModItems.nugget_pu_mix, ModItems.nugget_pu_mix, ModItems.nugget_pu_mix, ModItems.nugget_pu_mix, "nuggetUranium238", "nuggetUranium238" })); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_plutonium_fuel, 1), new Object[] { ModItems.nugget_pu_mix, ModItems.nugget_pu_mix, ModItems.nugget_pu_mix, ModItems.nugget_pu_mix, "tinyU238", "tinyU238" })); @@ -136,9 +135,8 @@ public class MineralRecipes { GameRegistry.addShapelessRecipe(new ItemStack(ModItems.billet_neptunium_fuel, 3), new Object[] { ModItems.billet_u238, ModItems.billet_u238, ModItems.billet_neptunium }); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_neptunium_fuel, 1), new Object[] { "nuggetNeptunium237", "nuggetNeptunium237", "nuggetUranium238", "nuggetUranium238", "nuggetUranium238", "nuggetUranium238" })); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_neptunium_fuel, 1), new Object[] { "tinyNp237", "tinyNp237", "tinyU238", "tinyU238", "tinyU238", "tinyU238" })); - GameRegistry.addShapelessRecipe(new ItemStack(ModItems.billet_mox_fuel, 3), new Object[] { ModItems.billet_u238, ModItems.billet_u235, ModItems.billet_pu_mix }); - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_mox_fuel, 1), new Object[] { ModItems.nugget_pu_mix, ModItems.nugget_pu_mix, "nuggetUranium238", "nuggetUranium238", "nuggetUranium235", "nuggetUranium235" })); - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_mox_fuel, 1), new Object[] { ModItems.nugget_pu_mix, ModItems.nugget_pu_mix, "tinyU238", "tinyU238", "tinyU235", "tinyU235" })); + GameRegistry.addShapelessRecipe(new ItemStack(ModItems.billet_mox_fuel, 3), new Object[] { ModItems.billet_uranium_fuel, ModItems.billet_uranium_fuel, ModItems.billet_pu_mix }); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_mox_fuel, 1), new Object[] { ModItems.nugget_pu_mix, ModItems.nugget_pu_mix, ModItems.nugget_uranium_fuel, ModItems.nugget_uranium_fuel, ModItems.nugget_uranium_fuel, ModItems.nugget_uranium_fuel })); GameRegistry.addShapelessRecipe(new ItemStack(ModItems.billet_schrabidium_fuel, 3), new Object[] { ModItems.billet_schrabidium, ModItems.billet_neptunium, ModItems.billet_beryllium }); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_schrabidium_fuel, 1), new Object[] { ModItems.nugget_schrabidium, ModItems.nugget_schrabidium, "nuggetNeptunium237", "nuggetNeptunium237", ModItems.nugget_beryllium, ModItems.nugget_beryllium })); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_schrabidium_fuel, 1), new Object[] { ModItems.nugget_schrabidium, ModItems.nugget_schrabidium, "tinyNp237", "tinyNp237", ModItems.nugget_beryllium, ModItems.nugget_beryllium })); @@ -150,9 +148,9 @@ public class MineralRecipes { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_zfb_pu241, 1), new Object[] { "nuggetZirconium", "nuggetZirconium", "nuggetZirconium", "nuggetUranium235", "nuggetPlutonium240", "nuggetPlutonium241" })); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_zfb_am_mix, 1), new Object[] { "nuggetZirconium", "nuggetZirconium", "nuggetZirconium", "nuggetPlutonium241", "nuggetPlutonium241", "nuggetAmericiumRG" })); - GameRegistry.addShapelessRecipe(new ItemStack(ModItems.billet_uranium, 9), new Object[] { ModItems.billet_u235, ModItems.billet_u238, ModItems.billet_u238, ModItems.billet_u238, ModItems.billet_u238, ModItems.billet_u238, ModItems.billet_u238, ModItems.billet_u238, ModItems.billet_u238 }); - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.ingot_uranium, 1), new Object[] { "nuggetUranium235", "nuggetUranium238", "nuggetUranium238", "nuggetUranium238", "nuggetUranium238", "nuggetUranium238", "nuggetUranium238", "nuggetUranium238", "nuggetUranium238" })); - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.ingot_uranium, 1), new Object[] { "tinyU235", "tinyU238", "tinyU238", "tinyU238", "tinyU238", "tinyU238", "tinyU238", "tinyU238", "tinyU238" })); + GameRegistry.addShapelessRecipe(new ItemStack(ModItems.billet_uranium, 2), new Object[] { ModItems.billet_uranium_fuel, ModItems.billet_u238 }); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_uranium, 2), new Object[] { ModItems.billet_u238, "nuggetUranium238", "nuggetUranium238", "nuggetUranium238", "nuggetUranium238", "nuggetUranium238", "nuggetUranium235" })); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_uranium, 2), new Object[] { ModItems.billet_u238, "tinyU238", "tinyU238", "tinyU238", "tinyU238", "tinyU238", "tinyU235" })); /*addBilletToIngot(ModItems.ingot_uranium, ModItems.billet_uranium); addBilletToIngot(ModItems.ingot_u233, ModItems.billet_u233); diff --git a/src/main/java/com/hbm/entity/mob/EntityFBI.java b/src/main/java/com/hbm/entity/mob/EntityFBI.java index 9da94ca51..f38bb9a14 100644 --- a/src/main/java/com/hbm/entity/mob/EntityFBI.java +++ b/src/main/java/com/hbm/entity/mob/EntityFBI.java @@ -160,7 +160,6 @@ public class EntityFBI extends EntityMob implements IRangedAttackMob { canDestroy.add(ModBlocks.dummy_block_assembler); canDestroy.add(ModBlocks.dummy_block_chemplant); canDestroy.add(ModBlocks.dummy_block_centrifuge); - canDestroy.add(ModBlocks.dummy_block_gascent); canDestroy.add(ModBlocks.machine_crystallizer); canDestroy.add(ModBlocks.dummy_block_reactor_small); canDestroy.add(ModBlocks.dummy_port_reactor_small); diff --git a/src/main/java/com/hbm/handler/nei/GasCentrifugeRecipeHandler.java b/src/main/java/com/hbm/handler/nei/GasCentrifugeRecipeHandler.java index 1c4de7fc3..da94c5b43 100644 --- a/src/main/java/com/hbm/handler/nei/GasCentrifugeRecipeHandler.java +++ b/src/main/java/com/hbm/handler/nei/GasCentrifugeRecipeHandler.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.Map; import com.hbm.inventory.gui.GUIMachineGasCent; +import com.hbm.inventory.recipes.GasCentrifugeRecipes; import com.hbm.inventory.recipes.MachineRecipes; import codechicken.nei.NEIServerUtils; @@ -25,15 +26,14 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler { PositionedStack result1; PositionedStack result2; PositionedStack result3; - PositionedStack result4; + - public SmeltingSet(ItemStack input, ItemStack result1, ItemStack result2, ItemStack result3, ItemStack result4) { + public SmeltingSet(ItemStack input, ItemStack result1, ItemStack result2, ItemStack result3) { input.stackSize = 1; - this.input = new PositionedStack(input, 48, 24); - this.result1 = new PositionedStack(result1, 129, 6); - this.result2 = new PositionedStack(result2, 147, 6); - this.result3 = new PositionedStack(result3, 129, 42); - this.result4 = new PositionedStack(result4, 147, 42); + this.input = new PositionedStack(input, 25, 35 - 11); + this.result1 = new PositionedStack(result1, 128, 26 - 11); + this.result2 = new PositionedStack(result2, 128, 44 - 11); + this.result3 = new PositionedStack(result3, 146, 35 - 11); } @Override @@ -47,7 +47,6 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler { stacks.add(fuels.get((cycleticks / 48) % fuels.size()).stack); stacks.add(result2); stacks.add(result3); - stacks.add(result4); return stacks; } @@ -96,9 +95,9 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler { @Override public void loadCraftingRecipes(String outputId, Object... results) { if ((outputId.equals("gascentprocessing")) && getClass() == GasCentrifugeRecipeHandler.class) { - Map recipes = MachineRecipes.instance().getGasCentrifugeRecipes(); + Map recipes = GasCentrifugeRecipes.getGasCentrifugeRecipes(); for (Map.Entry recipe : recipes.entrySet()) { - this.arecipes.add(new SmeltingSet((ItemStack)recipe.getKey(), (ItemStack)recipe.getValue()[0], (ItemStack)recipe.getValue()[1], (ItemStack)recipe.getValue()[2], (ItemStack)recipe.getValue()[3])); + this.arecipes.add(new SmeltingSet((ItemStack)recipe.getKey(), (ItemStack)recipe.getValue()[0], (ItemStack)recipe.getValue()[1], (ItemStack)recipe.getValue()[2])); } } else { super.loadCraftingRecipes(outputId, results); @@ -107,10 +106,10 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler { @Override public void loadCraftingRecipes(ItemStack result) { - Map recipes = MachineRecipes.instance().getGasCentrifugeRecipes(); + Map recipes = GasCentrifugeRecipes.getGasCentrifugeRecipes(); for (Map.Entry recipe : recipes.entrySet()) { - if (NEIServerUtils.areStacksSameType((ItemStack)recipe.getValue()[0], result) || NEIServerUtils.areStacksSameType((ItemStack)recipe.getValue()[1], result) || NEIServerUtils.areStacksSameType((ItemStack)recipe.getValue()[2], result) || NEIServerUtils.areStacksSameType((ItemStack)recipe.getValue()[3], result)) - this.arecipes.add(new SmeltingSet((ItemStack)recipe.getKey(), (ItemStack)recipe.getValue()[0], (ItemStack)recipe.getValue()[1], (ItemStack)recipe.getValue()[2], (ItemStack)recipe.getValue()[3])); + if (NEIServerUtils.areStacksSameType((ItemStack)recipe.getValue()[0], result) || NEIServerUtils.areStacksSameType((ItemStack)recipe.getValue()[1], result) || NEIServerUtils.areStacksSameType((ItemStack)recipe.getValue()[2], result)) + this.arecipes.add(new SmeltingSet((ItemStack)recipe.getKey(), (ItemStack)recipe.getValue()[0], (ItemStack)recipe.getValue()[1], (ItemStack)recipe.getValue()[2])); } } @@ -125,10 +124,10 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler { @Override public void loadUsageRecipes(ItemStack ingredient) { - Map recipes = MachineRecipes.instance().getGasCentrifugeRecipes(); + Map recipes = GasCentrifugeRecipes.getGasCentrifugeRecipes(); for (Map.Entry recipe : recipes.entrySet()) { if (compareFluidStacks(ingredient, (ItemStack)recipe.getKey())) - this.arecipes.add(new SmeltingSet((ItemStack)recipe.getKey(), (ItemStack)recipe.getValue()[0], (ItemStack)recipe.getValue()[1], (ItemStack)recipe.getValue()[2], (ItemStack)recipe.getValue()[3])); + this.arecipes.add(new SmeltingSet((ItemStack)recipe.getKey(), (ItemStack)recipe.getValue()[0], (ItemStack)recipe.getValue()[1], (ItemStack)recipe.getValue()[2])); } } @@ -139,11 +138,11 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler { @Override public void drawExtras(int recipe) { drawProgressBar(3, 51 - 45, 176, 0, 16, 34, 480, 7); - drawProgressBar(93, 19, 192, -1, 6, 33, 200, 3); + drawProgressBar(69, 26, 208, 0, 33, 12, 200, 0); } @Override public void loadTransferRects() { - transferRects.add(new RecipeTransferRect(new Rectangle(56 * 2, 5 + 18, 54, 18), "gascentprocessing")); + transferRects.add(new RecipeTransferRect(new Rectangle(69, 26, 32, 12), "gascentprocessing")); } } diff --git a/src/main/java/com/hbm/inventory/container/ContainerMachineGasCent.java b/src/main/java/com/hbm/inventory/container/ContainerMachineGasCent.java index 15890b445..d6cd0f928 100644 --- a/src/main/java/com/hbm/inventory/container/ContainerMachineGasCent.java +++ b/src/main/java/com/hbm/inventory/container/ContainerMachineGasCent.java @@ -12,25 +12,22 @@ import net.minecraft.item.ItemStack; public class ContainerMachineGasCent extends Container { - private TileEntityMachineGasCent diFurnace; + private TileEntityMachineGasCent gasCent; public ContainerMachineGasCent(InventoryPlayer invPlayer, TileEntityMachineGasCent tedf) { - diFurnace = tedf; + gasCent = tedf; //Battery this.addSlotToContainer(new Slot(tedf, 0, 8, 53)); //Fluid ID IO - this.addSlotToContainer(new Slot(tedf, 1, 35, 17)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 2, 35, 53)); - //Fluid IO - this.addSlotToContainer(new Slot(tedf, 3, 71, 17)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 4, 71, 53)); + this.addSlotToContainer(new Slot(tedf, 1, 30, 35)); //Output - this.addSlotToContainer(new SlotMachineOutput(tedf, 5, 134, 17)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 6, 152, 17)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 7, 134, 53)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 8, 152, 53)); + this.addSlotToContainer(new SlotMachineOutput(tedf, 2, 133, 26)); + this.addSlotToContainer(new SlotMachineOutput(tedf, 3, 133, 44)); + this.addSlotToContainer(new SlotMachineOutput(tedf, 4, 151, 35)); + //upgrade + this.addSlotToContainer(new Slot(tedf, 5, 82, 19)); for(int i = 0; i < 3; i++) { @@ -52,35 +49,35 @@ public class ContainerMachineGasCent extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) + public ItemStack transferStackInSlot(EntityPlayer player, int index) { ItemStack var3 = null; - Slot var4 = (Slot) this.inventorySlots.get(par2); + Slot slot = (Slot) this.inventorySlots.get(index); - if (var4 != null && var4.getHasStack()) + if (slot != null && slot.getHasStack()) { - ItemStack var5 = var4.getStack(); - var3 = var5.copy(); + ItemStack stack = slot.getStack(); + var3 = stack.copy(); - if (par2 <= 8) { - if (!this.mergeItemStack(var5, 9, this.inventorySlots.size(), true)) + if (index <= 5) { + if (!this.mergeItemStack(stack, 6, this.inventorySlots.size(), true)) { return null; } } - else if (!this.mergeItemStack(var5, 0, 2, false)) + else if (!this.mergeItemStack(stack, 0, 2, false)) { - if (!this.mergeItemStack(var5, 3, 4, false)) + if (!this.mergeItemStack(stack, 3, 4, false)) return null; } - if (var5.stackSize == 0) + if (stack.stackSize == 0) { - var4.putStack((ItemStack) null); + slot.putStack((ItemStack) null); } else { - var4.onSlotChanged(); + slot.onSlotChanged(); } } @@ -89,6 +86,6 @@ public class ContainerMachineGasCent extends Container { @Override public boolean canInteractWith(EntityPlayer player) { - return diFurnace.isUseableByPlayer(player); + return gasCent.isUseableByPlayer(player); } } diff --git a/src/main/java/com/hbm/inventory/gui/GUIMachineGasCent.java b/src/main/java/com/hbm/inventory/gui/GUIMachineGasCent.java index 536600987..94ad38dc8 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIMachineGasCent.java +++ b/src/main/java/com/hbm/inventory/gui/GUIMachineGasCent.java @@ -15,11 +15,11 @@ import net.minecraft.util.ResourceLocation; public class GUIMachineGasCent extends GuiInfoContainer { public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/centrifuge_gas.png"); - private TileEntityMachineGasCent diFurnace; + private TileEntityMachineGasCent gasCent; public GUIMachineGasCent(InventoryPlayer invPlayer, TileEntityMachineGasCent tedf) { super(new ContainerMachineGasCent(invPlayer, tedf)); - diFurnace = tedf; + gasCent = tedf; this.xSize = 176; this.ySize = 168; @@ -28,17 +28,21 @@ public class GUIMachineGasCent extends GuiInfoContainer { @Override public void drawScreen(int mouseX, int mouseY, float f) { super.drawScreen(mouseX, mouseY, f); - - diFurnace.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 53, guiTop + 69 - 52, 16, 52); - this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 98, guiTop + 30, 6, 32, mouseX, mouseY, new String[] {String.valueOf((int)((double)diFurnace.progress / (double)diFurnace.processingSpeed * 100D)) + "%"}); + this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 58, guiTop + 30, 8, 33, mouseX, mouseY, new String[] {gasCent.inputTank.getTankType().getName(), gasCent.inputTank.getFill() + " / " + gasCent.inputTank.getMaxFill() + " mB"}); + this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 114, guiTop + 30, 8, 33, mouseX, mouseY, new String[] {gasCent.outputTank.getTankType().getName(), gasCent.outputTank.getFill() + " / " + gasCent.outputTank.getMaxFill() + " mB"}); - this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 51 - 34, 16, 34, diFurnace.power, diFurnace.maxPower); + this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 51 - 34, 16, 34, gasCent.power, gasCent.maxPower); + + String[] info = new String[] { "Uranium enrichment requires cascades.", "Two-centrifuge cascades will give you", "uranium fuel, four-centrifuge cascades", "will give you total separation."}; + this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 16, 16, 16, guiLeft - 8, guiTop + 16 + 16, info); + String[] info2 = new String[] { "A centrifuge overclocking upgrade is", "required for total isotopic separation."}; + this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 32, 16, 16, guiLeft - 8, guiTop + 32 + 16, info2); } @Override protected void drawGuiContainerForegroundLayer(int i, int j) { - String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName()); + String name = this.gasCent.hasCustomInventoryName() ? this.gasCent.getInventoryName() : I18n.format(this.gasCent.getInventoryName()); this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); @@ -50,13 +54,35 @@ public class GUIMachineGasCent extends GuiInfoContainer { Minecraft.getMinecraft().getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); - int i = (int)diFurnace.getPowerRemainingScaled(34); + int i = (int)gasCent.getPowerRemainingScaled(34); drawTexturedModalRect(guiLeft + 8, guiTop + 51 - i, 176, 34 - i, 16, i); - int j = (int)diFurnace.getCentrifugeProgressScaled(33); - drawTexturedModalRect(guiLeft + 98, guiTop + 63 - j, 192, 32 - j, 6, j); + int j = (int)gasCent.getCentrifugeProgressScaled(33); + drawTexturedModalRect(guiLeft + 74, guiTop + 37, 208, 0, j, 12); - Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tank.getSheet()); - diFurnace.tank.renderTank(this, guiLeft + 53, guiTop + 69, diFurnace.tank.getTankType().textureX() * FluidTank.x, diFurnace.tank.getTankType().textureY() * FluidTank.y, 16, 52); + int a = gasCent.getTankScaled(32, 0); + switch (gasCent.inputTank.getTankType()) { + case PF6: + drawTexturedModalRect(guiLeft + 58, guiTop + 62 - a, 200, 31 - a, 8, a); + break; + case NONE: + break; + default: + drawTexturedModalRect(guiLeft + 58, guiTop + 62 - a, 192, 31 - a, 8, a); + } + + int b = gasCent.getTankScaled(32, 1); + switch (gasCent.outputTank.getTankType()) { + case PF6: + drawTexturedModalRect(guiLeft + 114, guiTop + 62 - b, 200, 31 - b, 8, b); + break; + case NONE: + break; + default: + drawTexturedModalRect(guiLeft + 114, guiTop + 62 - b, 192, 31 - b, 8, b); + } + + this.drawInfoPanel(guiLeft - 16, guiTop + 16, 16, 16, 3); + this.drawInfoPanel(guiLeft - 16, guiTop + 32, 16, 16, 2); } } diff --git a/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java b/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java index 62314e7d5..74538c2e8 100644 --- a/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java @@ -153,8 +153,8 @@ public class AssemblerRecipes { makeRecipe(new ComparableStack(ModItems.hazmat_cloth, 4), new AStack[] {new OreDictStack(PB.dust(), 4), new ComparableStack(Items.string, 8), },50); makeRecipe(new ComparableStack(ModItems.asbestos_cloth, 4), new AStack[] {new OreDictStack(ASBESTOS.ingot(), 2), new ComparableStack(Items.string, 6), new ComparableStack(Blocks.wool, 1), },50); makeRecipe(new ComparableStack(ModItems.filter_coal, 1), new AStack[] {new OreDictStack(COAL.dust(), 4), new ComparableStack(Items.string, 6), new ComparableStack(Items.paper, 1), },50); - makeRecipe(new ComparableStack(ModItems.centrifuge_element, 1), new AStack[] {new ComparableStack(ModItems.tank_steel, 2), new ComparableStack(ModItems.coil_tungsten, 2), new ComparableStack(ModItems.wire_red_copper, 6), new ComparableStack(ModItems.motor, 1), },200); - makeRecipe(new ComparableStack(ModItems.centrifuge_tower, 1), new AStack[] {new ComparableStack(ModItems.centrifuge_element, 4), new OreDictStack(STEEL.plate(), 4), new ComparableStack(ModItems.wire_red_copper, 6), new OreDictStack(POLYMER.ingot(), 2), },150); + makeRecipe(new ComparableStack(ModItems.centrifuge_element, 1), new AStack[] {new ComparableStack(ModItems.tank_steel, 1), new ComparableStack(ModItems.coil_tungsten, 1), new ComparableStack(ModItems.wire_red_copper, 4), new ComparableStack(ModItems.motor, 1), },200); + makeRecipe(new ComparableStack(ModItems.centrifuge_tower, 1), new AStack[] {new ComparableStack(ModItems.centrifuge_element, 4), new OreDictStack(STEEL.plate(), 4), new ComparableStack(ModItems.wire_red_copper, 4), new OreDictStack(POLYMER.ingot(), 2), },150); makeRecipe(new ComparableStack(ModItems.magnet_circular, 1), new AStack[] {new ComparableStack(ModBlocks.fusion_conductor, 5), new OreDictStack(STEEL.ingot(), 4), new OreDictStack(ALLOY.plate(), 6), },150); makeRecipe(new ComparableStack(ModItems.reactor_core, 1), new AStack[] {new OreDictStack(PB.ingot(), 8), new OreDictStack(BE.ingot(), 6), new OreDictStack(STEEL.plate(), 16), new OreDictStack(OreDictManager.getReflector(), 8), new OreDictStack(FIBER.ingot(), 2) },100); makeRecipe(new ComparableStack(ModItems.rtg_unit, 1), new AStack[] {new ComparableStack(ModItems.thermo_element, 3), new ComparableStack(ModItems.board_copper, 1), new OreDictStack(PB.ingot(), 2), new OreDictStack(STEEL.plate(), 2), new ComparableStack(ModItems.circuit_copper, 1), },100); @@ -260,7 +260,7 @@ public class AssemblerRecipes { makeRecipe(new ComparableStack(ModBlocks.seal_frame, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 3), new ComparableStack(ModItems.wire_aluminium, 4), new OreDictStack(REDSTONE.dust(), 2), new ComparableStack(ModBlocks.steel_roof, 5), },50); makeRecipe(new ComparableStack(ModBlocks.seal_controller, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 3), new OreDictStack(POLYMER.ingot(), 4), new OreDictStack(MINGRADE.ingot(), 1), new OreDictStack(REDSTONE.dust(), 4), new ComparableStack(ModBlocks.steel_roof, 5), },100); makeRecipe(new ComparableStack(ModBlocks.machine_centrifuge, 1), new AStack[] {new ComparableStack(ModItems.centrifuge_tower, 1), new OreDictStack(STEEL.ingot(), 4), new OreDictStack(IRON.ingot(), 4), new OreDictStack(STEEL.plate(), 2), new OreDictStack(CU.plate(), 2), new ComparableStack(ModItems.wire_red_copper, 8), },250); - makeRecipe(new ComparableStack(ModBlocks.machine_gascent, 1), new AStack[] {new ComparableStack(ModItems.centrifuge_tower, 1), new OreDictStack(STEEL.ingot(), 4), new OreDictStack(POLYMER.ingot(), 4), new OreDictStack(DESH.ingot(), 2), new OreDictStack(STEEL.plate(), 6), new OreDictStack(ALLOY.plate(), 4), new ComparableStack(ModItems.wire_red_copper, 8), new ComparableStack(ModItems.wire_gold, 4), },300); + makeRecipe(new ComparableStack(ModBlocks.machine_gascent, 1), new AStack[] {new ComparableStack(ModItems.centrifuge_tower, 1), new OreDictStack(STEEL.ingot(), 4), new OreDictStack(POLYMER.ingot(), 2), new OreDictStack(DESH.ingot(), 1), new OreDictStack(STEEL.plate(), 4), new OreDictStack(ALLOY.plate(), 4), new ComparableStack(ModItems.wire_red_copper, 8), new ComparableStack(ModItems.wire_gold, 4), },300); makeRecipe(new ComparableStack(ModBlocks.machine_rtg_furnace_off, 1), new AStack[] {new ComparableStack(Blocks.furnace, 1), new ComparableStack(ModItems.rtg_unit, 3), new OreDictStack(PB.plate(), 6), new OreDictStack(OreDictManager.getReflector(), 4), new OreDictStack(CU.plate(), 2), },150); makeRecipe(new ComparableStack(ModBlocks.machine_diesel, 1), new AStack[] {new ComparableStack(ModItems.hull_small_steel, 4), new ComparableStack(Blocks.piston, 4), new OreDictStack(STEEL.ingot(), 6), new OreDictStack(MINGRADE.ingot(), 2), new OreDictStack(CU.plate(), 4), new ComparableStack(ModItems.wire_red_copper, 6), },200); makeRecipe(new ComparableStack(ModBlocks.machine_selenium, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 4), new OreDictStack(TI.plate(), 6), new OreDictStack(CU.plate(), 8), new ComparableStack(ModItems.hull_big_steel, 1), new ComparableStack(ModItems.hull_small_steel, 9), new ComparableStack(ModItems.pedestal_steel, 1), new ComparableStack(ModItems.coil_copper, 4), },250); diff --git a/src/main/java/com/hbm/inventory/recipes/GasCentrifugeRecipes.java b/src/main/java/com/hbm/inventory/recipes/GasCentrifugeRecipes.java new file mode 100644 index 000000000..c781a8f98 --- /dev/null +++ b/src/main/java/com/hbm/inventory/recipes/GasCentrifugeRecipes.java @@ -0,0 +1,124 @@ +package com.hbm.inventory.recipes; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.hbm.handler.FluidTypeHandler.FluidType; +import com.hbm.items.ModItems; +import com.hbm.items.machine.ItemFluidIcon; + +import net.minecraft.item.ItemStack; + +public class GasCentrifugeRecipes { + + public static enum PseudoFluidType { + NONE (0, 0, "NONE", "Empty", false, new ItemStack(ModItems.polaroid, 0)), + + NUF6 (400, 300, "LEUF6", "Natural UF6", false, new ItemStack(ModItems.nugget_u238, 1)), + LEUF6 (300, 200, "MEUF6", "Low Enriched UF6", false, new ItemStack(ModItems.nugget_u238, 1), new ItemStack(ModItems.fluorite, 1)), + MEUF6 (200, 100, "HEUF6", "Medium Enriched UF6", false, new ItemStack(ModItems.nugget_u238, 1)), + HEUF6 (300, 0, "NONE", "High Enriched UF6", true, new ItemStack(ModItems.nugget_u238, 2), new ItemStack(ModItems.nugget_u235, 1), new ItemStack(ModItems.fluorite, 1)), + + PF6 (300, 0, "NONE", "Plutonium Hexafluoride", false, new ItemStack(ModItems.nugget_pu238, 1), new ItemStack(ModItems.nugget_pu_mix, 2), new ItemStack(ModItems.fluorite, 1)); + + int fluidConsumed; + int fluidProduced; + String outputFluid; + String name; + boolean isHighSpeed; + ItemStack[] output; + + PseudoFluidType(int fluidConsumed, int fluidProduced, String outputFluid, String name, boolean isHighSpeed, ItemStack... output) { + this.fluidConsumed = fluidConsumed; + this.fluidProduced = fluidProduced; + this.outputFluid = outputFluid; + this.name = name; + this.isHighSpeed = isHighSpeed; + this.output = output; + } + + public int getFluidConsumed() { + return this.fluidConsumed; + } + + public int getFluidProduced() { + return this.fluidProduced; + } + + public PseudoFluidType getOutputFluid() { + return this.valueOf(this.outputFluid); + } + + public String getName() { + return this.name; + } + + public boolean getIfHighSpeed() { + return this.isHighSpeed; + } + + public ItemStack[] getOutput() { + return this.output; + } + + }; + + //Recipes for NEI + public static List getGasCentOutputs(FluidType fluid) { + List outputs = new ArrayList(4); + + switch(fluid) { + case UF6: + outputs.add(new ItemStack(ModItems.nugget_u238, 11)); + outputs.add(new ItemStack(ModItems.nugget_u235, 1)); + outputs.add(new ItemStack(ModItems.fluorite, 4)); + return outputs; + case PUF6: + outputs.add(new ItemStack(ModItems.nugget_pu238, 3)); + outputs.add(new ItemStack(ModItems.nugget_pu_mix, 6)); + outputs.add(new ItemStack(ModItems.fluorite, 3)); + return outputs; + default: + return null; + } + } + + public static int getQuantityRequired(FluidType fluid) { + switch(fluid) { + case UF6: + return 1200; + case PUF6: + return 900; + default: + return 0; + } + } + + public static Map getGasCentrifugeRecipes() { + Map recipes = new HashMap(); + + for(int i = 0; i < FluidType.values().length; i++) { + if(getGasCentOutputs(FluidType.getEnum(i)) != null) { + List out = getGasCentOutputs(FluidType.getEnum(i)); + ItemStack[] outputs = new ItemStack[4]; + + for(int j = 0; j < out.size(); j++) { + outputs[j] = out.get(j).copy(); + } + for(int j = 0; j < 4; j++) + if(outputs[j] == null) + outputs[j] = new ItemStack(ModItems.nothing); + + ItemStack input = new ItemStack(ModItems.fluid_icon, 1, i); + ItemFluidIcon.addQuantity(input, getQuantityRequired(FluidType.getEnum(i))); + + recipes.put(input, outputs); + } + } + + return recipes; + } + +} diff --git a/src/main/java/com/hbm/inventory/recipes/MachineRecipes.java b/src/main/java/com/hbm/inventory/recipes/MachineRecipes.java index d22262d91..b4402db62 100644 --- a/src/main/java/com/hbm/inventory/recipes/MachineRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/MachineRecipes.java @@ -152,87 +152,6 @@ public class MachineRecipes { return null; } - - //bro, i don't care - @SuppressWarnings("incomplete-switch") - public static List getGasCentOutput(FluidType fluid) { - - List list = new ArrayList(); - - switch(fluid) { - case UF6: - list.add(new GasCentOutput(3, new ItemStack(ModItems.nugget_u238), 1)); - list.add(new GasCentOutput(3, new ItemStack(ModItems.nugget_u238), 2)); - list.add(new GasCentOutput(2, new ItemStack(ModItems.nugget_u238), 3)); - list.add(new GasCentOutput(1, new ItemStack(ModItems.nugget_u235), 4)); - return list; - case PUF6: - list.add(new GasCentOutput(1, new ItemStack(ModItems.nugget_pu238), 1)); - list.add(new GasCentOutput(2, new ItemStack(ModItems.nugget_pu238), 2)); - list.add(new GasCentOutput(6, new ItemStack(ModItems.nugget_pu_mix), 3)); - list.add(new GasCentOutput(6, new ItemStack(ModItems.nugget_pu_mix), 4)); - return list; - case WATZ: - list.add(new GasCentOutput(1, new ItemStack(ModItems.nugget_solinium), 1)); - list.add(new GasCentOutput(1, new ItemStack(ModItems.nugget_uranium), 2)); - list.add(new GasCentOutput(5, new ItemStack(ModItems.powder_lead), 3)); - list.add(new GasCentOutput(10, new ItemStack(ModItems.dust), 4)); - return list; - case SAS3: - list.add(new GasCentOutput(4, new ItemStack(ModItems.nugget_schrabidium), 1)); - list.add(new GasCentOutput(4, new ItemStack(ModItems.nugget_schrabidium), 2)); - list.add(new GasCentOutput(1, new ItemStack(ModItems.sulfur), 3)); - list.add(new GasCentOutput(1, new ItemStack(ModItems.sulfur), 4)); - return list; - case NITAN: - list.add(new GasCentOutput(1, new ItemStack(ModItems.powder_nitan_mix), 1)); - list.add(new GasCentOutput(1, new ItemStack(ModItems.powder_nitan_mix), 2)); - list.add(new GasCentOutput(1, new ItemStack(ModItems.powder_nitan_mix), 3)); - list.add(new GasCentOutput(1, new ItemStack(ModItems.powder_nitan_mix), 4)); - return list; - } - - return null; - } - - public static class GasCentOutput { - public int weight; - public ItemStack output; - public int slot; - - public GasCentOutput(int w, ItemStack s, int i) { - weight = w; - output = s; - slot = i; - } - } - - @SuppressWarnings("incomplete-switch") - public static int getFluidConsumedGasCent(FluidType fluid) { - - new ArrayList(); - - switch(fluid) { - case LAVA: - return 1000; - case UF6: - return 100; - case PUF6: - return 100; - case WATZ: - return 1000; - case SAS3: - return 100; - case COOLANT: - return 2000; - case CRYOGEL: - return 1000; - case NITAN: - return 500; - } - - return 100; - } //return: FluidType, amount produced, amount required, heat required (°C * 100) @SuppressWarnings("incomplete-switch") @@ -540,43 +459,6 @@ public class MachineRecipes { return fuels; } - public Map getGasCentrifugeRecipes() { - Map recipes = new HashMap(); - - for(int i = 0; i < FluidType.values().length; i++) { - - if(getGasCentOutput(FluidType.getEnum(i)) != null) { - - List outputs = getGasCentOutput(FluidType.getEnum(i)); - - int totalWeight = 0; - - for(GasCentOutput o : outputs) { - totalWeight += o.weight; - } - - ItemStack input = new ItemStack(ModItems.fluid_icon, 1, i); - ItemFluidIcon.addQuantity(input, getFluidConsumedGasCent(FluidType.getEnum(i)) * totalWeight); - - ItemStack[] out = new ItemStack[4]; - - for(int j = 0; j < outputs.size(); j++) { - - out[j] = outputs.get(j).output.copy(); - out[j].stackSize *= outputs.get(j).weight; - } - - for(int j = 0; j < 4; j++) - if(out[j] == null) - out[j] = new ItemStack(ModItems.nothing); - - recipes.put(input, out); - } - } - - return recipes; - } - public ArrayList getCentrifugeFuels() { ArrayList fuels = new ArrayList(); fuels.add(new ItemStack(Items.coal)); @@ -1378,12 +1260,12 @@ public class MachineRecipes { list.add(new ItemStack(ModItems.biomass, 16)); break; case YELLOWCAKE: - list.add(new ItemStack(ModItems.powder_uranium, 1)); + list.add(new ItemStack(ModItems.billet_uranium, 2)); list.add(new ItemStack(ModItems.sulfur, 2)); break; case UF6: list.add(new ItemStack(ModItems.powder_yellowcake, 1)); - list.add(new ItemStack(ModItems.fluorite, 1)); + list.add(new ItemStack(ModItems.fluorite, 4)); break; case PUF6: list.add(new ItemStack(ModItems.powder_plutonium, 1)); @@ -1854,6 +1736,9 @@ public class MachineRecipes { case YELLOWCAKE: output[0] = new ItemStack(ModItems.powder_yellowcake, 1); break; + case UF6: + output[0] = new ItemStack(ModItems.sulfur, 2); + break; case DYN_SCHRAB: output[0] = new ItemStack(ModItems.ingot_schrabidium, 1); output[1] = new ItemStack(ModItems.powder_desh, 12); @@ -2005,7 +1890,7 @@ public class MachineRecipes { output[0] = new FluidStack(1000, FluidType.LPG); break; case UF6: - output[0] = new FluidStack(900, FluidType.UF6); + output[0] = new FluidStack(1200, FluidType.UF6); break; case PUF6: output[0] = new FluidStack(900, FluidType.PUF6); diff --git a/src/main/java/com/hbm/inventory/recipes/SILEXRecipes.java b/src/main/java/com/hbm/inventory/recipes/SILEXRecipes.java index e2078e0f3..f79bf9d70 100644 --- a/src/main/java/com/hbm/inventory/recipes/SILEXRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/SILEXRecipes.java @@ -30,7 +30,7 @@ public class SILEXRecipes { dictTranslation.put("dustUranium", "ingotUranium"); recipes.put("ingotUranium", new SILEXRecipe(900, 100) .addOut(new WeightedRandomObject(new ItemStack(ModItems.nugget_u235), 1)) - .addOut(new WeightedRandomObject(new ItemStack(ModItems.nugget_u238), 8)) + .addOut(new WeightedRandomObject(new ItemStack(ModItems.nugget_u238), 11)) ); recipes.put(new ComparableStack(ModItems.ingot_pu_mix), new SILEXRecipe(900, 100) diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index 59673bf10..8ccfe81cc 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -1946,6 +1946,7 @@ public class ModItems { public static Item upgrade_crystallizer; public static Item upgrade_nullifier; public static Item upgrade_screm; + public static Item upgrade_gc_speed; public static Item ingot_euphemium; public static Item nugget_euphemium; @@ -4633,7 +4634,8 @@ public class ModItems { upgrade_crystallizer = new ItemMachineUpgrade().setUnlocalizedName("upgrade_crystallizer").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_crystallizer"); upgrade_nullifier = new ItemMachineUpgrade().setUnlocalizedName("upgrade_nullifier").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_nullifier"); upgrade_screm = new ItemMachineUpgrade().setUnlocalizedName("upgrade_screm").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_screm"); - + upgrade_gc_speed = new ItemMachineUpgrade().setUnlocalizedName("upgrade_gc_speed").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_gc_speed"); + wand = new ItemWand().setUnlocalizedName("wand_k").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setFull3D().setTextureName(RefStrings.MODID + ":wand"); wand_s = new ItemWandS().setUnlocalizedName("wand_s").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setFull3D().setTextureName(RefStrings.MODID + ":wand_s"); wand_d = new ItemWandD().setUnlocalizedName("wand_d").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setFull3D().setTextureName(RefStrings.MODID + ":wand_d"); @@ -6454,6 +6456,7 @@ public class ModItems { GameRegistry.registerItem(upgrade_crystallizer, upgrade_crystallizer.getUnlocalizedName()); GameRegistry.registerItem(upgrade_nullifier, upgrade_nullifier.getUnlocalizedName()); GameRegistry.registerItem(upgrade_screm, upgrade_screm.getUnlocalizedName()); + GameRegistry.registerItem(upgrade_gc_speed, upgrade_gc_speed.getUnlocalizedName()); //Machine Templates GameRegistry.registerItem(siren_track, siren_track.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/items/machine/ItemMachineUpgrade.java b/src/main/java/com/hbm/items/machine/ItemMachineUpgrade.java index eed058317..4bdb8a572 100644 --- a/src/main/java/com/hbm/items/machine/ItemMachineUpgrade.java +++ b/src/main/java/com/hbm/items/machine/ItemMachineUpgrade.java @@ -164,6 +164,12 @@ public class ItemMachineUpgrade extends Item { list.add("50% chance to override worthless items with /dev/zero"); list.add("50% chance to move worthless items to /dev/null"); } + + if(this == ModItems.upgrade_gc_speed) { + list.add(EnumChatFormatting.RED + "Gas Centrifuge Upgrade"); + list.add("Allows for total isotopic separation of HEUF6"); + list.add(EnumChatFormatting.YELLOW + "also your centrifuge goes sicko mode"); + } } public static enum UpgradeType { @@ -179,7 +185,8 @@ public class ItemMachineUpgrade extends Item { LM_SMELTER(true), LM_SHREDDER(true), LM_CENTRIFUGE(true), - LM_CRYSTALLIZER(true); + LM_CRYSTALLIZER(true), + GS_SPEED; public boolean mutex = false; diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index 47d69fcdd..f7082dfaa 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -727,6 +727,7 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModItems.upgrade_centrifuge, 1), new Object[] { "PHP", "PUP", "DTD", 'P', ModItems.centrifuge_element, 'H', Blocks.hopper, 'U', ModItems.upgrade_shredder, 'D', POLYMER.ingot(), 'T', ModBlocks.machine_transformer }); addRecipeAuto(new ItemStack(ModItems.upgrade_crystallizer, 1), new Object[] { "PHP", "CUC", "DTD", 'P', new ItemStack(ModItems.fluid_barrel_full, 1, FluidType.ACID.ordinal()), 'H', ModItems.circuit_targeting_tier4, 'C', ModBlocks.barrel_steel, 'U', ModItems.upgrade_centrifuge, 'D', ModItems.motor, 'T', ModBlocks.machine_transformer }); addRecipeAuto(new ItemStack(ModItems.upgrade_screm, 1), new Object[] { "SUS", "SCS", "SUS", 'S', STEEL.plate(), 'U', ModItems.upgrade_template, 'C', ModItems.crystal_xen }); + addRecipeAuto(new ItemStack(ModItems.upgrade_gc_speed, 1), new Object[] {"TCT", "HUH", "TCT", 'T', TC99.nugget(), 'C', ModItems.coil_copper, 'H', ModItems.coil_tungsten, 'U', ModItems.upgrade_template}); addRecipeAuto(new ItemStack(ModItems.mech_key, 1), new Object[] { "MCM", "MKM", "MMM", 'M', ModItems.ingot_meteorite_forged, 'C', ModItems.coin_maskman, 'K', ModItems.key }); addRecipeAuto(new ItemStack(ModItems.spawn_ufo, 1), new Object[] { "MMM", "DCD", "MMM", 'M', ModItems.ingot_meteorite, 'D', DNT.ingot(), 'C', ModItems.coin_worm }); diff --git a/src/main/java/com/hbm/main/NEIConfig.java b/src/main/java/com/hbm/main/NEIConfig.java index f104c96a6..6aff0fb91 100644 --- a/src/main/java/com/hbm/main/NEIConfig.java +++ b/src/main/java/com/hbm/main/NEIConfig.java @@ -98,7 +98,6 @@ public class NEIConfig implements IConfigureNEI { API.hideItem(new ItemStack(ModBlocks.dummy_block_radgen)); API.hideItem(new ItemStack(ModBlocks.dummy_block_vault)); API.hideItem(new ItemStack(ModBlocks.dummy_block_blast)); - API.hideItem(new ItemStack(ModBlocks.dummy_block_gascent)); API.hideItem(new ItemStack(ModBlocks.dummy_block_uf6)); API.hideItem(new ItemStack(ModBlocks.dummy_block_puf6)); API.hideItem(new ItemStack(ModBlocks.dummy_port_assembler)); diff --git a/src/main/java/com/hbm/packet/AuxGaugePacket.java b/src/main/java/com/hbm/packet/AuxGaugePacket.java index bedd75c2d..4c1889175 100644 --- a/src/main/java/com/hbm/packet/AuxGaugePacket.java +++ b/src/main/java/com/hbm/packet/AuxGaugePacket.java @@ -165,14 +165,6 @@ public class AuxGaugePacket implements IMessage { if(m.id == 1) radio.freq = ((double)m.value) / 10D; } - if (te instanceof TileEntityMachineGasCent) { - TileEntityMachineGasCent cent = (TileEntityMachineGasCent)te; - - if(m.id == 0) - cent.progress = m.value; - if(m.id == 1) - cent.isProgressing = m.value == 1; - } if (te instanceof TileEntityMachineCentrifuge) { TileEntityMachineCentrifuge cent = (TileEntityMachineCentrifuge)te; diff --git a/src/main/java/com/hbm/render/tileentity/RenderCentrifuge.java b/src/main/java/com/hbm/render/tileentity/RenderCentrifuge.java index 64f687b49..91eba0f40 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderCentrifuge.java +++ b/src/main/java/com/hbm/render/tileentity/RenderCentrifuge.java @@ -10,8 +10,6 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; public class RenderCentrifuge extends TileEntitySpecialRenderer { - - public RenderCentrifuge() { } @Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) @@ -19,16 +17,11 @@ public class RenderCentrifuge extends TileEntitySpecialRenderer { GL11.glPushMatrix(); GL11.glTranslated(x + 0.5D, y, z + 0.5D); GL11.glEnable(GL11.GL_LIGHTING); - switch(tileEntity.getBlockMetadata()) - { - case 4: - GL11.glRotatef(90, 0F, 1F, 0F); break; - case 3: - GL11.glRotatef(180, 0F, 1F, 0F); break; - case 5: - GL11.glRotatef(270, 0F, 1F, 0F); break; - case 2: - GL11.glRotatef(0, 0F, 1F, 0F); break; + switch(tileEntity.getBlockMetadata() - 10) { + 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; } if(tileEntity instanceof TileEntityMachineCentrifuge) diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java index 29cd5a391..d051b7cd1 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java @@ -4,17 +4,22 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import com.hbm.blocks.BlockDummyable; import com.hbm.handler.FluidTypeHandler.FluidType; import com.hbm.interfaces.IFluidAcceptor; import com.hbm.interfaces.IFluidContainer; import com.hbm.inventory.FluidTank; +import com.hbm.inventory.recipes.GasCentrifugeRecipes; +import com.hbm.inventory.recipes.GasCentrifugeRecipes.PseudoFluidType; import com.hbm.inventory.recipes.MachineRecipes; -import com.hbm.inventory.recipes.MachineRecipes.GasCentOutput; +import com.hbm.items.ModItems; +import com.hbm.items.machine.ItemFluidIdentifier; import com.hbm.lib.Library; import com.hbm.packet.AuxElectricityPacket; import com.hbm.packet.AuxGaugePacket; import com.hbm.packet.LoopedSoundPacket; import com.hbm.packet.PacketDispatcher; +import com.hbm.tileentity.TileEntityMachineBase; import api.hbm.energy.IEnergyUser; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; @@ -28,11 +33,11 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityMachineGasCent extends TileEntity implements ISidedInventory, IEnergyUser, IFluidContainer, IFluidAcceptor { - - private ItemStack slots[]; +public class TileEntityMachineGasCent extends TileEntityMachineBase implements IEnergyUser, IFluidContainer, IFluidAcceptor { + public byte age; public long power; public int progress; public boolean isProgressing; @@ -40,114 +45,25 @@ public class TileEntityMachineGasCent extends TileEntity implements ISidedInvent public static final int processingSpeed = 200; public FluidTank tank; + public PseudoFluidTank inputTank; + public PseudoFluidTank outputTank; - private static final int[] slots_top = new int[] {3}; - private static final int[] slots_bottom = new int[] {5, 6, 7, 8}; - private static final int[] slots_side = new int[] {0, 3}; + private static final int[] slots_top = new int[] {0}; + private static final int[] slots_bottom = new int[] {2, 3, 4}; + private static final int[] slots_side = new int[] { }; private String customName; public TileEntityMachineGasCent() { - slots = new ItemStack[9]; - tank = new FluidTank(FluidType.UF6, 8000, 0); - } - - @Override - public int getSizeInventory() { - return slots.length; - } - - @Override - public ItemStack getStackInSlot(int i) { - return slots[i]; - } - - @Override - public ItemStack getStackInSlotOnClosing(int i) { - if(slots[i] != null) - { - ItemStack itemStack = slots[i]; - slots[i] = null; - return itemStack; - } else { - return null; - } - } - - @Override - public void setInventorySlotContents(int i, ItemStack itemStack) { - slots[i] = itemStack; - if(itemStack != null && itemStack.stackSize > getInventoryStackLimit()) - { - itemStack.stackSize = getInventoryStackLimit(); - } - } - - @Override - public String getInventoryName() { - return this.hasCustomInventoryName() ? this.customName : "container.gasCentrifuge"; - } - - @Override - public boolean hasCustomInventoryName() { - return this.customName != null && this.customName.length() > 0; - } - - public void setCustomName(String name) { - this.customName = name; - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer player) { - if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) - { - return false; - }else{ - return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64; - } - } - - //You scrubs aren't needed for anything (right now) - @Override - public void openInventory() {} - @Override - public void closeInventory() {} - - @Override - public boolean isItemValidForSlot(int i, ItemStack itemStack) { - if(i == 2 || i == 3 || i == 4 || i == 5) - { - return false; - } - - return true; + super(6); + tank = new FluidTank(FluidType.UF6, 2000, 0); + inputTank = new PseudoFluidTank(PseudoFluidType.NUF6, 8000); + outputTank = new PseudoFluidTank(PseudoFluidType.LEUF6, 8000); } @Override - public ItemStack decrStackSize(int i, int j) { - if(slots[i] != null) - { - if(slots[i].stackSize <= j) - { - ItemStack itemStack = slots[i]; - slots[i] = null; - return itemStack; - } - ItemStack itemStack1 = slots[i].splitStack(j); - if (slots[i].stackSize == 0) - { - slots[i] = null; - } - - return itemStack1; - } else { - return null; - } + public String getName() { + return "container.gasCentrifuge"; } @Override @@ -155,9 +71,11 @@ public class TileEntityMachineGasCent extends TileEntity implements ISidedInvent super.readFromNBT(nbt); NBTTagList list = nbt.getTagList("items", 10); - power = nbt.getLong("powerTime"); - progress = nbt.getShort("CookTime"); + power = nbt.getLong("power"); + progress = nbt.getShort("progress"); tank.readFromNBT(nbt, "tank"); + inputTank.readFromNBT(nbt, "inputTank"); + outputTank.readFromNBT(nbt, "outputTank"); slots = new ItemStack[getSizeInventory()]; for(int i = 0; i < list.tagCount(); i++) @@ -174,9 +92,11 @@ public class TileEntityMachineGasCent extends TileEntity implements ISidedInvent @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - nbt.setLong("powerTime", power); - nbt.setShort("cookTime", (short) progress); + nbt.setLong("power", power); + nbt.setShort("progress", (short) progress); tank.writeToNBT(nbt, "tank"); + inputTank.writeToNBT(nbt, "inputTank"); + outputTank.writeToNBT(nbt, "outputTank"); NBTTagList list = new NBTTagList(); for(int i = 0; i < slots.length; i++) @@ -193,51 +113,58 @@ public class TileEntityMachineGasCent extends TileEntity implements ISidedInvent } @Override - public int[] getAccessibleSlotsFromSide(int p_94128_1_) + public int[] getAccessibleSlotsFromSide(int meta) { - return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side); + return meta == 0 ? slots_bottom : (meta == 1 ? slots_top : slots_side); } - @Override - public boolean canInsertItem(int i, ItemStack itemStack, int j) { - return this.isItemValidForSlot(i, itemStack); - } - @Override public boolean canExtractItem(int i, ItemStack itemStack, int j) { - return j != 0 || i != 1 || itemStack.getItem() == Items.bucket; + return (i != 0 && i != 1) || j == 1; } public int getCentrifugeProgressScaled(int i) { - return (progress * i) / processingSpeed; + return (progress * i) / getProcessingSpeed(); } public long getPowerRemainingScaled(int i) { return (power * i) / maxPower; } - private boolean canProcess() { - - if(power > 0 && this.tank.getFill() >= MachineRecipes.getFluidConsumedGasCent(tank.getTankType())) { + public int getTankScaled(int i, int id) { + if(id == 0) { + return (this.inputTank.getFill() * i) / inputTank.getMaxFill(); + } else if(id == 1) { + return (this.outputTank.getFill() * i) / outputTank.getMaxFill(); + } + return i; + } + + private boolean canEnrich() { + if(power > 0 && this.inputTank.getFill() >= inputTank.getTankType().getFluidConsumed() && this.outputTank.getFill() <= outputTank.getMaxFill()) { - List list = MachineRecipes.getGasCentOutput(tank.getTankType()); + ItemStack[] list = inputTank.getTankType().getOutput(); + + if(this.inputTank.getTankType().getIfHighSpeed()) + if(!(slots[5] != null && slots[5].getItem() == ModItems.upgrade_gc_speed)) + return false; if(list == null) return false; - if(list.size() < 1 || list.size() > 4) + if(list.length < 1 || list.length > 3) return false; - for(int i = 0; i < list.size(); i++) { + for(int i = 0; i < list.length; i++) { - int slot = i + 5; + int slot = i + 2; if(slots[slot] == null) continue; - if(slots[slot].getItem() == list.get(i).output.getItem() && - slots[slot].getItemDamage() == list.get(i).output.getItemDamage() && - slots[slot].stackSize + list.get(i).output.stackSize <= slots[slot].getMaxStackSize()) + if(slots[slot].getItem() == list[i].getItem() && + slots[slot].getItemDamage() == list[i].getItemDamage() && + slots[slot].stackSize + list[i].stackSize <= slots[slot].getMaxStackSize()) continue; return false; @@ -249,33 +176,72 @@ public class TileEntityMachineGasCent extends TileEntity implements ISidedInvent return false; } - private void process() { - - List out = MachineRecipes.getGasCentOutput(tank.getTankType()); + private void enrich() { + ItemStack[] output = inputTank.getTankType().getOutput(); + this.progress = 0; - tank.setFill(tank.getFill() - MachineRecipes.getFluidConsumedGasCent(tank.getTankType())); + inputTank.setFill(inputTank.getFill() - inputTank.getTankType().getFluidConsumed()); + outputTank.setFill(outputTank.getFill() + inputTank.getTankType().getFluidProduced()); - List random = new ArrayList(); - - for(int i = 0; i < out.size(); i++) { - for(int j = 0; j < out.get(i).weight; j++) { - random.add(out.get(i)); + for(byte i = 0; i < output.length && i < 3; i++) { + if(slots[i + 2] == null) { + slots[i + 2] = output[i].copy(); + } else { + slots[i + 2].stackSize += output[i].stackSize; } } - - Collections.shuffle(random); - - GasCentOutput result = random.get(worldObj.rand.nextInt(random.size())); - - int slot = result.slot + 4; - - if(slots[slot] == null) { - slots[slot] = result.output.copy(); - } else { - slots[slot].stackSize += result.output.stackSize; + } + + private void attemptConversion() { + if(inputTank.getFill() <= inputTank.getMaxFill() && tank.getFill() > 0) { + int fill = inputTank.getMaxFill() - inputTank.getFill(); + + if(tank.getFill() >= fill) { + tank.setFill(tank.getFill() - fill); + inputTank.setFill(inputTank.getFill() + fill); + } else { + inputTank.setFill(inputTank.getFill() + tank.getFill()); + tank.setFill(0); + } } } + private boolean attemptTransfer(TileEntity te) { + if(te instanceof TileEntityMachineGasCent) { + TileEntityMachineGasCent gasCent = (TileEntityMachineGasCent) te; + + if(gasCent.tank.getFill() == 0 && gasCent.tank.getTankType() == this.tank.getTankType()) { + if(gasCent.inputTank.getTankType() != this.outputTank.getTankType()) { + gasCent.inputTank.setTankType(this.outputTank.getTankType()); + gasCent.outputTank.setTankType(this.outputTank.getTankType().getOutputFluid()); + } + + if(gasCent.inputTank.getFill() < gasCent.inputTank.getMaxFill() && this.outputTank.getFill() > 0) { + int fill = gasCent.inputTank.getMaxFill() - gasCent.inputTank.getFill(); + + if(this.outputTank.getFill() >= fill) { + this.outputTank.setFill(this.outputTank.getFill() - fill); + gasCent.inputTank.setFill(gasCent.inputTank.getFill() + fill); + } else { + gasCent.inputTank.setFill(gasCent.inputTank.getFill() + this.outputTank.getFill()); + this.outputTank.setFill(0); + } + } + return false; + } + } + return true; + } + + public void networkUnpack(NBTTagCompound data) { + this.power = data.getLong("power"); + this.progress = data.getInteger("progress"); + this.inputTank.setTankType(PseudoFluidType.valueOf(data.getString("inputType"))); + this.outputTank.setTankType(PseudoFluidType.valueOf(data.getString("outputType"))); + this.inputTank.setFill(data.getInteger("inputFill")); + this.outputTank.setFill(data.getInteger("outputFill")); + } + @Override public void updateEntity() { @@ -284,50 +250,70 @@ public class TileEntityMachineGasCent extends TileEntity implements ISidedInvent this.updateStandardConnections(worldObj, xCoord, yCoord, zCoord); power = Library.chargeTEFromItems(slots, 0, power, maxPower); - tank.setType(1, 2, slots); - tank.loadTank(3, 4, slots); - tank.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId); + setTankType(1); - if(canProcess()) { + if(inputTank.getTankType() == PseudoFluidType.PF6 || inputTank.getTankType() == PseudoFluidType.NUF6) { + tank.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId); + attemptConversion(); + } + + if(canEnrich()) { isProgressing = true; this.progress++; - this.power -= 200; + if(slots[5] != null && slots[5].getItem() == ModItems.upgrade_gc_speed) + this.power -= 300; + else + this.power -= 200; if(this.power < 0) { power = 0; this.progress = 0; } - if(progress >= processingSpeed) { - process(); - } + if(progress >= getProcessingSpeed()) + enrich(); + } else { isProgressing = false; this.progress = 0; } + + age++; + if(age >= 10) { + age = 0; + + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); + TileEntity te = worldObj.getTileEntity(this.xCoord - dir.offsetX, this.yCoord, this.zCoord - dir.offsetZ); + + if(attemptTransfer(te) && this.inputTank.getTankType() == PseudoFluidType.LEUF6) { + if(this.outputTank.getFill() >= 100 && (slots[4] == null || slots[4].getItem() == ModItems.nugget_uranium_fuel) && slots[4].stackSize + 1 <= slots[4].getMaxStackSize()) { + this.outputTank.setFill(this.outputTank.getFill() - 100); + if(slots[4] == null) { + slots[4] = new ItemStack(ModItems.nugget_uranium_fuel, 1); + } else { + slots[4].stackSize += 1; + } + } + } + } + + NBTTagCompound data = new NBTTagCompound(); + data.setLong("power", power); + data.setInteger("progress", progress); + data.setInteger("inputFill", inputTank.getFill()); + data.setInteger("outputFill", outputTank.getFill()); + data.setString("inputType", inputTank.getTankType().toString()); + data.setString("outputType", outputTank.getTankType().toString()); + this.networkPack(data, 50); PacketDispatcher.wrapper.sendToAllAround(new AuxElectricityPacket(xCoord, yCoord, zCoord, power), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); - PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, progress, 0), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); - PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, isProgressing ? 1 : 0, 1), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); PacketDispatcher.wrapper.sendToAllAround(new LoopedSoundPacket(xCoord, yCoord, zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); } } - - @Override - public AxisAlignedBB getRenderBoundingBox() { - return TileEntity.INFINITE_EXTENT_AABB; - } - - @Override - @SideOnly(Side.CLIENT) - public double getMaxRenderDistanceSquared() - { - return 65536.0D; - } @Override public void setPower(long i) { @@ -344,6 +330,13 @@ public class TileEntityMachineGasCent extends TileEntity implements ISidedInvent public long getMaxPower() { return maxPower; } + + public int getProcessingSpeed() { + if(slots[5] != null && slots[5].getItem() == ModItems.upgrade_gc_speed) { + return processingSpeed - 75; + } + return processingSpeed; + } @Override public void setFillstate(int fill, int index) { @@ -354,6 +347,32 @@ public class TileEntityMachineGasCent extends TileEntity implements ISidedInvent public void setType(FluidType type, int index) { tank.setTankType(type); } + + public void setTankType(int in) { + + if(slots[in] != null && slots[in].getItem() instanceof ItemFluidIdentifier) { + FluidType newType = ItemFluidIdentifier.getType(slots[in]); + + if(tank.getTankType() != newType) { + tank.setTankType(newType); + tank.setFill(0); + + switch(newType) { + case UF6: + inputTank.setTankType(PseudoFluidType.NUF6); + outputTank.setTankType(PseudoFluidType.NUF6.getOutputFluid()); + break; + case PUF6: + inputTank.setTankType(PseudoFluidType.PF6); + outputTank.setTankType(PseudoFluidType.PF6.getOutputFluid()); + break; + default: + break; + } + } + return; + } + } @Override public int getMaxFluidFill(FluidType type) { @@ -379,4 +398,116 @@ public class TileEntityMachineGasCent extends TileEntity implements ISidedInvent return list; } + @Override + public AxisAlignedBB getRenderBoundingBox() { + return TileEntity.INFINITE_EXTENT_AABB; + } + + @Override + @SideOnly(Side.CLIENT) + public double getMaxRenderDistanceSquared() + { + return 65536.0D; + } + + public class PseudoFluidTank { + PseudoFluidType type; + int fluid; + int maxFluid; + + public PseudoFluidTank(PseudoFluidType type, int maxFluid) { + this.type = type; + this.maxFluid = maxFluid; + } + + public void setFill(int i) { + fluid = i; + } + + public void setTankType(PseudoFluidType type) { + + if(this.type.name().equals(type.name())) + return; + + this.type = type; + this.setFill(0); + } + + public PseudoFluidType getTankType() { + return type; + } + + public int getFill() { + return fluid; + } + + public int getMaxFill() { + return maxFluid; + } + + //Called by TE to save fillstate + public void writeToNBT(NBTTagCompound nbt, String s) { + nbt.setInteger(s, fluid); + nbt.setInteger(s + "_max", maxFluid); + nbt.setString(s + "_type", type.toString()); + } + + //Called by TE to load fillstate + public void readFromNBT(NBTTagCompound nbt, String s) { + fluid = nbt.getInteger(s); + int max = nbt.getInteger(s + "_max"); + if(max > 0) + maxFluid = nbt.getInteger(s + "_max"); + type = PseudoFluidType.valueOf(nbt.getString(s + "_type")); + } + + /* ______ ______ + * _I____I_ _I____I_ + * / \\\ / \\\ + * |IF{ || || } || | + * | IF{ || || } || | + * | IF{ || || } || | + * | IF{ || || } || | + * | IF{|| || } || | + * | || || || | + * | } || ||IF{ || | + * | } || || IF{ || | + * | } || || IF{ || | + * | } || || IF{ || | + * | } || || IF{|| | + * |IF{ || || } || | + * | IF{ || || } || | + * | IF{ || || } || | + * | IF{ || || } || | + * | IF{|| || } || | + * | || || || | + * | } || ||IF{ || | + * | } || || IF{ || | + * | } || || IF{ || | + * | } || || IF{ || | + * | } || || IF{|| | + * |IF{ || || } || | + * | IF{ || || } || | + * | IF{ || || } || | + * | IF{ || || } || | + * | IF{|| || } || | + * | || || || | + * | } || ||IF{ || | + * | } || || IF{ || | + * | } || || IF{ || | + * | } || || IF{ || | + * | } || || IF{|| | + * _|_______||_||_______||_|_ + * | | + * | | + * | |==========| | + * | |NESTED | | + * | |IF (: | | + * | |STATEMENTS| | + * | |==========| | + * | | + * | | + * ---------------------------- + */ + } } diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 04ae2bd7b..070947f09 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -2687,6 +2687,7 @@ item.upgrade_effect_3.name=Effectiveness Upgrade Mk.III item.upgrade_fortune_1.name=Fortune Upgrade Mk.I item.upgrade_fortune_2.name=Fortune Upgrade Mk.II item.upgrade_fortune_3.name=Fortune Upgrade Mk.III +item.upgrade_gc_speed.name=Gas Centrifuge Overclocking Upgrade item.upgrade_health.name=Emitter Health Upgrade item.upgrade_nullifier.name=Scrap Destroyer Upgrade item.upgrade_overdrive_1.name=Overdrive Upgrade Mk.I diff --git a/src/main/resources/assets/hbm/textures/gui/centrifuge_gas.png b/src/main/resources/assets/hbm/textures/gui/centrifuge_gas.png index 688d9cc19..6621f4ea6 100644 Binary files a/src/main/resources/assets/hbm/textures/gui/centrifuge_gas.png and b/src/main/resources/assets/hbm/textures/gui/centrifuge_gas.png differ diff --git a/src/main/resources/assets/hbm/textures/items/upgrade_gc_speed.png b/src/main/resources/assets/hbm/textures/items/upgrade_gc_speed.png new file mode 100644 index 000000000..ee98c7201 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/upgrade_gc_speed.png differ