General cleanup
This commit is contained in:
parent
88da994a27
commit
f0e5c7c468
9 changed files with 25 additions and 30 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -30,8 +30,6 @@ import cpw.mods.fml.common.FMLCommonHandler;
|
|||
|
||||
public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
|
||||
{
|
||||
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<TileEntity, EnergyNetwork>
|
|||
|
||||
if(acceptor instanceof IStrictEnergyAcceptor)
|
||||
{
|
||||
sent += (currentSending - ((IStrictEnergyAcceptor)acceptor).transferEnergyToAcceptor(side.getOpposite(), currentSending));
|
||||
sent += ((IStrictEnergyAcceptor)acceptor).transferEnergyToAcceptor(side.getOpposite(), currentSending);
|
||||
}
|
||||
else if(acceptor instanceof IEnergyHandler)
|
||||
{
|
||||
|
|
|
@ -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)");
|
||||
|
|
|
@ -323,13 +323,13 @@ public class PartUniversalCable extends PartTransmitter<EnergyNetwork> implement
|
|||
{
|
||||
if(!canReceiveEnergy(side))
|
||||
{
|
||||
return amount;
|
||||
return 0;
|
||||
}
|
||||
|
||||
double toUse = Math.min(getMaxEnergy()-getEnergy(), amount);
|
||||
setEnergy(getEnergy() + toUse);
|
||||
|
||||
return amount-toUse;
|
||||
return toUse;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -317,7 +317,7 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
|
|||
{
|
||||
if(getInv() == null)
|
||||
{
|
||||
return amount;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return getInv().transferEnergyToAcceptor(side, amount);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -94,7 +94,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IPe
|
|||
protected EnumSet<ForgeDirection> getConsumingSides()
|
||||
{
|
||||
EnumSet set = EnumSet.allOf(ForgeDirection.class);
|
||||
set.remove(getOutputtingSides());
|
||||
set.removeAll(getOutputtingSides());
|
||||
set.remove(ForgeDirection.UNKNOWN);
|
||||
|
||||
return set;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue