Merge branch 'development' of https://github.com/aidancbrady/Mekanism into development

This commit is contained in:
Aidan Brady 2014-01-09 08:40:27 -05:00
commit e113af9dd1
10 changed files with 36 additions and 32 deletions

View file

@ -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);

View file

@ -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)
{

View file

@ -498,10 +498,10 @@ public class Mekanism
"ACA", "ERE", "ACA", Character.valueOf('C'), "circuitBasic", Character.valueOf('A'), AtomicCore, Character.valueOf('E'), new ItemStack(BasicBlock, 1, 8), Character.valueOf('R'), new ItemStack(MachineBlock, 1, 9)
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MachineBlock2, 1, 4), new Object[] {
"IRI", "ECE", "IRI", Character.valueOf('I'), Item.ingotIron, Character.valueOf('R'), Item.redstone, Character.valueOf('E'), Mekanism.EnrichedAlloy, Character.valueOf('C'), ElectrolyticCore
"IRI", "ECE", "IRI", Character.valueOf('I'), Item.ingotIron, Character.valueOf('R'), Item.redstone, Character.valueOf('E'), Mekanism.EnrichedAlloy, Character.valueOf('C'), ElectrolyticCore
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(ElectrolyticCore), new Object[] {
"EPE", "IEG", "EPE", Character.valueOf('E'), Mekanism.EnrichedAlloy, Character.valueOf('P'), "dustOsmium", Character.valueOf('I'), "dustIron", Character.valueOf('G'), "dustGold"
"EPE", "IEG", "EPE", Character.valueOf('E'), Mekanism.EnrichedAlloy, Character.valueOf('P'), "dustOsmium", Character.valueOf('I'), "dustIron", Character.valueOf('G'), "dustGold"
}));
@ -524,6 +524,15 @@ public class Mekanism
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(PartTransmitter, 8, 0), new Object[] {
"SRS", Character.valueOf('S'), "ingotSteel", Character.valueOf('R'), Item.redstone
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(PartTransmitter, 1, 1), new Object[] {
"ETE", Character.valueOf('E'), EnrichedAlloy, Character.valueOf('T'), new ItemStack(PartTransmitter, 8, 0)
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(PartTransmitter, 1, 2), new Object[] {
"CTC", Character.valueOf('C'), "circuitBasic", Character.valueOf('T'), new ItemStack(PartTransmitter, 8, 1)
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(PartTransmitter, 1, 3), new Object[] {
"CTC", Character.valueOf('C'), AtomicCore, Character.valueOf('T'), new ItemStack(PartTransmitter, 8, 2)
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(PartTransmitter, 8, 4), new Object[] {
"SBS", Character.valueOf('S'), "ingotSteel", Character.valueOf('B'), Item.bucketEmpty
}));

View file

@ -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)");

View file

@ -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

View file

@ -317,7 +317,7 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
{
if(getInv() == null)
{
return amount;
return 0;
}
return getInv().transferEnergyToAcceptor(side, amount);

View file

@ -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

View file

@ -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;

View file

@ -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)

View file

@ -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));