diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index 08cc45eb9..607c203f1 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -1153,7 +1153,6 @@ public class ModBlocks { public static Block dummy_block_igenerator; public static Block dummy_port_igenerator; - public static Block dummy_block_centrifuge; public static Block dummy_block_cyclotron; public static Block dummy_port_cyclotron; public static Block dummy_block_well; @@ -1700,7 +1699,7 @@ public class ModBlocks { machine_difurnace_rtg_off = new MachineDiFurnaceRTG(false).setBlockName("machine_difurnace_rtg_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); 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_centrifuge = new MachineCentrifuge(Material.iron).setBlockName("machine_centrifuge").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); 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"); @@ -2155,7 +2154,6 @@ public class ModBlocks { dummy_block_igenerator = new DummyBlockIGenerator(Material.iron, false).setBlockName("dummy_block_igenerator").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel"); dummy_port_igenerator = new DummyBlockIGenerator(Material.iron, true).setBlockName("dummy_port_igenerator").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel"); - dummy_block_centrifuge = new DummyBlockCentrifuge(Material.iron).setBlockName("dummy_block_centrifuge").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel"); dummy_block_cyclotron = new DummyBlockCyclotron(Material.iron, false).setBlockName("dummy_block_cyclotron").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_titanium"); dummy_port_cyclotron = new DummyBlockCyclotron(Material.iron, true).setBlockName("dummy_port_cyclotron").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_titanium"); dummy_block_well = new BlockGeneric(Material.iron).setBlockName("dummy_block_well").setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel"); @@ -3118,7 +3116,6 @@ public class ModBlocks { //Multiblock Dummy Blocks GameRegistry.registerBlock(dummy_block_igenerator, dummy_block_igenerator.getUnlocalizedName()); GameRegistry.registerBlock(dummy_port_igenerator, dummy_port_igenerator.getUnlocalizedName()); - GameRegistry.registerBlock(dummy_block_centrifuge, dummy_block_centrifuge.getUnlocalizedName()); GameRegistry.registerBlock(dummy_block_cyclotron, dummy_block_cyclotron.getUnlocalizedName()); GameRegistry.registerBlock(dummy_port_cyclotron, dummy_port_cyclotron.getUnlocalizedName()); GameRegistry.registerBlock(dummy_block_well, dummy_block_well.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/blocks/machine/DummyBlockCentrifuge.java b/src/main/java/com/hbm/blocks/machine/DummyBlockCentrifuge.java deleted file mode 100644 index 6501acf0c..000000000 --- a/src/main/java/com/hbm/blocks/machine/DummyBlockCentrifuge.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.hbm.blocks.machine; - -import java.util.Random; - -import com.hbm.blocks.ModBlocks; -import com.hbm.interfaces.IDummy; -import com.hbm.main.MainRegistry; -import com.hbm.tileentity.machine.TileEntityDummy; -import com.hbm.tileentity.machine.TileEntityMachineCentrifuge; - -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.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class DummyBlockCentrifuge extends BlockContainer implements IDummy { - - public static boolean safeBreak = false; - - public DummyBlockCentrifuge(Material p_i45386_1_) { - super(p_i45386_1_); - } - - @Override - public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { - return new TileEntityDummy(); - } - - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int i) - { - if(!safeBreak) { - TileEntity te = world.getTileEntity(x, y, z); - if(te != null && te instanceof TileEntityDummy) { - int a = ((TileEntityDummy)te).targetX; - int b = ((TileEntityDummy)te).targetY; - int c = ((TileEntityDummy)te).targetZ; - - //world.getBlock(a, b, c).breakBlock(world, a, b, c, block, i); - if(!world.isRemote) - world.func_147480_a(a, b, c, true); - } - } - world.removeTileEntity(x, y, z); - } - - @Override - public int getRenderType() { - return -1; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public boolean renderAsNormalBlock() { - return false; - } - - @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { - return null; - } - - @Override - @SideOnly(Side.CLIENT) - public Item getItem(World world, int x, int y, int z) - { - return Item.getItemFromBlock(ModBlocks.machine_centrifuge); - } - - @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) - { - return true; - } else if(!player.isSneaking()) - { - TileEntity te = world.getTileEntity(x, y, z); - if(te != null && te instanceof TileEntityDummy) { - int a = ((TileEntityDummy)te).targetX; - int b = ((TileEntityDummy)te).targetY; - int c = ((TileEntityDummy)te).targetZ; - - TileEntityMachineCentrifuge entity = (TileEntityMachineCentrifuge) world.getTileEntity(a, b, c); - if(entity != null) - { - FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_centrifuge, world, a, b, c); - } - } - return true; - } else { - return false; - } - } - -} diff --git a/src/main/java/com/hbm/blocks/machine/MachineCentrifuge.java b/src/main/java/com/hbm/blocks/machine/MachineCentrifuge.java index 62c3bd676..eb1964ab5 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineCentrifuge.java +++ b/src/main/java/com/hbm/blocks/machine/MachineCentrifuge.java @@ -2,12 +2,15 @@ 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.interfaces.IMultiblock; import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; +import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntityMachineCentrifuge; +import com.hbm.tileentity.machine.TileEntityMachineGasCent; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; @@ -25,143 +28,53 @@ 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 MachineCentrifuge extends BlockContainer implements IMultiblock { - - private final Random field_149933_a = new Random(); - private static boolean keepInventory; +public class MachineCentrifuge extends BlockDummyable implements IMultiblock { - public MachineCentrifuge(Material p_i45386_1_) { - super(p_i45386_1_); + public MachineCentrifuge(Material mat) { + super(mat); } @Override - public int getRenderType(){ - return -1; + public TileEntity createNewTileEntity(World world, int meta) { + + if(meta >= 12) + return new TileEntityMachineCentrifuge(); + if(meta >= 6) + return new TileEntityProxyCombo(false, true, true); + + return null; } - @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_centrifuge"); - } - - @Override - public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { - return new TileEntityMachineCentrifuge(); - } - - @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { - return Item.getItemFromBlock(ModBlocks.machine_centrifuge); - } - - @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_centrifuge); - - } 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) - { - TileEntityMachineCentrifuge tileentityfurnace = (TileEntityMachineCentrifuge)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) - { + if(world.isRemote) { return true; - } else if(!player.isSneaking()) - { - TileEntityMachineCentrifuge entity = (TileEntityMachineCentrifuge) world.getTileEntity(x, y, z); - if(entity != null) - { - FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_centrifuge, world, x, y, z); - } + } else if(!player.isSneaking()) { + int[] pos = this.findCore(world, x, y, z); + + if(pos == null) + return false; + + FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_centrifuge, 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/blocks/machine/MachineGasCent.java b/src/main/java/com/hbm/blocks/machine/MachineGasCent.java index 8ea3ad35c..eb011a64a 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineGasCent.java +++ b/src/main/java/com/hbm/blocks/machine/MachineGasCent.java @@ -68,7 +68,7 @@ public class MachineGasCent extends BlockDummyable implements IMultiblock { @Override public int[] getDimensions() { - return new int[] {2, 0, 0, 0, 0, 0,}; + return new int[] {3, 0, 0, 0, 0, 0,}; } @Override diff --git a/src/main/java/com/hbm/entity/mob/EntityFBI.java b/src/main/java/com/hbm/entity/mob/EntityFBI.java index f38bb9a14..d7ea8273d 100644 --- a/src/main/java/com/hbm/entity/mob/EntityFBI.java +++ b/src/main/java/com/hbm/entity/mob/EntityFBI.java @@ -159,7 +159,6 @@ public class EntityFBI extends EntityMob implements IRangedAttackMob { canDestroy.add(ModBlocks.machine_epress); canDestroy.add(ModBlocks.dummy_block_assembler); canDestroy.add(ModBlocks.dummy_block_chemplant); - canDestroy.add(ModBlocks.dummy_block_centrifuge); 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/inventory/recipes/ShredderRecipes.java b/src/main/java/com/hbm/inventory/recipes/ShredderRecipes.java index ea72ee4a5..e435993b0 100644 --- a/src/main/java/com/hbm/inventory/recipes/ShredderRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/ShredderRecipes.java @@ -311,6 +311,15 @@ public class ShredderRecipes { ShredderRecipes.setRecipe(new ItemStack(ModBlocks.bobblehead, 1, i), new ItemStack(ModItems.scrap_plastic, 1, type.scrap.ordinal())); } + /* + * Debris shredding + */ + ShredderRecipes.setRecipe(ModItems.debris_concrete, new ItemStack(ModItems.scrap_nuclear, 2)); + ShredderRecipes.setRecipe(ModItems.debris_shrapnel, new ItemStack(ModItems.powder_steel_tiny, 5)); + ShredderRecipes.setRecipe(ModItems.debris_exchanger, new ItemStack(ModItems.powder_steel, 3)); + ShredderRecipes.setRecipe(ModItems.debris_element, new ItemStack(ModItems.scrap_nuclear, 4)); + ShredderRecipes.setRecipe(ModItems.debris_metal, new ItemStack(ModItems.powder_steel_tiny, 3)); + /* * GC COMPAT */ diff --git a/src/main/java/com/hbm/main/NEIConfig.java b/src/main/java/com/hbm/main/NEIConfig.java index 6aff0fb91..582e748df 100644 --- a/src/main/java/com/hbm/main/NEIConfig.java +++ b/src/main/java/com/hbm/main/NEIConfig.java @@ -80,7 +80,6 @@ public class NEIConfig implements IConfigureNEI { API.hideItem(new ItemStack(ModItems.ams_core_thingy)); } API.hideItem(new ItemStack(ModBlocks.dummy_block_assembler)); - API.hideItem(new ItemStack(ModBlocks.dummy_block_centrifuge)); API.hideItem(new ItemStack(ModBlocks.dummy_block_chemplant)); API.hideItem(new ItemStack(ModBlocks.dummy_block_cyclotron)); API.hideItem(new ItemStack(ModBlocks.dummy_block_drill)); diff --git a/src/main/java/com/hbm/packet/AuxGaugePacket.java b/src/main/java/com/hbm/packet/AuxGaugePacket.java index 4c1889175..78f2a3a88 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 TileEntityMachineCentrifuge) { - TileEntityMachineCentrifuge cent = (TileEntityMachineCentrifuge)te; - - if(m.id == 0) - cent.dualCookTime = m.value; - if(m.id == 1) - cent.isProgressing = m.value == 1; - } if (te instanceof TileEntityMachineBoiler) { TileEntityMachineBoiler boiler = (TileEntityMachineBoiler)te; diff --git a/src/main/java/com/hbm/render/tileentity/RenderCentrifuge.java b/src/main/java/com/hbm/render/tileentity/RenderCentrifuge.java index 28340fa76..c796ef990 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderCentrifuge.java +++ b/src/main/java/com/hbm/render/tileentity/RenderCentrifuge.java @@ -17,7 +17,7 @@ public class RenderCentrifuge extends TileEntitySpecialRenderer { GL11.glTranslated(x + 0.5D, y, z + 0.5D); GL11.glEnable(GL11.GL_LIGHTING); - switch(tileEntity.getBlockMetadata() - 10) { //unless vær updated the regular centrifuge too, this is now broken + 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; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCentrifuge.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCentrifuge.java index a7688e90a..310c2ad1e 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCentrifuge.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCentrifuge.java @@ -1,11 +1,13 @@ package com.hbm.tileentity.machine; import com.hbm.inventory.recipes.CentrifugeRecipes; +import com.hbm.inventory.recipes.GasCentrifugeRecipes.PseudoFluidType; 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.IBatteryItem; import api.hbm.energy.IEnergyUser; @@ -23,11 +25,9 @@ import net.minecraft.util.AxisAlignedBB; //TODO: move this trash to TileEntityMachineBase //no seriously, this is dreadful -public class TileEntityMachineCentrifuge extends TileEntity implements ISidedInventory, IEnergyUser { - - private ItemStack slots[]; - - public int dualCookTime; +public class TileEntityMachineCentrifuge extends TileEntityMachineBase implements ISidedInventory, IEnergyUser { + + public int progress; public long power; public boolean isProgressing; public static final int maxPower = 100000; @@ -37,77 +37,14 @@ public class TileEntityMachineCentrifuge extends TileEntity implements ISidedInv private static final int[] slots_bottom = new int[] { 2, 3, 4, 5 }; private static final int[] slots_side = new int[] { 0, 1 }; - private String customName; - public TileEntityMachineCentrifuge() { - slots = new ItemStack[6]; + super(6); } - - @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.centrifuge"; - } - - @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() { + + public String getName() { + return "container.centrifuge"; } + @Override public boolean isItemValidForSlot(int i, ItemStack itemStack) { @@ -122,32 +59,13 @@ public class TileEntityMachineCentrifuge extends TileEntity implements ISidedInv return !(itemStack.getItem() instanceof IBatteryItem); } - @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; - } - } - @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); NBTTagList list = nbt.getTagList("items", 10); - power = nbt.getLong("powerTime"); - dualCookTime = nbt.getShort("CookTime"); + power = nbt.getLong("power"); + progress = nbt.getShort("progress"); slots = new ItemStack[getSizeInventory()]; for(int i = 0; i < list.tagCount(); i++) { @@ -162,8 +80,8 @@ public class TileEntityMachineCentrifuge extends TileEntity implements ISidedInv @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - nbt.setLong("powerTime", power); - nbt.setShort("cookTime", (short) dualCookTime); + nbt.setLong("power", power); + nbt.setShort("progress", (short) progress); NBTTagList list = new NBTTagList(); for(int i = 0; i < slots.length; i++) { @@ -177,23 +95,13 @@ public class TileEntityMachineCentrifuge extends TileEntity implements ISidedInv nbt.setTag("items", list); } - @Override - public int[] getAccessibleSlotsFromSide(int p_94128_1_) { - return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 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 j != 0 || i != 1; } public int getCentrifugeProgressScaled(int i) { - return (dualCookTime * i) / processingSpeed; + return (progress * i) / processingSpeed; } public long getPowerRemainingScaled(int i) { @@ -253,9 +161,15 @@ public class TileEntityMachineCentrifuge extends TileEntity implements ISidedInv } public boolean isProcessing() { - return this.dualCookTime > 0; + return this.progress > 0; } - + + public void networkUnpack(NBTTagCompound data) { + this.power = data.getLong("power"); + this.progress = data.getInteger("progress"); + this.isProgressing = data.getBoolean("isProgressing"); + } + @Override public void updateEntity() { @@ -279,26 +193,27 @@ public class TileEntityMachineCentrifuge extends TileEntity implements ISidedInv isProgressing = false; } + NBTTagCompound data = new NBTTagCompound(); + data.setLong("power", power); + data.setInteger("progress", progress); + data.setBoolean("isProgressing", isProgressing); + 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, dualCookTime, 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)); } if(hasPower() && canProcess()) { - dualCookTime++; + progress++; - if(this.dualCookTime >= TileEntityMachineCentrifuge.processingSpeed) { - this.dualCookTime = 0; + if(this.progress >= TileEntityMachineCentrifuge.processingSpeed) { + this.progress = 0; this.processItem(); } } else { - dualCookTime = 0; + progress = 0; } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java index 30e6c37e8..e204f579f 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java @@ -52,8 +52,6 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I private static final int[] slots_bottom = new int[] {2, 3, 4}; private static final int[] slots_side = new int[] { }; - private String customName; - public TileEntityMachineGasCent() { super(6); tank = new FluidTank(FluidType.UF6, 2000, 0); @@ -236,6 +234,7 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I public void networkUnpack(NBTTagCompound data) { this.power = data.getLong("power"); this.progress = data.getInteger("progress"); + this.isProgressing = data.getBoolean("isProgressing"); this.inputTank.setTankType(PseudoFluidType.valueOf(data.getString("inputType"))); this.outputTank.setTankType(PseudoFluidType.valueOf(data.getString("outputType"))); this.inputTank.setFill(data.getInteger("inputFill")); @@ -304,6 +303,7 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I NBTTagCompound data = new NBTTagCompound(); data.setLong("power", power); data.setInteger("progress", progress); + data.setBoolean("isProgressing", isProgressing); data.setInteger("inputFill", inputTank.getFill()); data.setInteger("outputFill", outputTank.getFill()); data.setString("inputType", inputTank.getTankType().toString());