Skip to content

Commit

Permalink
RF Node Update
Browse files Browse the repository at this point in the history
  • Loading branch information
hilburn committed Dec 7, 2014
1 parent 129f3f5 commit feafee9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ version.forge=10.13.2.1231
version.minecraft=1.7.10
version.mod.major=0
version.mod.minor=5
version.mod.revis=2
version.mod.revis=4
version.nei=1.0.3.62
24 changes: 21 additions & 3 deletions src/main/java/stevesaddons/tileentities/TileEntityRFNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ private void loadManagers()
{
TileEntity te = worldObj.getTileEntity(manager.getX(), manager.getY(), manager.getZ());
if (te instanceof TileEntityManager)
managers.add((TileEntityManager) te);
{
TileEntityManager tileEntityManager = (TileEntityManager) te;
tileEntityManager.updateInventories();
managers.add(tileEntityManager);
}
}
}
addManagers=null;
Expand Down Expand Up @@ -198,9 +202,16 @@ public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate)
if (from != ForgeDirection.UNKNOWN)
{
if (!inputSides[from.ordinal()]) return 0;
Set<TileEntityRFNode> outputs = new HashSet<TileEntityRFNode>();
int outputPacket = toReceive/connections.size();
for (TileEntityRFNode connected : connections)
{
toReceive-=connected.receiveEnergy(ForgeDirection.UNKNOWN,toReceive,simulate);
if (connected.receiveEnergy(ForgeDirection.UNKNOWN,outputPacket,true)>0) outputs.add(connected);
}
outputPacket = maxReceive/outputs.size();
for (TileEntityRFNode connected : outputs)
{
toReceive-=connected.receiveEnergy(ForgeDirection.UNKNOWN,outputPacket,simulate);
if (toReceive==0) return maxReceive;
}
}
Expand Down Expand Up @@ -229,9 +240,16 @@ public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate)
if (from != ForgeDirection.UNKNOWN)
{
if (!outputSides[from.ordinal()]) return 0;
int outputPacket = toExtract/connections.size();
Set<TileEntityRFNode> inputs = new HashSet<TileEntityRFNode>();
for (TileEntityRFNode connected : connections)
{
toExtract-=connected.extractEnergy(ForgeDirection.UNKNOWN,toExtract,simulate);
if (connected.extractEnergy(ForgeDirection.UNKNOWN,outputPacket,true)>0) inputs.add(connected);
}
outputPacket = toExtract/inputs.size();
for (TileEntityRFNode connected : inputs)
{
toExtract-=connected.extractEnergy(ForgeDirection.UNKNOWN,outputPacket,simulate);
if (toExtract==0) return maxExtract;
}
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit feafee9

Please sign in to comment.