diff --git a/common/mekanism/api/energy/IStrictEnergyAcceptor.java b/common/mekanism/api/energy/IStrictEnergyAcceptor.java index 74586eb39..6d5224bde 100644 --- a/common/mekanism/api/energy/IStrictEnergyAcceptor.java +++ b/common/mekanism/api/energy/IStrictEnergyAcceptor.java @@ -12,7 +12,7 @@ public interface IStrictEnergyAcceptor extends IStrictEnergyStorage /** * Transfer a certain amount of energy to this acceptor. * @param amount - amount to transfer - * @return rejects + * @return energy used */ public double transferEnergyToAcceptor(ForgeDirection side, double amount); diff --git a/common/mekanism/common/EnergyNetwork.java b/common/mekanism/common/EnergyNetwork.java index cddc8260f..d761af529 100644 --- a/common/mekanism/common/EnergyNetwork.java +++ b/common/mekanism/common/EnergyNetwork.java @@ -30,8 +30,6 @@ import cpw.mods.fml.common.FMLCommonHandler; public class EnergyNetwork extends DynamicNetwork { - public static final int CABLE_ENERGY = 10000; - private double lastPowerScale = 0; private double joulesTransmitted = 0; private double jouleBufferLastTick = 0; @@ -199,7 +197,7 @@ public class EnergyNetwork extends DynamicNetwork if(acceptor instanceof IStrictEnergyAcceptor) { - sent += (currentSending - ((IStrictEnergyAcceptor)acceptor).transferEnergyToAcceptor(side.getOpposite(), currentSending)); + sent += ((IStrictEnergyAcceptor)acceptor).transferEnergyToAcceptor(side.getOpposite(), currentSending); } else if(acceptor instanceof IEnergyHandler) { diff --git a/common/mekanism/common/multipart/ItemPartTransmitter.java b/common/mekanism/common/multipart/ItemPartTransmitter.java index ebbed86b2..55569d9fa 100644 --- a/common/mekanism/common/multipart/ItemPartTransmitter.java +++ b/common/mekanism/common/multipart/ItemPartTransmitter.java @@ -89,12 +89,10 @@ public class ItemPartTransmitter extends JItemMultiPart else { switch(itemstack.getItemDamage()) { - case 0: - case 1: - case 2: - case 3: + case 0: case 1: case 2: case 3: { list.add(EnumColor.DARK_GREY + "Capable of transferring:"); + list.add("- " + EnumColor.PURPLE + "RF " + EnumColor.GREY + "(ThermalExpansion)"); list.add("- " + EnumColor.PURPLE + "EU " + EnumColor.GREY + "(IndustrialCraft)"); list.add("- " + EnumColor.PURPLE + "MJ " + EnumColor.GREY + "(BuildCraft)"); list.add("- " + EnumColor.PURPLE + "Joules " + EnumColor.GREY + "(Mekanism)"); diff --git a/common/mekanism/common/multipart/PartUniversalCable.java b/common/mekanism/common/multipart/PartUniversalCable.java index 880135c46..94aa47795 100644 --- a/common/mekanism/common/multipart/PartUniversalCable.java +++ b/common/mekanism/common/multipart/PartUniversalCable.java @@ -323,13 +323,13 @@ public class PartUniversalCable extends PartTransmitter implement { if(!canReceiveEnergy(side)) { - return amount; + return 0; } double toUse = Math.min(getMaxEnergy()-getEnergy(), amount); setEnergy(getEnergy() + toUse); - return amount-toUse; + return toUse; } @Override diff --git a/common/mekanism/common/tile/TileEntityAdvancedBoundingBlock.java b/common/mekanism/common/tile/TileEntityAdvancedBoundingBlock.java index 18ad99943..6f0457f5e 100644 --- a/common/mekanism/common/tile/TileEntityAdvancedBoundingBlock.java +++ b/common/mekanism/common/tile/TileEntityAdvancedBoundingBlock.java @@ -317,7 +317,7 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp { if(getInv() == null) { - return amount; + return 0; } return getInv().transferEnergyToAcceptor(side, amount); diff --git a/common/mekanism/common/tile/TileEntityElectricBlock.java b/common/mekanism/common/tile/TileEntityElectricBlock.java index 51067868b..e68a44f1e 100644 --- a/common/mekanism/common/tile/TileEntityElectricBlock.java +++ b/common/mekanism/common/tile/TileEntityElectricBlock.java @@ -341,7 +341,7 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i return i; } - return transferEnergyToAcceptor(direction, i*Mekanism.FROM_IC2)*Mekanism.TO_IC2; + return i-transferEnergyToAcceptor(direction, i*Mekanism.FROM_IC2)*Mekanism.TO_IC2; } @Override @@ -349,13 +349,13 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i { if(!getConsumingSides().contains(side)) { - return amount; + return 0; } double toUse = Math.min(getMaxEnergy()-getEnergy(), amount); setEnergy(getEnergy() + toUse); - return amount-toUse; + return toUse; } @Override diff --git a/common/mekanism/common/tile/TileEntityEnergyCube.java b/common/mekanism/common/tile/TileEntityEnergyCube.java index 5099f5f87..566eaef5a 100644 --- a/common/mekanism/common/tile/TileEntityEnergyCube.java +++ b/common/mekanism/common/tile/TileEntityEnergyCube.java @@ -94,7 +94,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IPe protected EnumSet getConsumingSides() { EnumSet set = EnumSet.allOf(ForgeDirection.class); - set.remove(getOutputtingSides()); + set.removeAll(getOutputtingSides()); set.remove(ForgeDirection.UNKNOWN); return set; diff --git a/common/mekanism/common/util/CableUtils.java b/common/mekanism/common/util/CableUtils.java index 2d06f4b73..b906ea9af 100644 --- a/common/mekanism/common/util/CableUtils.java +++ b/common/mekanism/common/util/CableUtils.java @@ -290,7 +290,8 @@ public final class CableUtils if(acceptor.canReceiveEnergy(side.getOpposite())) { - sent += (sendingEnergy - acceptor.transferEnergyToAcceptor(side.getOpposite(), sendingEnergy)); + double prev = sent; + sent += acceptor.transferEnergyToAcceptor(side.getOpposite(), sendingEnergy); } } else if(tileEntity instanceof IEnergyHandler) diff --git a/common/mekanism/tools/common/MekanismTools.java b/common/mekanism/tools/common/MekanismTools.java index cf499d4d1..3a4c2784d 100644 --- a/common/mekanism/tools/common/MekanismTools.java +++ b/common/mekanism/tools/common/MekanismTools.java @@ -581,22 +581,20 @@ public class MekanismTools implements IModule @ForgeSubscribe public void onLivingSpecialSpawn(LivingSpawnEvent event) { - Random random = new Random(); - - int chance = random.nextInt(100); - int secondChance = random.nextInt(4); + int chance = event.world.rand.nextInt(100); + int armorType = event.world.rand.nextInt(4); if(chance < 3) { if(event.entityLiving instanceof EntityZombie || event.entityLiving instanceof EntitySkeleton) { - int sword = random.nextInt(100); - int helmet = random.nextInt(100); - int chestplate = random.nextInt(100); - int leggings = random.nextInt(100); - int boots = random.nextInt(100); + int sword = event.world.rand.nextInt(100); + int helmet = event.world.rand.nextInt(100); + int chestplate = event.world.rand.nextInt(100); + int leggings = event.world.rand.nextInt(100); + int boots = event.world.rand.nextInt(100); - if(secondChance == 0) + if(armorType == 0) { if(event.entityLiving instanceof EntityZombie && sword < 50) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(GlowstoneSword)); if(helmet < 50) event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(GlowstoneHelmet)); @@ -604,7 +602,7 @@ public class MekanismTools implements IModule if(leggings < 50) event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(GlowstoneLeggings)); if(boots < 50) event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(GlowstoneBoots)); } - else if(secondChance == 1) + else if(armorType == 1) { if(event.entityLiving instanceof EntityZombie && sword < 50) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(LazuliSword)); if(helmet < 50) event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(LazuliHelmet)); @@ -612,7 +610,7 @@ public class MekanismTools implements IModule if(leggings < 50) event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(LazuliLeggings)); if(boots < 50) event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(LazuliBoots)); } - else if(secondChance == 2) + else if(armorType == 2) { if(event.entityLiving instanceof EntityZombie && sword < 50) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(OsmiumSword)); if(helmet < 50) event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(OsmiumHelmet)); @@ -620,7 +618,7 @@ public class MekanismTools implements IModule if(leggings < 50) event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(OsmiumLeggings)); if(boots < 50) event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(OsmiumBoots)); } - else if(secondChance == 3) + else if(armorType == 3) { if(event.entityLiving instanceof EntityZombie && sword < 50) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(SteelSword)); if(helmet < 50) event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(SteelHelmet)); @@ -628,7 +626,7 @@ public class MekanismTools implements IModule if(leggings < 50) event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(SteelLeggings)); if(boots < 50) event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(SteelBoots)); } - else if(secondChance == 4) + else if(armorType == 4) { if(event.entityLiving instanceof EntityZombie && sword < 50) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(BronzeSword)); if(helmet < 50) event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(BronzeHelmet));