Changes for Return type change for INodeProvider
This commit is contained in:
parent
5d44e79e5b
commit
aff169b0b2
17 changed files with 264 additions and 264 deletions
|
@ -74,7 +74,7 @@ public class TileGutter extends TilePressureNode
|
|||
{
|
||||
if (tile instanceof IPressureNodeProvider)
|
||||
{
|
||||
FluidPressureNode check = ((IPressureNodeProvider) tile).getNode(FluidPressureNode.class, dir.getOpposite());
|
||||
FluidPressureNode check = (FluidPressureNode) ((IPressureNodeProvider) tile).getNode(FluidPressureNode.class, dir.getOpposite());
|
||||
|
||||
if (check != null && canConnect(dir, check) && check.canConnect(dir.getOpposite(), this))
|
||||
{
|
||||
|
|
|
@ -163,12 +163,12 @@ public class TileMotor extends TileElectrical implements IRotatable, INodeProvid
|
|||
}
|
||||
|
||||
@Override
|
||||
public <N extends INode> N getNode(Class<? super N> nodeType, ForgeDirection from)
|
||||
public INode getNode(Class<? extends INode> nodeType, ForgeDirection from)
|
||||
{
|
||||
if (from == getDirection() || from == getDirection().getOpposite())
|
||||
{
|
||||
if (nodeType.isAssignableFrom(node.getClass()))
|
||||
return (N) node;
|
||||
return node;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -44,10 +44,10 @@ public class PartRailing extends PartFramedConnection<PartRailing.EnumRailing, I
|
|||
|
||||
|
||||
@Override
|
||||
public <N extends INode> N getNode (Class<? super N> nodeType, ForgeDirection from)
|
||||
public INode getNode(Class<? extends INode> nodeType, ForgeDirection from)
|
||||
{
|
||||
if (nodeType.isInstance(this.node))
|
||||
return (N) node;
|
||||
return node;
|
||||
try
|
||||
{
|
||||
for (Constructor con : nodeType.getConstructors())
|
||||
|
@ -55,7 +55,7 @@ public class PartRailing extends PartFramedConnection<PartRailing.EnumRailing, I
|
|||
if ((con.getParameterTypes().length == 1) && con.getParameterTypes()[0].equals(getClass()))
|
||||
{
|
||||
this.node = (NodeRailing) con.newInstance(this);
|
||||
return (N) this.node;
|
||||
return this.node;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ public class PartMultimeter extends PartFace implements IConnector<MultimeterNet
|
|||
|
||||
if (tileEntity instanceof INodeProvider)
|
||||
{
|
||||
IMechanicalNode instance = ((INodeProvider) tileEntity).getNode(IMechanicalNode.class, receivingSide);
|
||||
IMechanicalNode instance = (IMechanicalNode) ((INodeProvider) tileEntity).getNode(IMechanicalNode.class, receivingSide);
|
||||
|
||||
for (ForgeDirection dir : ForgeDirection.values())
|
||||
{
|
||||
|
@ -274,7 +274,7 @@ public class PartMultimeter extends PartFace implements IConnector<MultimeterNet
|
|||
break;
|
||||
}
|
||||
|
||||
instance = ((INodeProvider) tileEntity).getNode(IMechanicalNode.class, dir);
|
||||
instance = (IMechanicalNode) ((INodeProvider) tileEntity).getNode(IMechanicalNode.class, dir);
|
||||
}
|
||||
|
||||
if (instance != null)
|
||||
|
@ -302,7 +302,7 @@ public class PartMultimeter extends PartFace implements IConnector<MultimeterNet
|
|||
|
||||
if (tileEntity instanceof IPressureNodeProvider)
|
||||
{
|
||||
getNetwork().pressureGraph.queue(((IPressureNodeProvider) tileEntity).getNode(FluidPressureNode.class, receivingSide).getPressure(receivingSide));
|
||||
getNetwork().pressureGraph.queue(((FluidPressureNode) ((IPressureNodeProvider) tileEntity).getNode(FluidPressureNode.class, receivingSide)).getPressure(receivingSide));
|
||||
}
|
||||
|
||||
getNetwork().energyGraph.queue(CompatibilityModule.getEnergy(tileEntity, receivingSide));
|
||||
|
|
|
@ -130,7 +130,7 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
|
|||
|
||||
if (tileBehind instanceof INodeProvider)
|
||||
{
|
||||
MechanicalNode instance = ((INodeProvider) tileBehind).getNode(MechanicalNode.class, placementSide.getOpposite());
|
||||
MechanicalNode instance = (MechanicalNode) ((INodeProvider) tileBehind).getNode(MechanicalNode.class, placementSide.getOpposite());
|
||||
|
||||
if (instance != null && instance != this && !(instance.parent instanceof PartGearShaft) && instance.canConnect(placementSide.getOpposite(), this))
|
||||
{
|
||||
|
@ -155,7 +155,7 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
|
|||
{
|
||||
/** If we're checking for the block that is opposite to the gear's placement
|
||||
* side (the center), then we try to look for a gear shaft in the center. */
|
||||
MechanicalNode instance = ((INodeProvider) tile).getNode(MechanicalNode.class, checkDir == placementSide.getOpposite() ? ForgeDirection.UNKNOWN : checkDir);
|
||||
MechanicalNode instance = (MechanicalNode) ((INodeProvider) tile).getNode(MechanicalNode.class, checkDir == placementSide.getOpposite() ? ForgeDirection.UNKNOWN : checkDir);
|
||||
|
||||
if (!connections.containsValue(checkDir) && instance != this && checkDir != placementSide && instance != null && instance.canConnect(checkDir.getOpposite(), this))
|
||||
{
|
||||
|
@ -179,7 +179,7 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
|
|||
|
||||
if (!connections.containsValue(checkDir) && checkTile instanceof INodeProvider)
|
||||
{
|
||||
MechanicalNode instance = ((INodeProvider) checkTile).getNode(MechanicalNode.class, placementSide);
|
||||
MechanicalNode instance = (MechanicalNode) ((INodeProvider) checkTile).getNode(MechanicalNode.class, placementSide);
|
||||
|
||||
if (instance != null && instance != this && instance.canConnect(checkDir.getOpposite(), this) && !(instance.parent instanceof PartGearShaft))
|
||||
{
|
||||
|
@ -263,7 +263,7 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
|
|||
|
||||
if (sourceTile instanceof INodeProvider)
|
||||
{
|
||||
MechanicalNode sourceInstance = ((INodeProvider) sourceTile).getNode(MechanicalNode.class, from);
|
||||
MechanicalNode sourceInstance = (MechanicalNode) ((INodeProvider) sourceTile).getNode(MechanicalNode.class, from);
|
||||
return sourceInstance == with;
|
||||
}
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
|
|||
|
||||
if (sourceTile instanceof INodeProvider)
|
||||
{
|
||||
MechanicalNode sourceInstance = ((INodeProvider) sourceTile).getNode(MechanicalNode.class, from.getOpposite());
|
||||
MechanicalNode sourceInstance = (MechanicalNode) ((INodeProvider) sourceTile).getNode(MechanicalNode.class, from.getOpposite());
|
||||
return sourceInstance == with;
|
||||
}
|
||||
}
|
||||
|
@ -518,10 +518,10 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
|
|||
}
|
||||
|
||||
@Override
|
||||
public <N extends INode> N getNode(Class<? super N> nodeType, ForgeDirection from)
|
||||
public INode getNode(Class<? extends INode> nodeType, ForgeDirection from)
|
||||
{
|
||||
if (nodeType.isAssignableFrom(node.getClass()))
|
||||
return (N) getMultiBlock().get().node;
|
||||
return getMultiBlock().get().node;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public class GearShaftNode extends MechanicalNode
|
|||
{
|
||||
if (shaft().tile() instanceof INodeProvider)
|
||||
{
|
||||
MechanicalNode instance = ((INodeProvider) shaft().tile()).getNode(MechanicalNode.class, checkDir);
|
||||
MechanicalNode instance = (MechanicalNode) ((INodeProvider) shaft().tile()).getNode(MechanicalNode.class, checkDir);
|
||||
|
||||
if (instance != null && instance != this && instance.canConnect(checkDir.getOpposite(), this))
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ public class GearShaftNode extends MechanicalNode
|
|||
|
||||
if (checkTile instanceof INodeProvider)
|
||||
{
|
||||
MechanicalNode instance = ((INodeProvider) checkTile).getNode(MechanicalNode.class, checkDir.getOpposite());
|
||||
MechanicalNode instance = (MechanicalNode) ((INodeProvider) checkTile).getNode(MechanicalNode.class, checkDir.getOpposite());
|
||||
|
||||
// Only connect to shafts outside of this block space.
|
||||
if (instance != null && instance != this && instance.parent instanceof PartGearShaft && instance.canConnect(checkDir.getOpposite(), this))
|
||||
|
|
|
@ -244,7 +244,7 @@ public class MechanicalNode extends Node<INodeProvider, TickingGrid, MechanicalN
|
|||
|
||||
if (tile instanceof INodeProvider)
|
||||
{
|
||||
MechanicalNode check = ((INodeProvider) tile).getNode(MechanicalNode.class, dir.getOpposite());
|
||||
MechanicalNode check = (MechanicalNode) ((INodeProvider) tile).getNode(MechanicalNode.class, dir.getOpposite());
|
||||
|
||||
if (check != null && canConnect(dir, check) && check.canConnect(dir.getOpposite(), this))
|
||||
{
|
||||
|
|
|
@ -70,10 +70,10 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
|||
}
|
||||
|
||||
@Override
|
||||
public <N extends INode> N getNode(Class<? super N> nodeType, ForgeDirection from)
|
||||
public INode getNode(Class<? extends INode> nodeType, ForgeDirection from)
|
||||
{
|
||||
if (nodeType.isAssignableFrom(node.getClass()))
|
||||
return (N) node;
|
||||
return node;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,10 +82,10 @@ public abstract class TileMechanical extends TileBase implements INodeProvider,
|
|||
}
|
||||
|
||||
@Override
|
||||
public <N extends INode> N getNode(Class<? super N> nodeType, ForgeDirection from)
|
||||
public INode getNode(Class<? extends INode> nodeType, ForgeDirection from)
|
||||
{
|
||||
if (nodeType.isAssignableFrom(mechanicalNode.getClass()))
|
||||
return (N) mechanicalNode;
|
||||
return mechanicalNode;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public class TileMechanicalTurbine extends TileTurbineBase implements INodeProvi
|
|||
|
||||
if (sourceTile instanceof INodeProvider)
|
||||
{
|
||||
MechanicalNode sourceInstance = ((INodeProvider) sourceTile).getNode(MechanicalNode.class, from.getOpposite());
|
||||
MechanicalNode sourceInstance = (MechanicalNode) ((INodeProvider) sourceTile).getNode(MechanicalNode.class, from.getOpposite());
|
||||
return sourceInstance == source && from == getDirection().getOpposite();
|
||||
}
|
||||
}
|
||||
|
@ -121,10 +121,10 @@ public class TileMechanicalTurbine extends TileTurbineBase implements INodeProvi
|
|||
}
|
||||
|
||||
@Override
|
||||
public <N extends INode> N getNode(Class<? super N> nodeType, ForgeDirection from)
|
||||
public INode getNode(Class<? extends INode> nodeType, ForgeDirection from)
|
||||
{
|
||||
if (nodeType.isAssignableFrom(mechanicalNode.getClass()))
|
||||
return (N) ((TileMechanicalTurbine) getMultiBlock().get()).mechanicalNode;
|
||||
return ((TileMechanicalTurbine) getMultiBlock().get()).mechanicalNode;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public class TileWaterTurbine extends TileMechanicalTurbine
|
|||
|
||||
if (sourceTile instanceof INodeProvider)
|
||||
{
|
||||
MechanicalNode sourceInstance = ((INodeProvider) sourceTile).getNode(MechanicalNode.class, from.getOpposite());
|
||||
MechanicalNode sourceInstance = (MechanicalNode) ((INodeProvider) sourceTile).getNode(MechanicalNode.class, from.getOpposite());
|
||||
return sourceInstance == source && (from == getDirection().getOpposite() || from == getDirection());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@ public class PartPipe extends PartFramedNode<EnumPipeMaterial, FluidPressureNode
|
|||
@Override
|
||||
public void doRecache()
|
||||
{
|
||||
|
||||
connections.clear();
|
||||
|
||||
if (world() != null)
|
||||
|
@ -65,7 +64,7 @@ public class PartPipe extends PartFramedNode<EnumPipeMaterial, FluidPressureNode
|
|||
{
|
||||
if (tile instanceof IPressureNodeProvider)
|
||||
{
|
||||
FluidPressureNode check = ((IPressureNodeProvider) tile).getNode(FluidPressureNode.class, dir.getOpposite());
|
||||
FluidPressureNode check = (FluidPressureNode) ((IPressureNodeProvider) tile).getNode(FluidPressureNode.class, dir.getOpposite());
|
||||
|
||||
if (check != null && canConnect(dir, check) && check.canConnect(dir.getOpposite(), this))
|
||||
{
|
||||
|
|
|
@ -153,10 +153,10 @@ public class TilePump extends TileMechanical implements IPressureNodeProvider, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public <N extends INode> N getNode(Class<? super N> nodeType, ForgeDirection from)
|
||||
public INode getNode(Class<? extends INode> nodeType, ForgeDirection from)
|
||||
{
|
||||
if (nodeType.isAssignableFrom(pressureNode.getClass()))
|
||||
return (N) pressureNode;
|
||||
return pressureNode;
|
||||
|
||||
return super.getNode(nodeType, from);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import codechicken.multipart.TileMultipart;
|
|||
public class TraitNodeProvider extends TileMultipart implements INodeProvider
|
||||
{
|
||||
@Override
|
||||
public <N extends INode> N getNode(Class<? super N> nodeType, ForgeDirection from)
|
||||
public INode getNode(Class<? extends INode> nodeType, ForgeDirection from)
|
||||
{
|
||||
TMultiPart part = this.partMap(from.ordinal());
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ public class FluidPressureNode extends Node<IPressureNodeProvider, TickingGrid,
|
|||
{
|
||||
IFluidHandler fluidHandler = (IFluidHandler) obj;
|
||||
int pressure = getPressure(dir);
|
||||
int tankPressure = fluidHandler instanceof IPressureNodeProvider ? ((IPressureNodeProvider) fluidHandler).getNode(FluidPressureNode.class, dir.getOpposite()).getPressure(dir.getOpposite()) : 0;
|
||||
int tankPressure = fluidHandler instanceof IPressureNodeProvider ? ((FluidPressureNode) ((IPressureNodeProvider) fluidHandler).getNode(FluidPressureNode.class, dir.getOpposite())).getPressure(dir.getOpposite()) : 0;
|
||||
FluidTank sourceTank = parent.getPressureTank();
|
||||
|
||||
int transferAmount = (Math.max(pressure, tankPressure) - Math.min(pressure, tankPressure)) * getMaxFlowRate();
|
||||
|
@ -220,7 +220,7 @@ public class FluidPressureNode extends Node<IPressureNodeProvider, TickingGrid,
|
|||
|
||||
if (tile instanceof IPressureNodeProvider)
|
||||
{
|
||||
FluidPressureNode check = ((IPressureNodeProvider) tile).getNode(FluidPressureNode.class, dir.getOpposite());
|
||||
FluidPressureNode check = (FluidPressureNode) ((IPressureNodeProvider) tile).getNode(FluidPressureNode.class, dir.getOpposite());
|
||||
|
||||
if (check != null && canConnect(dir, check) && check.canConnect(dir.getOpposite(), this))
|
||||
{
|
||||
|
|
|
@ -93,10 +93,10 @@ public abstract class TilePressureNode extends TileFluidNode implements IPressur
|
|||
}
|
||||
|
||||
@Override
|
||||
public <N extends INode> N getNode(Class<? super N> nodeType, ForgeDirection from)
|
||||
public INode getNode(Class<? extends INode> nodeType, ForgeDirection from)
|
||||
{
|
||||
if (nodeType.isAssignableFrom(node.getClass()))
|
||||
return (N) node;
|
||||
return node;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,9 +63,7 @@ public abstract class PartFramedNode<M extends Enum, N extends Node, T extends I
|
|||
|
||||
protected N node;
|
||||
|
||||
/**
|
||||
* Bitmask connections
|
||||
*/
|
||||
/** Bitmask connections */
|
||||
public byte currentConnections = 0x00;
|
||||
|
||||
/** Client Side */
|
||||
|
@ -110,9 +108,7 @@ public abstract class PartFramedNode<M extends Enum, N extends Node, T extends I
|
|||
return subParts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rendering and block bounds.
|
||||
*/
|
||||
/** Rendering and block bounds. */
|
||||
@Override
|
||||
public Iterable<Cuboid6> getCollisionBoxes()
|
||||
{
|
||||
|
@ -287,10 +283,15 @@ public abstract class PartFramedNode<M extends Enum, N extends Node, T extends I
|
|||
|
||||
@SuppressWarnings("hiding")
|
||||
@Override
|
||||
public <N extends INode> N getNode(Class<? super N> nodeType, ForgeDirection from)
|
||||
public INode getNode(Class<? extends INode> nodeType, ForgeDirection from)
|
||||
{
|
||||
if (node != null && nodeType != null)
|
||||
{
|
||||
if (nodeType.isAssignableFrom(node.getClass()))
|
||||
{
|
||||
return (N) node;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue