imported classes from dark-library

This commit is contained in:
DarkGuardsman 2013-06-19 06:23:36 -04:00
parent 9184ec9414
commit 84ae6e0118
26 changed files with 1329 additions and 52 deletions

View file

@ -0,0 +1,31 @@
package dark.core.network.fluid;
import net.minecraftforge.liquids.LiquidStack;
public class FluidPressurePack implements Cloneable
{
public LiquidStack liquidStack;
public double pressure;
public FluidPressurePack(LiquidStack liquidStack, double voltage)
{
this.liquidStack = liquidStack;
this.pressure = voltage;
}
public FluidPressurePack()
{
this(new LiquidStack(0, 0, 0), 0);
}
@Override
public FluidPressurePack clone()
{
return new FluidPressurePack(this.liquidStack, this.pressure);
}
public boolean isEqual(FluidPressurePack electricityPack)
{
return this.liquidStack.isLiquidEqual(electricityPack.liquidStack) && this.pressure == electricityPack.pressure;
}
}

View file

@ -0,0 +1,43 @@
package dark.core.network.fluid;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ITankContainer;
import universalelectricity.core.vector.Vector3;
import universalelectricity.core.vector.VectorHelper;
import dark.core.api.INetworkPart;
import dark.core.tile.network.NetworkTileEntities;
import dark.fluid.api.IDrain;
public class HydraulicNetworkHelper
{
/**
* Invalidates a TileEntity
*/
public static void invalidate(TileEntity tileEntity)
{
for (int i = 0; i < 6; i++)
{
ForgeDirection direction = ForgeDirection.getOrientation(i);
TileEntity checkTile = VectorHelper.getConnectorFromSide(tileEntity.worldObj, new Vector3(tileEntity), direction);
if (checkTile instanceof INetworkPart)
{
NetworkTileEntities network = ((INetworkPart) checkTile).getTileNetwork();
if (network != null && network instanceof NetworkFluidTiles)
{
network.removeEntity(tileEntity);
for (ITankContainer tank : ((NetworkFluidTiles) network).connectedTanks)
{
if (tank instanceof IDrain)
{
((IDrain) tank).stopRequesting(tileEntity);
}
}
}
}
}
}
}

View file

@ -0,0 +1,165 @@
package dark.core.network.fluid;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.liquids.LiquidStack;
import dark.core.api.ColorCode;
import dark.core.api.INetworkPart;
import dark.core.tile.network.NetworkTileEntities;
import dark.fluid.api.INetworkFluidPart;
/**
* Side note: the network should act like this when done {@link http
* ://www.e4training.com/hydraulic_calculators/B1.htm} as well as stay compatible with the forge
* Liquids
*
* @author Rseifert
*
*/
public class NetworkFluidContainers extends NetworkFluidTiles
{
public NetworkFluidContainers(ColorCode color, INetworkPart... parts)
{
super(color, parts);
}
@Override
// TODO change this to place liquids at the bottom first
public void balanceColletiveTank(boolean sumParts)
{
int volume = 0, itemID = 0, itemMeta = 0;
if (sumParts)
{
for (INetworkPart par : this.networkMember)
{
if (par instanceof INetworkFluidPart)
{
INetworkFluidPart part = ((INetworkFluidPart) par);
if (part.getTank() != null && part.getTank().getLiquid() != null)
{
if (itemID == 0)
{
itemID = part.getTank().getLiquid().itemID;
itemMeta = part.getTank().getLiquid().itemMeta;
}
volume += part.getTank().getLiquid().amount;
}
}
}
this.combinedStorage().setLiquid(new LiquidStack(itemID, volume, itemMeta));
this.loadedLiquids = true;
}
if (this.combinedStorage().getLiquid() != null && this.getNetworkMemebers().size() > 0)
{
this.cleanUpConductors();
int lowestY = 255;
int highestY = 0;
for (INetworkPart part : this.getNetworkMemebers())
{
if (part instanceof TileEntity && ((TileEntity) part).yCoord < lowestY)
{
lowestY = ((TileEntity) part).yCoord;
}
if (part instanceof TileEntity && ((TileEntity) part).yCoord > highestY)
{
highestY = ((TileEntity) part).yCoord;
}
}
itemID = this.combinedStorage().getLiquid().itemID;
itemMeta = this.combinedStorage().getLiquid().itemMeta;
volume = this.combinedStorage().getLiquid().amount;
for (int y = lowestY; y <= highestY; y++)
{
List<INetworkFluidPart> parts = new ArrayList<INetworkFluidPart>();
for (INetworkPart part : this.getNetworkMemebers())
{
if (part instanceof INetworkFluidPart && ((TileEntity) part).yCoord == y)
{
parts.add((INetworkFluidPart) part);
}
}
int fillvolume = volume / parts.size();
for (INetworkFluidPart part : parts)
{
part.setTankContent(null);
int fill = Math.min(fillvolume, part.getTank().getCapacity());
part.setTankContent(new LiquidStack(itemID, fill, itemMeta));
volume -= fill;
}
if (volume <= 0)
{
break;
}
}
}
}
@Override
public int storeFluidInSystem(LiquidStack stack, boolean doFill)
{
int vol = this.combinedStorage().getLiquid() != null ? this.combinedStorage().getLiquid().amount : 0;
int filled = super.storeFluidInSystem(stack, doFill);
if (vol != filled)
{
for (INetworkPart part : this.getNetworkMemebers())
{
if (part instanceof TileEntity)
{
TileEntity ent = ((TileEntity) part);
ent.worldObj.markBlockForUpdate(ent.xCoord, ent.yCoord, ent.zCoord);
}
}
}
return filled;
}
@Override
public LiquidStack drainFluidFromSystem(int maxDrain, boolean doDrain)
{
LiquidStack vol = this.combinedStorage().getLiquid();
LiquidStack stack = super.drainFluidFromSystem(maxDrain, doDrain);
boolean flag = false;
if (vol != null)
{
if (stack == null)
{
flag = true;
}
else if (stack.amount != vol.amount)
{
flag = true;
}
}
if (flag)
{
for (INetworkPart part : this.getNetworkMemebers())
{
if (part instanceof TileEntity)
{
TileEntity ent = ((TileEntity) part);
ent.worldObj.markBlockForUpdate(ent.xCoord, ent.yCoord, ent.zCoord);
}
}
}
return stack;
}
@Override
public void postMergeProcessing(NetworkTileEntities network)
{
NetworkFluidContainers newNetwork = new NetworkFluidContainers(this.color);
newNetwork.getNetworkMemebers().addAll(this.getNetworkMemebers());
newNetwork.getNetworkMemebers().addAll(network.getNetworkMemebers());
newNetwork.cleanUpConductors();
newNetwork.balanceColletiveTank(true);
}
}

View file

@ -0,0 +1,347 @@
package dark.core.network.fluid;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidDictionary;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.liquids.LiquidTank;
import universalelectricity.core.path.Pathfinder;
import universalelectricity.core.vector.Vector3;
import dark.core.api.ColorCode;
import dark.core.api.INetworkPart;
import dark.core.hydraulic.helpers.FluidHelper;
import dark.core.tile.network.NetworkPathFinder;
import dark.core.tile.network.NetworkTileEntities;
import dark.fluid.api.INetworkFluidPart;
public class NetworkFluidTiles extends NetworkTileEntities
{
/* MACHINES THAT ARE FLUID BASED AND CONNECTED BUT NOT PART OF THE NETWORK ** */
public final List<ITankContainer> connectedTanks = new ArrayList<ITankContainer>();
/* COMBINED TEMP STORAGE FOR ALL PIPES IN THE NETWORK */
public LiquidTank sharedTank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME);
public ColorCode color = ColorCode.NONE;
protected boolean loadedLiquids = false;
public NetworkFluidTiles(ColorCode color, INetworkPart... parts)
{
super(parts);
this.color = color;
}
public LiquidTank combinedStorage()
{
if (this.sharedTank == null)
{
this.sharedTank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME);
this.balanceColletiveTank(true);
}
return this.sharedTank;
}
/**
* Stores Fluid in this network's collective tank
*/
public int storeFluidInSystem(LiquidStack stack, boolean doFill)
{
if (stack == null || this.combinedStorage().containsValidLiquid() && (this.combinedStorage().getLiquid() != null && !this.combinedStorage().getLiquid().isLiquidEqual(stack)))
{
return 0;
}
if (!loadedLiquids)
{
this.balanceColletiveTank(true);
}
if (this.combinedStorage().getLiquid() == null || this.combinedStorage().getLiquid().amount < this.combinedStorage().getCapacity())
{
int filled = this.combinedStorage().fill(stack, doFill);
if (doFill)
{
this.balanceColletiveTank(false);
}
return filled;
}
return 0;
}
/**
* Drains the network's collective tank
*/
public LiquidStack drainFluidFromSystem(int maxDrain, boolean doDrain)
{
if (!loadedLiquids)
{
this.balanceColletiveTank(true);
}
LiquidStack stack = this.combinedStorage().getLiquid();
if (stack != null)
{
stack = this.combinedStorage().getLiquid().copy();
if (maxDrain < stack.amount)
{
stack = FluidHelper.getStack(stack, maxDrain);
}
stack = this.combinedStorage().drain(maxDrain, doDrain);
if (doDrain)
{
this.balanceColletiveTank(false);
}
}
return stack;
}
/**
* Moves the volume stored in the network to the parts or sums up the volume from the parts and
* loads it to the network. Assumes that all liquidStacks stored are equal
*
* @param sumParts - loads the volume from the parts before leveling out the volumes
*/
public void balanceColletiveTank(boolean sumParts)
{
int volume = 0, itemID = 0, itemMeta = 0;
if (sumParts)
{
for (INetworkPart par : this.networkMember)
{
if (par instanceof INetworkFluidPart)
{
INetworkFluidPart part = ((INetworkFluidPart) par);
if (part.getTank() != null && part.getTank().getLiquid() != null)
{
if (itemID == 0)
{
itemID = part.getTank().getLiquid().itemID;
itemMeta = part.getTank().getLiquid().itemMeta;
}
volume += part.getTank().getLiquid().amount;
}
}
}
this.combinedStorage().setLiquid(new LiquidStack(itemID, volume, itemMeta));
this.loadedLiquids = true;
}
if (this.combinedStorage().getLiquid() != null && this.networkMember.size() > 0)
{
volume = this.combinedStorage().getLiquid().amount / this.networkMember.size();
itemID = this.combinedStorage().getLiquid().itemID;
itemMeta = this.combinedStorage().getLiquid().itemMeta;
for (INetworkPart par : this.networkMember)
{
if (par instanceof INetworkFluidPart)
{
INetworkFluidPart part = ((INetworkFluidPart) par);
part.setTankContent(null);
part.setTankContent(new LiquidStack(itemID, volume, itemMeta));
}
}
}
}
@Override
public void removeEntity(TileEntity ent)
{
super.removeEntity(ent);
this.connectedTanks.remove(ent);
}
@Override
public boolean addEntity(TileEntity ent, boolean member)
{
if (!(super.addEntity(ent, member)) && ent instanceof ITankContainer && !connectedTanks.contains(ent))
{
connectedTanks.add((ITankContainer) ent);
return true;
}
return false;
}
/**
* Checks too see if the tileEntity is part of or connected too the network
*/
public boolean isConnected(TileEntity tileEntity)
{
return this.connectedTanks.contains(tileEntity);
}
public boolean isPartOfNetwork(TileEntity ent)
{
return super.isPartOfNetwork(ent) || this.connectedTanks.contains(ent);
}
public void causingMixing(INetworkPart Fluid, LiquidStack stack, LiquidStack stack2)
{
// TODO cause mixing of liquids based on types and volume. Also apply damage to pipes/parts
// as needed
}
public void splitNetwork(World world, INetworkPart splitPoint)
{
if (splitPoint instanceof TileEntity)
{
this.getNetworkMemebers().remove(splitPoint);
this.balanceColletiveTank(false);
/**
* Loop through the connected blocks and attempt to see if there are connections between
* the two points elsewhere.
*/
TileEntity[] connectedBlocks = splitPoint.getNetworkConnections();
for (int i = 0; i < connectedBlocks.length; i++)
{
TileEntity connectedBlockA = connectedBlocks[i];
if (connectedBlockA instanceof INetworkPart)
{
for (int pipeCount = 0; pipeCount < connectedBlocks.length; pipeCount++)
{
final TileEntity connectedBlockB = connectedBlocks[pipeCount];
if (connectedBlockA != connectedBlockB && connectedBlockB instanceof INetworkPart)
{
Pathfinder finder = new NetworkPathFinder(world, (INetworkPart) connectedBlockB, splitPoint);
finder.init(new Vector3(connectedBlockA));
if (finder.results.size() > 0)
{
/* STILL CONNECTED SOMEWHERE ELSE */
for (Vector3 node : finder.closedSet)
{
TileEntity entity = node.getTileEntity(world);
if (entity instanceof INetworkPart)
{
if (node != splitPoint)
{
((INetworkPart) entity).setTileNetwork(this);
}
}
}
}
else
{
/* NO LONGER CONNECTED ELSE WHERE SO SPLIT AND REFRESH */
NetworkPipes newNetwork = new NetworkPipes(this.color);
int parts = 0;
for (Vector3 node : finder.closedSet)
{
TileEntity entity = node.getTileEntity(world);
if (entity instanceof INetworkPart)
{
if (node != splitPoint)
{
newNetwork.getNetworkMemebers().add((INetworkPart) entity);
parts++;
}
}
}
newNetwork.cleanUpConductors();
newNetwork.balanceColletiveTank(true);
}
}
}
}
}
}
}
@Override
public boolean preMergeProcessing(NetworkTileEntities net, INetworkPart part)
{
if (net instanceof NetworkFluidTiles && ((NetworkFluidTiles) net).color == this.color)
{
NetworkFluidTiles network = (NetworkFluidTiles) net;
this.balanceColletiveTank(true);
network.balanceColletiveTank(true);
LiquidStack stack = new LiquidStack(0, 0, 0);
if (this.combinedStorage().getLiquid() != null && network.combinedStorage().getLiquid() != null && this.combinedStorage().getLiquid().isLiquidEqual(network.combinedStorage().getLiquid()))
{
stack = this.combinedStorage().getLiquid();
stack.amount += network.combinedStorage().getLiquid().amount;
}
else if (this.combinedStorage().getLiquid() == null && network.combinedStorage().getLiquid() != null)
{
stack = network.combinedStorage().getLiquid();
}
else if (this.combinedStorage().getLiquid() != null && network.combinedStorage().getLiquid() == null)
{
stack = this.combinedStorage().getLiquid();
}
return true;
}
return false;
}
@Override
public void postMergeProcessing(NetworkTileEntities network)
{
NetworkFluidTiles newNetwork = new NetworkFluidTiles(this.color);
newNetwork.getNetworkMemebers().addAll(this.getNetworkMemebers());
newNetwork.getNetworkMemebers().addAll(network.getNetworkMemebers());
newNetwork.cleanUpConductors();
newNetwork.balanceColletiveTank(true);
}
@Override
public void cleanUpConductors()
{
if (!loadedLiquids)
{
this.balanceColletiveTank(true);
}
Iterator<INetworkPart> it = this.networkMember.iterator();
int capacity = 0;
while (it.hasNext())
{
INetworkPart part = it.next();
if (!this.isValidMember(part))
{
it.remove();
}
else
{
part.setTileNetwork(this);
if (part instanceof INetworkFluidPart)
{
capacity += ((INetworkFluidPart) part).getTank().getCapacity();
}
}
}
this.combinedStorage().setCapacity(capacity);
}
@Override
public boolean isValidMember(INetworkPart part)
{
return super.isValidMember(part) && part instanceof INetworkFluidPart && ((INetworkFluidPart) part).getColor() == this.color;
}
@Override
public String toString()
{
return "FluidNetwork[" + this.hashCode() + "|parts:" + this.networkMember.size() + "]";
}
public String getNetworkFluid()
{
int cap = combinedStorage().getCapacity() / LiquidContainerRegistry.BUCKET_VOLUME;
int vol = combinedStorage().getLiquid() != null ? (combinedStorage().getLiquid().amount / LiquidContainerRegistry.BUCKET_VOLUME) : 0;
String name = LiquidDictionary.findLiquidName(this.combinedStorage().getLiquid()) != null ? LiquidDictionary.findLiquidName(this.combinedStorage().getLiquid()) : "Unkown";
return String.format("%d/%d %S Stored", vol, cap, name);
}
}

View file

@ -0,0 +1,380 @@
package dark.core.network.fluid;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidStack;
import dark.core.api.ColorCode;
import dark.core.api.INetworkPart;
import dark.core.hydraulic.helpers.FluidRestrictionHandler;
import dark.core.tile.network.NetworkTileEntities;
import dark.fluid.api.INetworkPipe;
import dark.helpers.ConnectionHelper;
/**
* Side note: the network should act like this when done {@link http
* ://www.e4training.com/hydraulic_calculators/B1.htm} as well as stay compatible with the forge
* Liquids
*
* @author Rseifert
*
*/
public class NetworkPipes extends NetworkFluidTiles
{
/* MACHINES THAT USE THE PRESSURE SYSTEM TO DO WORK ** */
private final HashMap<TileEntity, FluidPressurePack> pressureProducers = new HashMap<TileEntity, FluidPressurePack>();
private final HashMap<TileEntity, FluidPressurePack> pressureLoads = new HashMap<TileEntity, FluidPressurePack>();
/* PRESSURE OF THE NETWORK AS A TOTAL. ZERO AS IN NO PRESSURE */
public double pressureProduced = 0, pressureLoad = 0;
/* IS IT PROCESSING AN ADD LIQUID EVENT */
private boolean processingRequest = false;
public NetworkPipes(ColorCode color, INetworkPart... parts)
{
super(color, parts);
}
public boolean isPartOfNetwork(TileEntity ent)
{
return super.isPartOfNetwork(ent) || this.pressureLoads.containsKey(ent) || this.pressureProducers.containsKey(ent);
}
/**
* sets this tileEntity to produce a pressure and flow rate in the network
*/
public void startProducingPressure(TileEntity tileEntity, FluidPressurePack fluidPack)
{
if (tileEntity != null && fluidPack.liquidStack != null)
{
if ((this.combinedStorage().getLiquid() == null || fluidPack.liquidStack.isLiquidEqual(this.combinedStorage().getLiquid())) && fluidPack.liquidStack.amount > 0)
{
this.pressureProducers.put(tileEntity, fluidPack);
}
}
}
/**
* sets this tileEntity to produce a pressure and flow rate in the network
*/
public void startProducingPressure(TileEntity tileEntity, LiquidStack stack, double pressure)
{
this.startProducingPressure(tileEntity, new FluidPressurePack(stack, pressure));
}
/**
* is this tile entity producing a pressure
*/
public boolean isProducingPressure(TileEntity tileEntity)
{
return this.pressureProducers.containsKey(tileEntity);
}
/**
* Sets this tile entity to act as a load on the system
*/
public void addLoad(TileEntity tileEntity, FluidPressurePack fluidPack)
{
if (tileEntity != null && fluidPack.liquidStack != null && fluidPack.liquidStack.amount > 0)
{
this.pressureLoads.put(tileEntity, fluidPack);
}
}
/**
* Sets this tile entity to act as a load on the system
*/
public void addLoad(TileEntity tileEntity, LiquidStack stack, double pressure)
{
this.addLoad(tileEntity, new FluidPressurePack(stack, pressure));
}
/**
* is this tileEntity a load in the network
*/
public boolean isLoad(TileEntity tileEntity)
{
return this.pressureLoads.containsKey(tileEntity);
}
/**
* @param ignoreTiles The TileEntities to ignore during this calculation. Null will make it not
* ignore any.
* @return The electricity produced in this electricity network
*/
public double getPressureProduced(TileEntity... ignoreTiles)
{
// TODO pressure is not added as a sum but rather as a collective sum of the largest
// pressures. IF the pressure is to small it will be ignored and stop producing pressure.
int totalPressure = 0;
Iterator it = this.pressureProducers.entrySet().iterator();
loop:
while (it.hasNext())
{
Map.Entry pairs = (Map.Entry) it.next();
if (pairs != null)
{
TileEntity tileEntity = (TileEntity) pairs.getKey();
if (tileEntity == null)
{
it.remove();
continue;
}
if (tileEntity.isInvalid())
{
it.remove();
continue;
}
if (tileEntity.worldObj.getBlockTileEntity(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord) != tileEntity)
{
it.remove();
continue;
}
if (ignoreTiles != null)
{
for (TileEntity ignoreTile : ignoreTiles)
{
if (tileEntity == ignoreTile)
{
continue loop;
}
}
}
FluidPressurePack pack = (FluidPressurePack) pairs.getValue();
if (pairs.getKey() != null && pairs.getValue() != null && pack != null)
{
totalPressure += pack.pressure;
}
}
}
return totalPressure;
}
@Override
public void removeEntity(TileEntity ent)
{
super.removeEntity(ent);
this.pressureLoads.remove(ent);
this.pressureProducers.remove(ent);
}
/**
* Adds FLuid to this network from one of the connected Pipes
*
* @param source - Were this liquid came from
* @param stack - LiquidStack to be sent
* @param doFill - actually fill the tank or just check numbers
* @return the amount of liquid consumed from the init stack
*/
public int addFluidToNetwork(TileEntity source, LiquidStack stack, boolean doFill)
{
return this.addFluidToNetwork(source, stack, doFill, false);
}
/**
* Adds FLuid to this network from one of the connected Pipes
*
* @param source - Were this liquid came from
* @param stack - LiquidStack to be sent
* @param doFill - actually fill the tank or just check numbers
* @param allowStore - allows the network to store this liquid in the pipes
* @return the amount of liquid consumed from the init stack
*/
public int addFluidToNetwork(TileEntity source, LiquidStack sta, boolean doFill, boolean allowStore)
{
int used = 0;
LiquidStack prevCombined = this.combinedStorage().getLiquid();
LiquidStack stack = sta.copy();
if (!this.processingRequest && stack != null && FluidRestrictionHandler.isValidLiquid(color,stack))
{
this.processingRequest = true;
if (this.combinedStorage().getLiquid() != null && !stack.isLiquidEqual(this.combinedStorage().getLiquid()))
{
this.causingMixing(null,this.combinedStorage().getLiquid(), stack);
}
if (stack.amount > this.getMaxFlow(stack))
{
stack = new LiquidStack(stack.itemID, this.getMaxFlow(stack), stack.itemMeta);
}
/* Main fill target to try to fill with the stack */
ITankContainer primaryFill = null;
int volume = Integer.MAX_VALUE;
ForgeDirection fillDir = ForgeDirection.UNKNOWN;
/* Secondary fill target if the main target is not found */
ITankContainer secondayFill = null;
int mostFill = 0;
ForgeDirection otherFillDir = ForgeDirection.UNKNOWN;
boolean found = false;
/* FIND THE FILL TARGET FROM THE LIST OF FLUID RECIEVERS */
for (ITankContainer tankContainer : connectedTanks)
{
if (tankContainer instanceof TileEntity && tankContainer != source && !(tankContainer instanceof INetworkPipe))
{
TileEntity[] connectedTiles = ConnectionHelper.getSurroundingTileEntities((TileEntity) tankContainer);
for (int i = 0; i < 6; i++)
{
if (connectedTiles[i] instanceof INetworkPipe && ((INetworkPipe) connectedTiles[i]).getTileNetwork() == this)
{
ForgeDirection dir = ForgeDirection.getOrientation(i).getOpposite();
ILiquidTank targetTank = tankContainer.getTank(dir, stack);
int fill = tankContainer.fill(dir, stack, false);
/* USE GET TANK FROM SIDE METHOD FIRST */
if (targetTank != null)
{
LiquidStack stackStored = targetTank.getLiquid();
if (stackStored == null)
{
primaryFill = tankContainer;
found = true;
fillDir = dir;
break;
}
else if (stackStored.amount < targetTank.getCapacity() && stackStored.amount < volume)
{
primaryFill = tankContainer;
volume = stackStored.amount;
}
}/* USE FILL METHOD IF GET TANK == NULL */
else if (fill > 0 && fill > mostFill)
{
secondayFill = tankContainer;
mostFill = fill;
otherFillDir = dir;
}
}
}
}
if (found)
{
break;
}
}// End of tank finder
boolean filledMain = false;
if (primaryFill != null)
{
used = primaryFill.fill(fillDir, stack, doFill);
// System.out.println("Primary Target " + used + doFill);
}
else if (secondayFill != null)
{
used = secondayFill.fill(fillDir, stack, doFill);
// System.out.println("Seconday Target " + used + doFill);
}
else if (allowStore)
{
used = this.storeFluidInSystem(stack, doFill);
// System.out.println("Network Target filled for " + used + doFill);
filledMain = true;
}
/* IF THE COMBINED STORAGE OF THE PIPES HAS LIQUID MOVE IT FIRST */
if (!filledMain && used > 0 && this.combinedStorage().getLiquid() != null && this.combinedStorage().getLiquid().amount > 0)
{
LiquidStack drainStack = new LiquidStack(0, 0, 0);
if (this.combinedStorage().getLiquid().amount >= used)
{
drainStack = this.combinedStorage().drain(used, doFill);
used = 0;
}
else
{
int pUsed = used;
used = Math.min(used, Math.max(used - this.combinedStorage().getLiquid().amount, 0));
drainStack = this.combinedStorage().drain(pUsed - used, doFill);
}
// System.out.println("Pulling " + (drainStack != null ? drainStack.amount : 0) +
// " from combined leaving " + (this.combinedStorage.getLiquid() != null ?
// this.combinedStorage.getLiquid().amount : 0));
}
if (prevCombined != null && this.combinedStorage().getLiquid() != null && prevCombined.amount != this.combinedStorage().getLiquid().amount)
{
this.balanceColletiveTank(false);
}
}
this.processingRequest = false;
return used;
}
/**
* Gets the flow rate of the system using the lowest flow rate
*/
public int getMaxFlow(LiquidStack stack)
{
int flow = 1000;
for (INetworkPart conductor : this.networkMember)
{
if (conductor instanceof INetworkPipe)
{
int cFlow = ((INetworkPipe) conductor).getMaxFlowRate(stack, ForgeDirection.UNKNOWN);
if (cFlow < flow)
{
flow = cFlow;
}
}
}
return flow;
}
/**
* Updates after the pressure has changed a good bit
*/
public void onPresureChange()
{
this.cleanUpConductors();
for (int i = 0; i < networkMember.size(); i++)
{
if (networkMember.get(i) instanceof INetworkPipe)
{
INetworkPipe part = (INetworkPipe) networkMember.get(i);
if (part.getMaxPressure(ForgeDirection.UNKNOWN) < this.pressureProduced && part.onOverPressure(true))
{
this.networkMember.remove(part);
this.cleanUpConductors();
}
}
}
}
@Override
public void postMergeProcessing(NetworkTileEntities network)
{
NetworkPipes newNetwork = new NetworkPipes(this.color);
newNetwork.getNetworkMemebers().addAll(this.getNetworkMemebers());
newNetwork.getNetworkMemebers().addAll(network.getNetworkMemebers());
newNetwork.cleanUpConductors();
newNetwork.balanceColletiveTank(true);
}
}

View file

@ -0,0 +1,44 @@
package dark.fluid.api;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidStack;
/**
* Interface to make or use the TileEntityDrain. In real life a drain would do nothing but act as an
* input or output for a pipe system. In code in order to interact with the pump the drain actual
* has to do the filling/draining for the pump. The pump only need to find the drain and tell it to
* fill or drain an area.
*
* The use of ITankContainer is optional but is need for the drain to be added to a Fluid Network
*/
public interface IDrain extends ITankContainer
{
/**
* In the drain you can use the ITankContainer.fill methods or use this to get the drain to
* place a liquid into the world
*
* @param stack - valid LiquidStack that has a Liquid Block for it
* @param doFill - actual do the action of filling or check if it can
* @return amount of liquid used
*/
public int fillArea(LiquidStack stack, boolean doFill);
/**
* Requests that this drain give the pump this liquid. The pump will have to decide if it can
* accept, request, and maintain this demand
*
* @param pump - requesting pump
* @param stack - liquid this pump wants for this request
*/
public void requestLiquid(TileEntity pump, LiquidStack stack);
/**
* Request that this drain no longer supply the pump with a volume. By default a request will be
* removed from the request map after being filled. However, this can be used too stop a request
* short if the pump becomes full before the request is filled
*
* @param tileEntity - requesting pump
*/
public void stopRequesting(TileEntity tileEntity);
}

View file

@ -0,0 +1,21 @@
package dark.fluid.api;
import dark.core.api.IColorCoded;
import dark.core.api.INetworkPart;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.liquids.LiquidTank;
public interface INetworkFluidPart extends IColorCoded, ITankContainer, INetworkPart
{
/**
* Gets the part's main tank for shared storage
*/
public ILiquidTank getTank();
/**
* Sets the content of the part's main tank
*/
public void setTankContent(LiquidStack stack);
}

View file

@ -0,0 +1,37 @@
package dark.fluid.api;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.LiquidStack;
/**
* A machine that acts as one with the liquid network using the networks pressure for some function
* that doesn't change the over all network pressure. So pipes, gauges, tubes, buffers, decor
* blocks.
*/
public interface INetworkPipe extends INetworkFluidPart
{
/**
* Gets the parts max pressure limit it can handle
*
* Note this is not recommended max limit by rather actual breaking point of the part
*/
public double getMaxPressure(ForgeDirection side);
/**
* Max flow rate of liquid flow this part from the side for the liquid type that his part will
* allow
*
* @return limit in bucket parts(1/1000 of a bucket)
*/
public int getMaxFlowRate(LiquidStack stack, ForgeDirection side);
/**
* Called when the pressure on the machine goes beyond max limits. Suggest doing random chance
* of damage or break too simulate real chances of pipe going beyond designed limits
*
* @param damageAllowed - can this tileEntity cause grief damage
* @return true if the device over pressured and destroyed itself
*/
public boolean onOverPressure(Boolean damageAllowed);
}

View file

