diff --git a/common/crazypants/enderio/machine/power/BlockCapacitorBank.java b/common/crazypants/enderio/machine/power/BlockCapacitorBank.java index 052e9bd9..294fd187 100644 --- a/common/crazypants/enderio/machine/power/BlockCapacitorBank.java +++ b/common/crazypants/enderio/machine/power/BlockCapacitorBank.java @@ -236,23 +236,30 @@ public class BlockCapacitorBank extends Block implements ITileEntityProvider, IG @Override public boolean removeBlockByPlayer(World world, EntityPlayer player, int x, int y, int z) { - if(!world.isRemote && (!player.capabilities.isCreativeMode || "true".equalsIgnoreCase(System.getProperty("blockCapBankAllwaysDrop")))) { + if(!world.isRemote) { TileEntity te = world.getBlockTileEntity(x, y, z); + if(te instanceof TileCapacitorBank) { TileCapacitorBank cb = (TileCapacitorBank) te; cb.onBreakBlock(); - ItemStack itemStack = - BlockItemCapacitorBank.createItemStackWithPower(cb.doGetEnergyStored()); - float f = 0.7F; - double d0 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; - double d1 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; - double d2 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; - EntityItem entityitem = new EntityItem(world, x + d0, y + d1, z + d2, itemStack); - entityitem.delayBeforeCanPickup = 10; - world.spawnEntityInWorld(entityitem); + // If we are not in Creative or blockCapBankAllwaysDrop is set to true, allow the item drop. + // This option allows creative players to pick up broken capacitor banks + + if (!player.capabilities.isCreativeMode || "true".equalsIgnoreCase(System.getProperty("blockCapBankAllwaysDrop"))) { + ItemStack itemStack = + BlockItemCapacitorBank.createItemStackWithPower(cb.doGetEnergyStored()); + float f = 0.7F; + double d0 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; + double d1 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; + double d2 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; + EntityItem entityitem = new EntityItem(world, x + d0, y + d1, z + d2, itemStack); + entityitem.delayBeforeCanPickup = 10; + world.spawnEntityInWorld(entityitem); + } } } + return super.removeBlockByPlayer(world, player, x, y, z); } diff --git a/common/crazypants/enderio/machine/power/TileCapacitorBank.java b/common/crazypants/enderio/machine/power/TileCapacitorBank.java index 46653ac1..f4106e27 100644 --- a/common/crazypants/enderio/machine/power/TileCapacitorBank.java +++ b/common/crazypants/enderio/machine/power/TileCapacitorBank.java @@ -745,6 +745,17 @@ public class TileCapacitorBank extends TileEntity implements IInternalPowerRecep mb[i] = new BlockCoord(blocks.get(i)); } + TileCapacitorBank secondary = blocks.get(1); + maxInput = maxOutput = -1; + + if (secondary.maxInput != secondary.maxIO) { + maxInput = secondary.maxInput; + } + + if (secondary.maxOutput != secondary.maxIO) { + maxOutput = secondary.maxOutput; + } + for (TileCapacitorBank cb : blocks) { cb.setMultiblock(mb); } @@ -762,7 +773,6 @@ public class TileCapacitorBank extends TileEntity implements IInternalPowerRecep } private void setMultiblock(BlockCoord[] mb) { - if(multiblock != null && isMaster()) { // split up current multiblock and reconfigure all the internal capacitors float powerPerBlock = storedEnergy / multiblock.length; @@ -771,8 +781,8 @@ public class TileCapacitorBank extends TileEntity implements IInternalPowerRecep if(cb != null) { cb.maxStoredEnergy = BASE_CAP.getMaxEnergyStored(); cb.maxIO = BASE_CAP.getMaxEnergyExtracted(); - cb.maxInput = cb.maxIO; - cb.maxOutput = cb.maxIO; + cb.maxInput = Math.min(cb.maxInput, cb.maxIO); + cb.maxOutput = Math.min(cb.maxOutput, cb.maxIO); cb.storedEnergy = powerPerBlock; cb.updatePowerHandler(); cb.multiblockDirty = true; @@ -805,14 +815,15 @@ public class TileCapacitorBank extends TileEntity implements IInternalPowerRecep storedEnergy = totalStored; maxStoredEnergy = totalCap; maxIO = totalIO; - maxInput = maxIO; - maxOutput = maxIO; + maxInput = maxInput < 0 ? maxIO : Math.min(maxInput, maxIO); + maxOutput = maxOutput < 0 ? maxIO : Math.min(maxOutput, maxIO); + for (BlockCoord bc : multiblock) { TileCapacitorBank cb = getCapBank(bc); - if(cb != null) { + if(cb != null && cb != this) { cb.maxIO = totalIO; - cb.maxInput = maxIO; - cb.maxOutput = maxIO; + cb.maxInput = maxInput; + cb.maxOutput = maxOutput; } } @@ -1003,7 +1014,7 @@ public class TileCapacitorBank extends TileEntity implements IInternalPowerRecep render = true; } } - + maxIO = nbtRoot.getInteger("maxIO"); if(nbtRoot.hasKey("maxInput")) { maxInput = nbtRoot.getInteger("maxInput"); diff --git a/resources/assets/enderio/lang/en_US.lang b/resources/assets/enderio/lang/en_US.lang index bada3cf2..49a57903 100644 --- a/resources/assets/enderio/lang/en_US.lang +++ b/resources/assets/enderio/lang/en_US.lang @@ -173,7 +173,7 @@ enderio.gui.capBank.inputRs=Input Redstone Mode enderio.gui.capBank.outputRs=Output Redstone Mode enderio.gui.capBank.maxIo=Max I/O enderio.gui.capBank.maxInput=Max Input -enderio.gui.capBank.maxOutput=Max Ouput +enderio.gui.capBank.maxOutput=Max Output //Transceiver enderio.gui.trans.publicChannel=Public Channel