This commit is contained in:
Aidan Brady 2013-11-29 13:04:39 -05:00
parent 82bae6e4bd
commit 20162970d8
7 changed files with 70 additions and 49 deletions

View file

@ -45,6 +45,12 @@ public class GasNetwork extends DynamicNetwork<IGasAcceptor, GasNetwork>
{ {
if(net != null) if(net != null)
{ {
if(net.refGas != null && net.gasScale > gasScale)
{
refGas = net.refGas;
gasScale = net.gasScale;
}
addAllTransmitters(net.transmitters); addAllTransmitters(net.transmitters);
net.deregister(); net.deregister();
} }
@ -267,18 +273,12 @@ public class GasNetwork extends DynamicNetwork<IGasAcceptor, GasNetwork>
{ {
GasNetwork network = new GasNetwork(networks); GasNetwork network = new GasNetwork(networks);
for(GasNetwork iterNet : networks) if(refGas != null && gasScale > network.gasScale)
{ {
if(iterNet.refGas != null && iterNet.gasScale > network.gasScale) network.refGas = refGas;
{ network.gasScale = gasScale;
network.refGas = iterNet.refGas;
network.gasScale = iterNet.gasScale;
break;
}
} }
System.out.println(network.gasScale);
return network; return network;
} }

View file

@ -152,7 +152,6 @@ public class RenderLogisticalTransporter extends TileEntitySpecialRenderer
{ {
int mode = ((TileEntityDiversionTransporter)tileEntity).modes[pos.sideHit]; int mode = ((TileEntityDiversionTransporter)tileEntity).modes[pos.sideHit];
ForgeDirection side = ForgeDirection.getOrientation(pos.sideHit); ForgeDirection side = ForgeDirection.getOrientation(pos.sideHit);
int offset = MekanismUtils.getSideOffset(side);
push(); push();
@ -161,7 +160,7 @@ public class RenderLogisticalTransporter extends TileEntitySpecialRenderer
bindTexture(mode == 0 ? MekanismRenderer.getItemsTexture() : MekanismRenderer.getBlocksTexture()); bindTexture(mode == 0 ? MekanismRenderer.getItemsTexture() : MekanismRenderer.getBlocksTexture());
GL11.glTranslatef((float)x, (float)y, (float)z); GL11.glTranslatef((float)x, (float)y, (float)z);
GL11.glScalef(0.5F, 0.5F, 0.5F); GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glTranslatef(0.5F*Math.abs(offset), 0.5F*Math.abs(offset), 0.5F*Math.abs(offset)); GL11.glTranslatef(0.5F, 0.5F, 0.5F);
int display = getOverlayDisplay(world, side, mode).display; int display = getOverlayDisplay(world, side, mode).display;
GL11.glCallList(display); GL11.glCallList(display);

View file

@ -57,6 +57,14 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
{ {
if(net != null) if(net != null)
{ {
if(net.joulesLastTick > joulesLastTick || net.clientEnergyScale > clientEnergyScale)
{
clientEnergyScale = net.clientEnergyScale;
joulesLastTick = net.joulesLastTick;
joulesTransmitted = net.joulesTransmitted;
lastPowerScale = net.lastPowerScale;
}
addAllTransmitters(net.transmitters); addAllTransmitters(net.transmitters);
net.deregister(); net.deregister();
} }
@ -421,6 +429,9 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
{ {
EnergyNetwork network = new EnergyNetwork(varTransmitters); EnergyNetwork network = new EnergyNetwork(varTransmitters);
network.clientEnergyScale = clientEnergyScale; network.clientEnergyScale = clientEnergyScale;
network.joulesLastTick = joulesLastTick;
network.joulesTransmitted = joulesTransmitted;
network.lastPowerScale = lastPowerScale;
return network; return network;
} }
@ -429,6 +440,9 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
{ {
EnergyNetwork network = new EnergyNetwork(collection); EnergyNetwork network = new EnergyNetwork(collection);
network.clientEnergyScale = clientEnergyScale; network.clientEnergyScale = clientEnergyScale;
network.joulesLastTick = joulesLastTick;
network.joulesTransmitted = joulesTransmitted;
network.lastPowerScale = lastPowerScale;
return network; return network;
} }
@ -436,14 +450,13 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
protected EnergyNetwork create(Set<EnergyNetwork> networks) protected EnergyNetwork create(Set<EnergyNetwork> networks)
{ {
EnergyNetwork network = new EnergyNetwork(networks); EnergyNetwork network = new EnergyNetwork(networks);
network.clientEnergyScale = clientEnergyScale;
for(EnergyNetwork iterNet : networks) if(joulesLastTick > network.joulesLastTick || clientEnergyScale > network.clientEnergyScale)
{ {
if(iterNet.clientEnergyScale > network.clientEnergyScale) network.clientEnergyScale = clientEnergyScale;
{ network.joulesLastTick = joulesLastTick;
network.clientEnergyScale = iterNet.clientEnergyScale; network.joulesTransmitted = joulesTransmitted;
} network.lastPowerScale = lastPowerScale;
} }
return network; return network;

View file

@ -52,6 +52,12 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
{ {
if(net != null) if(net != null)
{ {
if(net.refFluid != null && net.fluidScale > fluidScale)
{
refFluid = net.refFluid;
fluidScale = net.fluidScale;
}
addAllTransmitters(net.transmitters); addAllTransmitters(net.transmitters);
net.deregister(); net.deregister();
} }
@ -288,17 +294,11 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
protected FluidNetwork create(Set<FluidNetwork> networks) protected FluidNetwork create(Set<FluidNetwork> networks)
{ {
FluidNetwork network = new FluidNetwork(networks); FluidNetwork network = new FluidNetwork(networks);
network.refFluid = refFluid;
network.fluidScale = fluidScale;
for(FluidNetwork iterNet : networks) if(refFluid != null && fluidScale > network.fluidScale)
{ {
if(iterNet.refFluid != null && iterNet.fluidScale > network.fluidScale) network.refFluid = refFluid;
{ network.fluidScale = fluidScale;
network.refFluid = iterNet.refFluid;
network.fluidScale = iterNet.fluidScale;
break;
}
} }
return network; return network;

View file

@ -434,7 +434,7 @@ public class Mekanism
"ACA", "SES", "TIT", Character.valueOf('A'), AtomicCore, Character.valueOf('C'), "circuitBasic", Character.valueOf('S'), new ItemStack(MachineBlock, 1, 15), Character.valueOf('E'), Robit.getUnchargedItem(), "ACA", "SES", "TIT", Character.valueOf('A'), AtomicCore, Character.valueOf('C'), "circuitBasic", Character.valueOf('S'), new ItemStack(MachineBlock, 1, 15), Character.valueOf('E'), Robit.getUnchargedItem(),
Character.valueOf('I'), new ItemStack(BasicBlock, 1, 8), Character.valueOf('T'), TeleportationCore Character.valueOf('I'), new ItemStack(BasicBlock, 1, 8), Character.valueOf('T'), TeleportationCore
})); }));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(Transmitter, 1, 4), new Object[] { CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(Transmitter, 1, 5), new Object[] {
"RRR", "SBS", "RRR", Character.valueOf('R'), Item.redstone, Character.valueOf('S'), "ingotSteel", Character.valueOf('B'), Block.fenceIron "RRR", "SBS", "RRR", Character.valueOf('R'), Item.redstone, Character.valueOf('S'), "ingotSteel", Character.valueOf('B'), Block.fenceIron
})); }));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MachineBlock2, 1, 0), new Object[] { CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MachineBlock2, 1, 0), new Object[] {

View file

@ -137,7 +137,7 @@ public class TileEntityElectricChest extends TileEntityElectricBlock
{ {
if(side == 0 || !canAccess()) if(side == 0 || !canAccess())
{ {
return null; return new int[0];
} }
else { else {
int[] ret = new int[55]; int[] ret = new int[55];

View file

@ -462,6 +462,11 @@ public final class MekanismUtils
return hasResource; return hasResource;
} }
/**
* Gets the ore dictionary name of a defined ItemStack.
* @param check - ItemStack to check OreDict name of
* @return OreDict name
*/
public static String getOreDictName(ItemStack check) public static String getOreDictName(ItemStack check)
{ {
HashMap<Integer, ArrayList<ItemStack>> oreStacks = (HashMap<Integer, ArrayList<ItemStack>>)MekanismUtils.getPrivateValue(null, OreDictionary.class, new String[] {"oreStacks"}); HashMap<Integer, ArrayList<ItemStack>> oreStacks = (HashMap<Integer, ArrayList<ItemStack>>)MekanismUtils.getPrivateValue(null, OreDictionary.class, new String[] {"oreStacks"});
@ -531,6 +536,11 @@ public final class MekanismUtils
return side; return side;
} }
/**
* Localizes the defined string.
* @param s - string to localized
* @return localized string
*/
public static String localize(String s) public static String localize(String s)
{ {
return StatCollector.translateToLocal(s); return StatCollector.translateToLocal(s);
@ -556,6 +566,11 @@ public final class MekanismUtils
} }
} }
/**
* Decrements the output type of a machine's side.
* @param config - configurable machine
* @param side - side to increment output of
*/
public static void decrementOutput(IConfigurable config, int side) public static void decrementOutput(IConfigurable config, int side)
{ {
int max = config.getSideData().size()-1; int max = config.getSideData().size()-1;
@ -623,6 +638,14 @@ public final class MekanismUtils
} }
} }
/**
* Places a fake advanced bounding block at the defined location.
* @param world - world to place block in
* @param x - x coordinate
* @param y - y coordinate
* @param z - z coordinate
* @param orig - original block
*/
public static void makeAdvancedBoundingBlock(World world, int x, int y, int z, Object3D orig) public static void makeAdvancedBoundingBlock(World world, int x, int y, int z, Object3D orig)
{ {
world.setBlock(x, y, z, Mekanism.BoundingBlock.blockID, 1, 3); world.setBlock(x, y, z, Mekanism.BoundingBlock.blockID, 1, 3);
@ -1004,6 +1027,10 @@ public final class MekanismUtils
return didRemove; return didRemove;
} }
/**
* Marks the chunk this TileEntity is in as modified. Call this method to be sure NBT is written by the defined tile entity.
* @param tileEntity - TileEntity to save
*/
public static void saveChunk(TileEntity tileEntity) public static void saveChunk(TileEntity tileEntity)
{ {
if(tileEntity == null || tileEntity.isInvalid() || tileEntity.worldObj == null) if(tileEntity == null || tileEntity.isInvalid() || tileEntity.worldObj == null)
@ -1036,11 +1063,11 @@ public final class MekanismUtils
} }
else if(control.getControlType() == RedstoneControl.HIGH) else if(control.getControlType() == RedstoneControl.HIGH)
{ {
return world.getBlockPowerInput(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord) > 0; return world.isBlockIndirectlyGettingPowered(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
} }
else if(control.getControlType() == RedstoneControl.LOW) else if(control.getControlType() == RedstoneControl.LOW)
{ {
return world.getBlockPowerInput(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord) == 0; return !world.isBlockIndirectlyGettingPowered(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
} }
return false; return false;
@ -1057,7 +1084,7 @@ public final class MekanismUtils
return world.rayTraceBlocks_do_do(headVec, endVec, true, false); return world.rayTraceBlocks_do_do(headVec, endVec, true, false);
} }
public static Vec3 getHeadVec(EntityPlayer player) private static Vec3 getHeadVec(EntityPlayer player)
{ {
Vec3 vec = Vec3.createVectorHelper(player.posX, player.posY, player.posZ); Vec3 vec = Vec3.createVectorHelper(player.posX, player.posY, player.posZ);
@ -1084,24 +1111,6 @@ public final class MekanismUtils
return Mekanism.hooks.BuildCraftLoaded || Mekanism.forceBuildcraft; return Mekanism.hooks.BuildCraftLoaded || Mekanism.forceBuildcraft;
} }
public static int getSideOffset(ForgeDirection side)
{
if(side.offsetX != 0)
{
return side.offsetX;
}
else if(side.offsetY != 0)
{
return side.offsetY;
}
else if(side.offsetZ != 0)
{
return side.offsetZ;
}
return 0;
}
public static enum ResourceType public static enum ResourceType
{ {
GUI("gui"), GUI("gui"),