@ -9,7 +9,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import dark.core.api.tools.IReadOut;
import dark.core.api.IToolReadOut;
import dark.core.api.IToolReadOut.EnumTools;
import dark.fluid.common.TabFluidMech;
public class ItemTools extends ItemBasic
@ -54,9 +55,9 @@ public class ItemTools extends ItemBasic
if (meta == 0)
{
if (blockEntity instanceof IReadOut)
if (blockEntity instanceof IToolReadOut)
{
String output = ((IReadOut) blockEntity).getMeterReading(player, ForgeDirection.getOrientation(side));
String output = ((IToolReadOut) blockEntity).getMeterReading(player, ForgeDirection.getOrientation(side), EnumTools.PIPE_GUAGE);
if (output.length() > 100)
{
output = output.substring(0, 100);

View file

@ -15,7 +15,7 @@ import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack;
import universalelectricity.prefab.block.BlockAdvanced;
import dark.core.api.network.INetworkPart;
import dark.core.api.INetworkPart;
import dark.core.hydraulic.helpers.FluidHelper;
import dark.core.hydraulic.helpers.FluidRestrictionHandler;
import dark.fluid.client.render.BlockRenderHelper;

View file

@ -13,14 +13,15 @@ import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack;
import dark.core.api.ColorCode;
import dark.core.api.IColorCoded;
import dark.core.api.network.ITileConnector;
import dark.core.api.network.fluid.INetworkPipe;
import dark.core.api.tools.IReadOut;
import dark.core.hydraulic.network.fluid.NetworkPipes;
import dark.core.api.IToolReadOut;
import dark.core.api.ITileConnector;
import dark.core.api.IToolReadOut.EnumTools;
import dark.core.network.fluid.NetworkPipes;
import dark.fluid.api.INetworkPipe;
import dark.fluid.common.prefab.TileEntityFluidDevice;
import dark.helpers.ConnectionHelper;
import dark.prefab.tile.fluid.TileEntityFluidDevice;
public class TileEntityReleaseValve extends TileEntityFluidDevice implements ITileConnector, IReadOut
public class TileEntityReleaseValve extends TileEntityFluidDevice implements ITileConnector, IToolReadOut
{
public boolean[] allowed = new boolean[ColorCode.values().length - 1];
public TileEntity[] connected = new TileEntity[6];
@ -175,7 +176,7 @@ public class TileEntityReleaseValve extends TileEntityFluidDevice implements ITi
}
@Override
public String getMeterReading(EntityPlayer user, ForgeDirection side)
public String getMeterReading(EntityPlayer user, ForgeDirection side, EnumTools tool)
{
// TODO maybe debug on # of connected units of input/output
String output = "";

View file

@ -15,7 +15,7 @@ import com.google.common.io.ByteArrayDataInput;
import dark.core.api.ColorCode;
import dark.core.api.IColorCoded;
import dark.fluid.common.FluidMech;
import dark.prefab.tile.fluid.TileEntityFluidStorage;
import dark.fluid.common.prefab.TileEntityFluidStorage;
public class TileEntitySink extends TileEntityFluidStorage implements IPacketReceiver, ITankContainer, IColorCoded
{

View file

@ -25,17 +25,18 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.core.api.ColorCode;
import dark.core.api.IColorCoded;
import dark.core.api.network.fluid.INetworkFluidPart;
import dark.core.api.network.fluid.INetworkPipe;
import dark.core.api.tools.IReadOut;
import dark.core.api.IToolReadOut;
import dark.core.api.IToolReadOut.EnumTools;
import dark.core.hydraulic.helpers.FluidRestrictionHandler;
import dark.core.hydraulic.network.NetworkFluidContainers;
import dark.core.hydraulic.network.NetworkTileEntities;
import dark.core.hydraulic.network.fluid.NetworkFluidTiles;
import dark.core.network.fluid.NetworkFluidContainers;
import dark.core.network.fluid.NetworkFluidTiles;
import dark.core.tile.network.NetworkTileEntities;
import dark.fluid.api.INetworkFluidPart;
import dark.fluid.api.INetworkPipe;
import dark.fluid.common.FluidMech;
import dark.prefab.tile.fluid.TileEntityFluidDevice;
import dark.fluid.common.prefab.TileEntityFluidDevice;
public class TileEntityTank extends TileEntityFluidDevice implements ITankContainer, IReadOut, IColorCoded, INetworkFluidPart, IPacketReceiver
public class TileEntityTank extends TileEntityFluidDevice implements ITankContainer, IToolReadOut, IColorCoded, INetworkFluidPart, IPacketReceiver
{
/* CURRENTLY CONNECTED TILE ENTITIES TO THIS */
private TileEntity[] connectedBlocks = new TileEntity[6];
@ -128,7 +129,7 @@ public class TileEntityTank extends TileEntityFluidDevice implements ITankContai
}
@Override
public String getMeterReading(EntityPlayer user, ForgeDirection side)
public String getMeterReading(EntityPlayer user, ForgeDirection side, EnumTools tool)
{
/* DEBUG CODE ACTIVATERS */
boolean testNetwork = true;

View file

@ -12,8 +12,8 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.liquids.ILiquidTank;
import universalelectricity.prefab.block.BlockAdvanced;
import dark.core.api.network.fluid.INetworkPipe;
import dark.core.hydraulic.helpers.FluidRestrictionHandler;
import dark.fluid.api.INetworkPipe;
import dark.fluid.common.FluidMech;
import dark.fluid.common.TabFluidMech;

View file

@ -8,7 +8,7 @@ import universalelectricity.core.vector.Vector3;
import universalelectricity.core.vector.VectorHelper;
import dark.core.api.ColorCode;
import dark.core.hydraulic.helpers.FluidHelper;
import dark.core.hydraulic.network.fluid.NetworkPipes;
import dark.core.network.fluid.NetworkPipes;
public class TileEntityGenericPipe extends TileEntityPipe
{

View file

@ -31,17 +31,18 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.core.api.ColorCode;
import dark.core.api.IColorCoded;
import dark.core.api.network.ITileConnector;
import dark.core.api.network.fluid.INetworkPipe;
import dark.core.api.tools.IReadOut;
import dark.core.api.IToolReadOut;
import dark.core.api.ITileConnector;
import dark.core.api.IToolReadOut.EnumTools;
import dark.core.hydraulic.helpers.FluidHelper;
import dark.core.hydraulic.helpers.FluidRestrictionHandler;
import dark.core.hydraulic.network.NetworkTileEntities;
import dark.core.hydraulic.network.fluid.NetworkPipes;
import dark.core.network.fluid.NetworkPipes;
import dark.core.tile.network.NetworkTileEntities;
import dark.fluid.api.INetworkPipe;
import dark.fluid.common.FluidMech;
import dark.fluid.common.pipes.addon.IPipeExtention;
public class TileEntityPipe extends TileEntityAdvanced implements ITankContainer, IReadOut, IColorCoded, INetworkPipe, IPacketReceiver
public class TileEntityPipe extends TileEntityAdvanced implements ITankContainer, IToolReadOut, IColorCoded, INetworkPipe, IPacketReceiver
{
/* TANK TO FAKE OTHER TILES INTO BELIVING THIS HAS AN INTERNAL STORAGE */
@ -348,11 +349,11 @@ public class TileEntityPipe extends TileEntityAdvanced implements ITankContainer
}
@Override
public String getMeterReading(EntityPlayer user, ForgeDirection side)
public String getMeterReading(EntityPlayer user, ForgeDirection side, EnumTools tool)
{
/* DEBUG CODE ACTIVATERS */
boolean testConnections = false;
boolean testNetwork = false;
boolean testNetwork = true;
boolean testSubs = false;
/* NORMAL OUTPUT */

View file

@ -8,7 +8,7 @@ import net.minecraftforge.liquids.LiquidStack;
import com.google.common.io.ByteArrayDataInput;
import dark.core.hydraulic.network.fluid.NetworkPipes;
import dark.core.network.fluid.NetworkPipes;
import dark.fluid.client.render.pipe.RenderPipeWindow;
import dark.fluid.common.pipes.TileEntityPipe;

View file

@ -3,7 +3,7 @@ package dark.fluid.common.pipes.tele;
import java.util.List;
import dark.core.api.network.fluid.INetworkPipe;
import dark.fluid.api.INetworkPipe;
/**
* Used by IFluidNetworkPart to signal this block is remotely connected to another network. It will

View file

@ -0,0 +1,42 @@
package dark.fluid.common.prefab;
import java.util.Random;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidStack;
import universalelectricity.prefab.tile.TileEntityAdvanced;
import dark.core.api.IToolReadOut;
import dark.core.api.ITileConnector;
import dark.core.network.fluid.HydraulicNetworkHelper;
public abstract class TileEntityFluidDevice extends TileEntityAdvanced implements IToolReadOut, ITileConnector
{
public Random random = new Random();
@Override
public void invalidate()
{
super.invalidate();
HydraulicNetworkHelper.invalidate(this);
}
/**
* Fills an ITankContainer in the direction
*
* @param stack - LiquidStack that will be inputed in the tile
* @param side - direction to fill in
* @return the ammount filled
*/
public int fillSide(LiquidStack stack, ForgeDirection side, boolean doFill)
{
TileEntity tileEntity = worldObj.getBlockTileEntity(xCoord + side.offsetX, yCoord + side.offsetY, zCoord + side.offsetZ);
if (stack != null && stack.amount > 0 && tileEntity instanceof ITankContainer)
{
return ((ITankContainer) tileEntity).fill(side.getOpposite(), stack, doFill);
}
return 0;
}
}

View file

@ -0,0 +1,159 @@
package dark.fluid.common.prefab;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidDictionary;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.liquids.LiquidTank;
import dark.core.api.IColorCoded;
import dark.core.api.IToolReadOut.EnumTools;
import dark.core.hydraulic.helpers.FluidHelper;
import dark.core.hydraulic.helpers.FluidRestrictionHandler;
public abstract class TileEntityFluidStorage extends TileEntityFluidDevice implements ITankContainer, IColorCoded
{
/* INTERNAL TANK */
public LiquidTank tank = new LiquidTank(this.getTankSize());
/**
* gets the max storage limit of the tank
*/
public abstract int getTankSize();
@Override
public String getMeterReading(EntityPlayer user, ForgeDirection side, EnumTools tool)
{
if(tool != EnumTools.PIPE_GUAGE)
{
return null;
}
if (this.tank.getLiquid() == null)
{
return "Empty";
}
return String.format("%d/%d %S Stored", tank.getLiquid().amount / LiquidContainerRegistry.BUCKET_VOLUME, tank.getCapacity() / LiquidContainerRegistry.BUCKET_VOLUME, LiquidDictionary.findLiquidName(tank.getLiquid()));
}
@Override
public boolean canTileConnect(TileEntity entity, ForgeDirection dir)
{
if (entity instanceof ITankContainer)
{
return true;
}
return false;
}
@Override
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill)
{
return this.fill(0, resource, doFill);
}
@Override
public int fill(int tankIndex, LiquidStack resource, boolean doFill)
{
if (resource == null || tankIndex != 0)
{
return 0;
}
else if (!FluidRestrictionHandler.isValidLiquid(getColor(),resource))
{
return 0;
}
else if (this.tank.getLiquid() != null && !resource.isLiquidEqual(this.tank.getLiquid()))
{
return 0;
}
return this.tank.fill(resource, doFill);
}
@Override
public LiquidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
{
return this.drain(0, maxDrain, doDrain);
}
@Override
public LiquidStack drain(int tankIndex, int maxDrain, boolean doDrain)
{
if (tankIndex != 0 || this.tank.getLiquid() == null)
{
return null;
}
LiquidStack stack = this.tank.getLiquid();
if (maxDrain < stack.amount)
{
stack = FluidHelper.getStack(stack, maxDrain);
}
return this.tank.drain(maxDrain, doDrain);
}
@Override
public ILiquidTank[] getTanks(ForgeDirection dir)
{
return new ILiquidTank[] { this.tank };
}
@Override
public ILiquidTank getTank(ForgeDirection dir, LiquidStack type)
{
if (type == null)
{
return null;
}
if (type.isLiquidEqual(this.tank.getLiquid()))
{
return this.tank;
}
return null;
}
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
LiquidStack liquid = LiquidStack.loadLiquidStackFromNBT(nbt.getCompoundTag("stored"));
if (liquid != null)
{
tank.setLiquid(liquid);
}
}
@Override
public void writeToNBT(NBTTagCompound nbt)
{
super.writeToNBT(nbt);
if (this.tank.containsValidLiquid())
{
nbt.setTag("stored", this.tank.getLiquid().writeToNBT(new NBTTagCompound()));
}
}
/**
* Is the internal tank full
*/
public boolean isFull()
{
if (this.tank.getLiquid() == null || this.tank.getLiquid().amount < this.tank.getCapacity())
{
return false;
}
return true;
}
/**
* gets the liquidStack stored in the internal tank
*/
public LiquidStack getStoredLiquid()
{
return this.tank.getLiquid();
}
}

View file

@ -17,7 +17,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.prefab.block.BlockAdvanced;
import dark.core.hydraulic.network.fluid.HydraulicNetworkHelper;
import dark.core.network.fluid.HydraulicNetworkHelper;
import dark.fluid.client.render.BlockRenderHelper;
import dark.fluid.common.FluidMech;
import dark.fluid.common.TabFluidMech;

View file

@ -10,10 +10,10 @@ import net.minecraftforge.liquids.LiquidTank;
import universalelectricity.core.electricity.ElectricityPack;
import universalelectricity.core.vector.Vector3;
import universalelectricity.core.vector.VectorHelper;
import dark.core.api.network.ITileConnector;
import dark.core.api.network.fluid.INetworkPipe;
import dark.core.hydraulic.network.fluid.HydraulicNetworkHelper;
import dark.core.hydraulic.network.fluid.NetworkFluidTiles;
import dark.core.api.ITileConnector;
import dark.core.network.fluid.HydraulicNetworkHelper;
import dark.core.network.fluid.NetworkFluidTiles;
import dark.fluid.api.INetworkPipe;
import dark.helpers.MetaGroup;
import dark.library.machine.TileEntityRunnableMachine;

View file

@ -21,10 +21,11 @@ import net.minecraftforge.liquids.LiquidStack;
import universalelectricity.core.vector.Vector2;
import universalelectricity.core.vector.Vector3;
import universalelectricity.core.vector.VectorHelper;
import dark.core.api.hydraulic.IDrain;
import dark.core.api.network.fluid.INetworkPipe;
import dark.core.api.IToolReadOut.EnumTools;
import dark.core.hydraulic.helpers.FluidHelper;
import dark.prefab.tile.fluid.TileEntityFluidDevice;
import dark.fluid.api.IDrain;
import dark.fluid.api.INetworkPipe;
import dark.fluid.common.prefab.TileEntityFluidDevice;
public class TileEntityDrain extends TileEntityFluidDevice implements ITankContainer, IDrain
{
@ -49,7 +50,7 @@ public class TileEntityDrain extends TileEntityFluidDevice implements ITankConta
}
@Override
public String getMeterReading(EntityPlayer user, ForgeDirection side)
public String getMeterReading(EntityPlayer user, ForgeDirection side, EnumTools tool)
{
return "Set to " + (canDrainSources() ? "input liquids" : "output liquids");
}

View file

@ -17,14 +17,15 @@ import com.google.common.io.ByteArrayDataInput;
import dark.core.api.ColorCode;
import dark.core.api.IColorCoded;
import dark.core.api.network.ITileConnector;
import dark.core.api.tools.IReadOut;
import dark.core.api.IToolReadOut;
import dark.core.api.ITileConnector;
import dark.core.api.IToolReadOut.EnumTools;
import dark.core.hydraulic.helpers.FluidHelper;
import dark.core.hydraulic.helpers.FluidRestrictionHandler;
import dark.helpers.MetaGroup;
import dark.library.machine.TileEntityRunnableMachine;
public class TileEntityStarterPump extends TileEntityRunnableMachine implements IPacketReceiver, IReadOut, ITileConnector
public class TileEntityStarterPump extends TileEntityRunnableMachine implements IPacketReceiver, IToolReadOut, ITileConnector
{
public final double WATTS_PER_TICK = (400 / 20);
private double percentPumped = 0.0;
@ -187,7 +188,7 @@ public class TileEntityStarterPump extends TileEntityRunnableMachine implements
}
@Override
public String getMeterReading(EntityPlayer user, ForgeDirection side)
public String getMeterReading(EntityPlayer user, ForgeDirection side, EnumTools tool)
{
return String.format("%.2f/%.2f %f Done", this.wattsReceived,this.WATTS_PER_TICK,this.percentPumped);
}

View file

@ -17,12 +17,13 @@ import universalelectricity.prefab.tile.TileEntityElectrical;
import com.google.common.io.ByteArrayDataInput;
import dark.core.api.tools.IReadOut;
import dark.core.api.IToolReadOut;
import dark.core.api.IToolReadOut.EnumTools;
import dark.fluid.api.mech.IForce;
import dark.helpers.ConnectionHelper;
import dark.helpers.MetaGroup;
public class TileEntityGenerator extends TileEntityElectrical implements IPacketReceiver, IForce, IReadOut, IRedstoneReceptor
public class TileEntityGenerator extends TileEntityElectrical implements IPacketReceiver, IForce, IToolReadOut, IRedstoneReceptor
{
public boolean isPowered = false;
@ -258,7 +259,7 @@ public class TileEntityGenerator extends TileEntityElectrical implements IPacket
}
@Override
public String getMeterReading(EntityPlayer user, ForgeDirection side)
public String getMeterReading(EntityPlayer user, ForgeDirection side, EnumTools tool)
{
if (this.isPowered)
return "Outputing Force " + this.joulesReceived + "J " + "pos " + this.pos;

View file

@ -12,12 +12,13 @@ import universalelectricity.prefab.network.PacketManager;
import com.google.common.io.ByteArrayDataInput;
import dark.core.api.tools.IReadOut;
import dark.core.api.IToolReadOut;
import dark.core.api.IToolReadOut.EnumTools;
import dark.fluid.api.mech.IForce;
import dark.fluid.common.FluidMech;
public class TileEntityRod extends TileEntity implements IPacketReceiver, IForce, IReadOut
public class TileEntityRod extends TileEntity implements IPacketReceiver, IForce, IToolReadOut
{
public int pos = 0;
@ -118,7 +119,7 @@ public class TileEntityRod extends TileEntity implements IPacketReceiver, IForce
}
@Override
public String getMeterReading(EntityPlayer user, ForgeDirection side)
public String getMeterReading(EntityPlayer user, ForgeDirection side, EnumTools tool)
{
return this.appliedForce + "N Out " + this.currentForce + "N In";
}