Added clockwise set and get methods for IMechanical
This commit is contained in:
parent
1e5319c4de
commit
20dcbce5c5
16 changed files with 725 additions and 652 deletions
|
@ -8,7 +8,7 @@ import universalelectricity.api.net.IConnector;
|
|||
* that each part can only support one fluid tank internally
|
||||
*
|
||||
* @author DarkGuardsman */
|
||||
public interface IFluidPart extends IConnector<IFluidNetwork>, IFluidHandler
|
||||
public interface IFluidConnector extends IConnector<IFluidNetwork>, IFluidHandler
|
||||
{
|
||||
/** FluidTank that the network will have access to fill or drain */
|
||||
public FluidTank getInternalTank();
|
|
@ -10,7 +10,7 @@ import universalelectricity.api.net.INetwork;
|
|||
/** Interface version of the fluid network.
|
||||
*
|
||||
* @author DarkGuardsman */
|
||||
public interface IFluidNetwork extends INetwork<IFluidNetwork, IFluidPart, IFluidHandler>
|
||||
public interface IFluidNetwork extends INetwork<IFluidNetwork, IFluidConnector, IFluidHandler>
|
||||
{
|
||||
/** Called to build the network when something changes such as addition of a pipe */
|
||||
void reconstruct();
|
||||
|
@ -22,7 +22,7 @@ public interface IFluidNetwork extends INetwork<IFluidNetwork, IFluidPart, IFlui
|
|||
* @param resource - fluid stack that is being filled into the network
|
||||
* @param doFill - true causes the action to be taken, false simulates the action
|
||||
* @return amount of fluid filled into the network */
|
||||
int fill(IFluidPart source, ForgeDirection from, FluidStack resource, boolean doFill);
|
||||
int fill(IFluidConnector source, ForgeDirection from, FluidStack resource, boolean doFill);
|
||||
|
||||
/** Called to remove fluid from a network, not supported by all networks
|
||||
*
|
||||
|
@ -31,7 +31,7 @@ public interface IFluidNetwork extends INetwork<IFluidNetwork, IFluidPart, IFlui
|
|||
* @param resource - fluid stack that is being filled into the network
|
||||
* @param doDrain - true causes the action to be taken, false simulates the action
|
||||
* @return FluidStack that contains the fluid drained from the network */
|
||||
FluidStack drain(IFluidPart source, ForgeDirection from, FluidStack resource, boolean doDrain);
|
||||
FluidStack drain(IFluidConnector source, ForgeDirection from, FluidStack resource, boolean doDrain);
|
||||
|
||||
/** Called to remove fluid from a network, not supported by all networks
|
||||
*
|
||||
|
@ -40,7 +40,7 @@ public interface IFluidNetwork extends INetwork<IFluidNetwork, IFluidPart, IFlui
|
|||
* @param resource - fluid stack that is being filled into the network
|
||||
* @param doDrain - true causes the action to be taken, false simulates the action
|
||||
* @return FluidStack that contains the fluid drained from the network */
|
||||
FluidStack drain(IFluidPart source, ForgeDirection from, int resource, boolean doDrain);
|
||||
FluidStack drain(IFluidConnector source, ForgeDirection from, int resource, boolean doDrain);
|
||||
|
||||
/** Fluid tank that represents the entire network */
|
||||
FluidTank getTank();
|
||||
|
|
|
@ -3,7 +3,7 @@ package resonantinduction.api.fluid;
|
|||
/** Applied to tiles that are pipes and support pressure
|
||||
*
|
||||
* @author DarkGuardsman */
|
||||
public interface IFluidPipe extends IFluidPart, IPressureInput
|
||||
public interface IFluidPipe extends IFluidConnector, IPressureInput
|
||||
{
|
||||
/** Max pressure this pipe can support */
|
||||
int getMaxPressure();
|
||||
|
|
|
@ -113,4 +113,16 @@ public class TileGenerator extends TileElectrical implements IMechanical
|
|||
nbt.setBoolean("isInversed", isInversed);
|
||||
nbt.setFloat("torqueRatio", torqueRatio);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClockwise()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotation(boolean isClockwise)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,14 +11,14 @@ import net.minecraftforge.fluids.FluidTank;
|
|||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import resonantinduction.api.fluid.IFluidNetwork;
|
||||
import resonantinduction.api.fluid.IFluidPart;
|
||||
import resonantinduction.api.fluid.IFluidConnector;
|
||||
import universalelectricity.api.net.IConnector;
|
||||
import universalelectricity.core.net.ConnectionPathfinder;
|
||||
import universalelectricity.core.net.Network;
|
||||
import universalelectricity.core.net.NetworkTickHandler;
|
||||
import calclavia.lib.utility.FluidUtility;
|
||||
|
||||
public class FluidNetwork extends Network<IFluidNetwork, IFluidPart, IFluidHandler> implements IFluidNetwork
|
||||
public abstract class FluidNetwork extends Network<IFluidNetwork, IFluidConnector, IFluidHandler> implements IFluidNetwork
|
||||
{
|
||||
protected FluidTank tank = new FluidTank(0);
|
||||
protected final FluidTankInfo[] tankInfo = new FluidTankInfo[1];
|
||||
|
@ -31,6 +31,13 @@ public class FluidNetwork extends Network<IFluidNetwork, IFluidPart, IFluidHandl
|
|||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConnector(IFluidConnector connector)
|
||||
{
|
||||
NetworkTickHandler.addNetwork(this);
|
||||
super.addConnector(connector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reconstruct()
|
||||
{
|
||||
|
@ -39,16 +46,16 @@ public class FluidNetwork extends Network<IFluidNetwork, IFluidPart, IFluidHandl
|
|||
this.reloadTanks();
|
||||
}
|
||||
this.tank = new FluidTank(0);
|
||||
for (IFluidPart part : this.getConnectors())
|
||||
for (IFluidConnector part : this.getConnectors())
|
||||
{
|
||||
part.setNetwork(this);
|
||||
this.buildPart(part);
|
||||
}
|
||||
this.rebuildTank();
|
||||
this.rebuildHandler();
|
||||
this.reloadTanks();
|
||||
}
|
||||
|
||||
public void buildPart(IFluidPart part)
|
||||
public void buildPart(IFluidConnector part)
|
||||
{
|
||||
FluidTank tank = part.getInternalTank();
|
||||
if (tank != null)
|
||||
|
@ -64,12 +71,12 @@ public class FluidNetwork extends Network<IFluidNetwork, IFluidPart, IFluidHandl
|
|||
}
|
||||
else if (this.tank.getFluid() != null)
|
||||
{
|
||||
//TODO cause a mixing event
|
||||
// TODO cause a mixing event
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void rebuildTank()
|
||||
public void rebuildHandler()
|
||||
{
|
||||
if (this.getTank() != null)
|
||||
{
|
||||
|
@ -84,19 +91,19 @@ public class FluidNetwork extends Network<IFluidNetwork, IFluidPart, IFluidHandl
|
|||
}
|
||||
|
||||
@Override
|
||||
public int fill(IFluidPart source, ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
public int fill(IFluidConnector source, ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
int prev = this.getTank().getFluidAmount();
|
||||
int fill = this.getTank().fill(resource, doFill);
|
||||
if (prev != this.getTank().getFluidAmount())
|
||||
{
|
||||
this.rebuildTank();
|
||||
this.rebuildHandler();
|
||||
}
|
||||
return fill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(IFluidPart source, ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
public FluidStack drain(IFluidConnector source, ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
if (resource != null && resource.isFluidEqual(this.getTank().getFluid()))
|
||||
{
|
||||
|
@ -104,7 +111,7 @@ public class FluidNetwork extends Network<IFluidNetwork, IFluidPart, IFluidHandl
|
|||
FluidStack drain = this.getTank().drain(resource.amount, doDrain);
|
||||
if (before != this.getTank().getFluid() || this.getTank().getFluid() == null || this.getTank().getFluid().amount != before.amount)
|
||||
{
|
||||
this.rebuildTank();
|
||||
this.rebuildHandler();
|
||||
}
|
||||
|
||||
return drain;
|
||||
|
@ -113,7 +120,7 @@ public class FluidNetwork extends Network<IFluidNetwork, IFluidPart, IFluidHandl
|
|||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(IFluidPart source, ForgeDirection from, int resource, boolean doDrain)
|
||||
public FluidStack drain(IFluidConnector source, ForgeDirection from, int resource, boolean doDrain)
|
||||
{
|
||||
if (this.getTank().getFluid() != null)
|
||||
{
|
||||
|
@ -161,10 +168,10 @@ public class FluidNetwork extends Network<IFluidNetwork, IFluidPart, IFluidHandl
|
|||
this.fillTankSet(stack != null ? stack.copy() : null, this.getConnectors());
|
||||
}
|
||||
|
||||
public void fillTankSet(FluidStack stack, Set<IFluidPart> tankList)
|
||||
public void fillTankSet(FluidStack stack, Set<IFluidConnector> tankList)
|
||||
{
|
||||
int parts = tankList.size();
|
||||
for (IFluidPart part : tankList)
|
||||
for (IFluidConnector part : tankList)
|
||||
{
|
||||
part.getInternalTank().setFluid(null);
|
||||
if (stack != null)
|
||||
|
@ -210,43 +217,47 @@ public class FluidNetwork extends Network<IFluidNetwork, IFluidPart, IFluidHandl
|
|||
}
|
||||
|
||||
@Override
|
||||
public void split(IFluidPart splitPoint)
|
||||
public void split(IFluidConnector splitPoint)
|
||||
{
|
||||
this.removeConnector(splitPoint);
|
||||
this.reconstruct();
|
||||
|
||||
/** Loop through the connected blocks and attempt to see if there are connections between the
|
||||
* two points elsewhere. */
|
||||
/**
|
||||
* Loop through the connected blocks and attempt to see if there are connections between the
|
||||
* two points elsewhere.
|
||||
*/
|
||||
Object[] connectedBlocks = splitPoint.getConnections();
|
||||
|
||||
for (int i = 0; i < connectedBlocks.length; i++)
|
||||
{
|
||||
Object connectedBlockA = connectedBlocks[i];
|
||||
|
||||
if (connectedBlockA instanceof IFluidPart)
|
||||
if (connectedBlockA instanceof IFluidConnector)
|
||||
{
|
||||
for (int ii = 0; ii < connectedBlocks.length; ii++)
|
||||
{
|
||||
final Object connectedBlockB = connectedBlocks[ii];
|
||||
|
||||
if (connectedBlockA != connectedBlockB && connectedBlockB instanceof IFluidPart)
|
||||
if (connectedBlockA != connectedBlockB && connectedBlockB instanceof IFluidConnector)
|
||||
{
|
||||
ConnectionPathfinder finder = new ConnectionPathfinder((IFluidPart) connectedBlockB, splitPoint);
|
||||
finder.findNodes((IFluidPart) connectedBlockA);
|
||||
ConnectionPathfinder finder = new ConnectionPathfinder((IFluidConnector) connectedBlockB, splitPoint);
|
||||
finder.findNodes((IFluidConnector) connectedBlockA);
|
||||
|
||||
if (finder.results.size() <= 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
/** The connections A and B are not connected anymore. Give them both
|
||||
* a new common network. */
|
||||
/**
|
||||
* The connections A and B are not connected anymore. Give them both
|
||||
* a new common network.
|
||||
*/
|
||||
IFluidNetwork newNetwork = this.getClass().newInstance();
|
||||
|
||||
for (IConnector node : finder.closedSet)
|
||||
{
|
||||
if (node != splitPoint && node instanceof IFluidPart)
|
||||
if (node != splitPoint && node instanceof IFluidConnector)
|
||||
{
|
||||
newNetwork.addConnector((IFluidPart) node);
|
||||
newNetwork.addConnector((IFluidConnector) node);
|
||||
}
|
||||
}
|
||||
newNetwork.reconstruct();
|
||||
|
@ -264,7 +275,7 @@ public class FluidNetwork extends Network<IFluidNetwork, IFluidPart, IFluidHandl
|
|||
}
|
||||
|
||||
@Override
|
||||
public void split(IFluidPart connectorA, IFluidPart connectorB)
|
||||
public void split(IFluidConnector connectorA, IFluidConnector connectorB)
|
||||
{
|
||||
this.reconstruct();
|
||||
|
||||
|
@ -274,8 +285,10 @@ public class FluidNetwork extends Network<IFluidNetwork, IFluidPart, IFluidHandl
|
|||
|
||||
if (finder.results.size() <= 0)
|
||||
{
|
||||
/** The connections A and B are not connected anymore. Give them both a new common
|
||||
* network. */
|
||||
/**
|
||||
* The connections A and B are not connected anymore. Give them both a new common
|
||||
* network.
|
||||
*/
|
||||
IFluidNetwork newNetwork;
|
||||
try
|
||||
{
|
||||
|
@ -283,9 +296,9 @@ public class FluidNetwork extends Network<IFluidNetwork, IFluidPart, IFluidHandl
|
|||
|
||||
for (IConnector node : finder.closedSet)
|
||||
{
|
||||
if (node instanceof IFluidPart)
|
||||
if (node instanceof IFluidConnector)
|
||||
{
|
||||
newNetwork.addConnector((IFluidPart) node);
|
||||
newNetwork.addConnector((IFluidConnector) node);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import resonantinduction.api.fluid.IFluidPart;
|
||||
import resonantinduction.api.fluid.IFluidConnector;
|
||||
import resonantinduction.api.fluid.IFluidPipe;
|
||||
import resonantinduction.mechanical.fluid.network.FluidNetwork;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
|
@ -26,7 +26,9 @@ public class PipeNetwork extends FluidNetwork
|
|||
System.out.println("FluidVol: " + this.getTank().getFluidAmount());
|
||||
|
||||
super.update();
|
||||
//Slight delay to allow visual effect to take place before draining the pipe's internal tank
|
||||
|
||||
// Slight delay to allow visual effect to take place before draining the pipe's internal
|
||||
// tank
|
||||
if (this.ticks % 2 == 0 && this.getTank().getFluidAmount() > 0)
|
||||
{
|
||||
FluidStack stack = this.getTank().getFluid().copy();
|
||||
|
@ -56,8 +58,8 @@ public class PipeNetwork extends FluidNetwork
|
|||
break;
|
||||
}
|
||||
this.getTank().setFluid(stack);
|
||||
//TODO check for change before rebuilding
|
||||
this.rebuildTank();
|
||||
// TODO check for change before rebuilding
|
||||
this.rebuildHandler();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,7 +72,7 @@ public class PipeNetwork extends FluidNetwork
|
|||
@Override
|
||||
public boolean continueUpdate()
|
||||
{
|
||||
return this.getConnectors().size() > 0;
|
||||
return true;// this.getConnectors().size() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -81,7 +83,7 @@ public class PipeNetwork extends FluidNetwork
|
|||
}
|
||||
|
||||
@Override
|
||||
public void buildPart(IFluidPart part)
|
||||
public void buildPart(IFluidConnector part)
|
||||
{
|
||||
super.buildPart(part);
|
||||
for (int i = 0; i < 6; i++)
|
||||
|
@ -100,13 +102,13 @@ public class PipeNetwork extends FluidNetwork
|
|||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(IFluidPart source, ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
public FluidStack drain(IFluidConnector source, ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(IFluidPart source, ForgeDirection from, int resource, boolean doDrain)
|
||||
public FluidStack drain(IFluidConnector source, ForgeDirection from, int resource, boolean doDrain)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import net.minecraftforge.fluids.FluidTank;
|
|||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import resonantinduction.api.IReadOut;
|
||||
import resonantinduction.api.fluid.IFluidNetwork;
|
||||
import resonantinduction.api.fluid.IFluidPart;
|
||||
import resonantinduction.api.fluid.IFluidConnector;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.mechanical.Mechanical;
|
||||
import resonantinduction.mechanical.fluid.network.FluidNetwork;
|
||||
|
@ -28,7 +28,13 @@ import com.google.common.io.ByteArrayDataInput;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileFluidNetwork extends TileEntityFluidDevice implements IFluidPart, IPacketReceiverWithID, IReadOut
|
||||
/**
|
||||
* A prefab class for tiles that use the fluid network.
|
||||
*
|
||||
* @author DarkCow
|
||||
*
|
||||
*/
|
||||
public abstract class TileFluidNetwork<N extends FluidNetwork> extends TileEntityFluidDevice implements IFluidConnector, IPacketReceiverWithID, IReadOut
|
||||
{
|
||||
public static int refreshRate = 10;
|
||||
protected FluidTank tank = new FluidTank(1 * FluidContainerRegistry.BUCKET_VOLUME);
|
||||
|
@ -39,7 +45,7 @@ public class TileFluidNetwork extends TileEntityFluidDevice implements IFluidPar
|
|||
protected FluidStack prevStack = null;
|
||||
|
||||
/** Network used to link all parts together */
|
||||
protected IFluidNetwork network;
|
||||
protected N network;
|
||||
|
||||
public static final int PACKET_DESCRIPTION = Mechanical.contentRegistry.getNextPacketID();
|
||||
public static final int PACKET_RENDER = Mechanical.contentRegistry.getNextPacketID();
|
||||
|
@ -168,17 +174,19 @@ public class TileFluidNetwork extends TileEntityFluidDevice implements IFluidPar
|
|||
|
||||
}
|
||||
|
||||
/** Checks to make sure the connection is valid to the tileEntity
|
||||
/**
|
||||
* Checks to make sure the connection is valid to the tileEntity
|
||||
*
|
||||
* @param tileEntity - the tileEntity being checked
|
||||
* @param side - side the connection is too */
|
||||
* @param side - side the connection is too
|
||||
*/
|
||||
public void validateConnectionSide(TileEntity tileEntity, ForgeDirection side)
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (tileEntity instanceof IFluidPart)
|
||||
if (tileEntity instanceof IFluidConnector)
|
||||
{
|
||||
this.getNetwork().merge(((IFluidPart) tileEntity).getNetwork());
|
||||
this.getNetwork().merge(((IFluidConnector) tileEntity).getNetwork());
|
||||
this.setRenderSide(side, true);
|
||||
connectedBlocks[side.ordinal()] = tileEntity;
|
||||
}
|
||||
|
@ -203,23 +211,6 @@ public class TileFluidNetwork extends TileEntityFluidDevice implements IFluidPar
|
|||
return (renderSides & (1 << direction.ordinal())) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFluidNetwork getNetwork()
|
||||
{
|
||||
if (this.network != null)
|
||||
{
|
||||
this.network = new FluidNetwork();
|
||||
this.network.addConnector(this);
|
||||
}
|
||||
return this.network;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNetwork(IFluidNetwork fluidNetwork)
|
||||
{
|
||||
this.network = fluidNetwork;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Set;
|
|||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import resonantinduction.api.fluid.IFluidPart;
|
||||
import resonantinduction.api.fluid.IFluidConnector;
|
||||
import resonantinduction.mechanical.fluid.network.FluidNetwork;
|
||||
|
||||
/** Network that handles connected tanks
|
||||
|
@ -27,7 +27,7 @@ public class TankNetwork extends FluidNetwork
|
|||
else if (this.getConnectors().size() > 0)
|
||||
{
|
||||
fillStack = fillStack.copy();
|
||||
for (IFluidPart part : this.getConnectors())
|
||||
for (IFluidConnector part : this.getConnectors())
|
||||
{
|
||||
part.getInternalTank().setFluid(null);
|
||||
if (part instanceof TileEntity && ((TileEntity) part).yCoord < lowestY)
|
||||
|
@ -43,13 +43,13 @@ public class TankNetwork extends FluidNetwork
|
|||
//TODO Add path finder to prevent filling when tanks are only connected at the top
|
||||
for (int y = lowestY; y <= highestY; y++)
|
||||
{
|
||||
Set<IFluidPart> parts = new LinkedHashSet<IFluidPart>();
|
||||
Set<IFluidConnector> parts = new LinkedHashSet<IFluidConnector>();
|
||||
|
||||
for (IFluidPart part : this.getConnectors())
|
||||
for (IFluidConnector part : this.getConnectors())
|
||||
{
|
||||
if (part instanceof IFluidPart && ((TileEntity) part).yCoord == y)
|
||||
if (part instanceof IFluidConnector && ((TileEntity) part).yCoord == y)
|
||||
{
|
||||
parts.add((IFluidPart) part);
|
||||
parts.add((IFluidConnector) part);
|
||||
}
|
||||
}
|
||||
if (!parts.isEmpty())
|
||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import resonantinduction.api.fluid.IFluidNetwork;
|
||||
import resonantinduction.api.fluid.IFluidPart;
|
||||
import resonantinduction.api.fluid.IFluidConnector;
|
||||
import resonantinduction.mechanical.fluid.prefab.TileFluidNetwork;
|
||||
|
||||
public class TileTank extends TileFluidNetwork
|
||||
|
@ -43,7 +43,7 @@ public class TileTank extends TileFluidNetwork
|
|||
{
|
||||
if (tileEntity instanceof TileTank)
|
||||
{
|
||||
this.getNetwork().merge(((IFluidPart) tileEntity).getNetwork());
|
||||
this.getNetwork().merge(((IFluidConnector) tileEntity).getNetwork());
|
||||
this.setRenderSide(side, true);
|
||||
connectedBlocks[side.ordinal()] = tileEntity;
|
||||
}
|
||||
|
|
|
@ -479,4 +479,16 @@ public class PartGear extends JCuboidPart implements JNormalOcclusion, TFacePart
|
|||
return new universalelectricity.api.vector.Vector3(this.x() + direction.offsetX, this.y() + direction.offsetY, this.z() + direction.offsetZ).getTileEntity(this.world()) instanceof IMechanicalConnector;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClockwise()
|
||||
{
|
||||
return isClockwise;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotation(boolean isClockwise)
|
||||
{
|
||||
this.isClockwise = isClockwise;
|
||||
}
|
||||
|
||||
}
|
|
@ -15,4 +15,8 @@ public interface IMechanical extends IConnectable
|
|||
* @return Amount of energy that was accepted by the block.
|
||||
*/
|
||||
public long onReceiveEnergy(ForgeDirection from, long torque, float angularVelocity, boolean doReceive);
|
||||
|
||||
public boolean isClockwise();
|
||||
|
||||
public void setRotation(boolean isClockwise);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ public class TileMechanical extends TileAdvanced implements IMechanicalConnector
|
|||
|
||||
private IMechanicalNetwork network;
|
||||
|
||||
private boolean isClockwise = false;
|
||||
|
||||
@Override
|
||||
public long onReceiveEnergy(ForgeDirection from, long torque, float angularVelocity, boolean doReceive)
|
||||
{
|
||||
|
@ -56,4 +58,16 @@ public class TileMechanical extends TileAdvanced implements IMechanicalConnector
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClockwise()
|
||||
{
|
||||
return isClockwise;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotation(boolean isClockwise)
|
||||
{
|
||||
this.isClockwise = isClockwise;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ public class BlockGrinderWheel extends BlockRIRotatable implements ITileEntityPr
|
|||
{
|
||||
super("grindingWheel", Settings.getNextBlockID());
|
||||
this.setBlockBounds(0.05f, 0.05f, 0.05f, 0.95f, 0.95f, 0.95f);
|
||||
rotationMask = 0b111111;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,7 +33,7 @@ public class RenderGrinderWheel extends TileEntitySpecialRenderer
|
|||
TileGrinderWheel tile = (TileGrinderWheel) t;
|
||||
glPushMatrix();
|
||||
glTranslatef((float) x + 0.5F, (float) y + 0.5f, (float) z + 0.5F);
|
||||
glScalef(0.5f, 0.5f, 0.52f);
|
||||
glScalef(0.5f, 0.5f, 0.515f);
|
||||
glRotatef((float) Math.toDegrees(tile.getNetwork().getRotation()), 0, 0, 1);
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
|
||||
MODEL.renderAll();
|
||||
|
|
|
@ -81,4 +81,16 @@ public class TraitMechanical extends TileMultipart implements IMechanical
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClockwise()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotation(boolean isClockwise)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,4 +113,16 @@ public class TraitMechanicalConnector extends TileMultipart implements IMechanic
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClockwise()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotation(boolean isClockwise)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue