Changes for Return type change for INodeProvider

This commit is contained in:
Robert S 2014-05-23 01:15:46 -04:00
parent 5d44e79e5b
commit aff169b0b2
17 changed files with 264 additions and 264 deletions

View file

@ -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))
{

View file

@ -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;

View file

@ -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;
}
}

View file

@ -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));

View file

@ -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;
}

View file

@ -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))

View file

@ -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))
{

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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());
}
}

View file

@ -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))
{

View file

@ -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);
}

View file

@ -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());

View file

@ -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))
{

View file

@ -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;
}
}

View file

@ -38,273 +38,274 @@ import cpw.mods.fml.relauncher.SideOnly;
public abstract class PartFramedNode<M extends Enum, N extends Node, T extends INodeProvider> extends PartColorableMaterial<M> implements INodeProvider, TSlottedPart, JNormalOcclusion, IHollowConnect, JIconHitEffects
{
public static IndexedCuboid6[] sides = new IndexedCuboid6[7];
public static IndexedCuboid6[] insulatedSides = new IndexedCuboid6[7];
public static IndexedCuboid6[] sides = new IndexedCuboid6[7];
public static IndexedCuboid6[] insulatedSides = new IndexedCuboid6[7];
static
{
sides[0] = new IndexedCuboid6(0, new Cuboid6(0.36, 0.000, 0.36, 0.64, 0.36, 0.64));
sides[1] = new IndexedCuboid6(1, new Cuboid6(0.36, 0.64, 0.36, 0.64, 1.000, 0.64));
sides[2] = new IndexedCuboid6(2, new Cuboid6(0.36, 0.36, 0.000, 0.64, 0.64, 0.36));
sides[3] = new IndexedCuboid6(3, new Cuboid6(0.36, 0.36, 0.64, 0.64, 0.64, 1.000));
sides[4] = new IndexedCuboid6(4, new Cuboid6(0.000, 0.36, 0.36, 0.36, 0.64, 0.64));
sides[5] = new IndexedCuboid6(5, new Cuboid6(0.64, 0.36, 0.36, 1.000, 0.64, 0.64));
sides[6] = new IndexedCuboid6(6, new Cuboid6(0.36, 0.36, 0.36, 0.64, 0.64, 0.64));
insulatedSides[0] = new IndexedCuboid6(0, new Cuboid6(0.3, 0.0, 0.3, 0.7, 0.3, 0.7));
insulatedSides[1] = new IndexedCuboid6(1, new Cuboid6(0.3, 0.7, 0.3, 0.7, 1.0, 0.7));
insulatedSides[2] = new IndexedCuboid6(2, new Cuboid6(0.3, 0.3, 0.0, 0.7, 0.7, 0.3));
insulatedSides[3] = new IndexedCuboid6(3, new Cuboid6(0.3, 0.3, 0.7, 0.7, 0.7, 1.0));
insulatedSides[4] = new IndexedCuboid6(4, new Cuboid6(0.0, 0.3, 0.3, 0.3, 0.7, 0.7));
insulatedSides[5] = new IndexedCuboid6(5, new Cuboid6(0.7, 0.3, 0.3, 1.0, 0.7, 0.7));
insulatedSides[6] = new IndexedCuboid6(6, new Cuboid6(0.3, 0.3, 0.3, 0.7, 0.7, 0.7));
}
static
{
sides[0] = new IndexedCuboid6(0, new Cuboid6(0.36, 0.000, 0.36, 0.64, 0.36, 0.64));
sides[1] = new IndexedCuboid6(1, new Cuboid6(0.36, 0.64, 0.36, 0.64, 1.000, 0.64));
sides[2] = new IndexedCuboid6(2, new Cuboid6(0.36, 0.36, 0.000, 0.64, 0.64, 0.36));
sides[3] = new IndexedCuboid6(3, new Cuboid6(0.36, 0.36, 0.64, 0.64, 0.64, 1.000));
sides[4] = new IndexedCuboid6(4, new Cuboid6(0.000, 0.36, 0.36, 0.36, 0.64, 0.64));
sides[5] = new IndexedCuboid6(5, new Cuboid6(0.64, 0.36, 0.36, 1.000, 0.64, 0.64));
sides[6] = new IndexedCuboid6(6, new Cuboid6(0.36, 0.36, 0.36, 0.64, 0.64, 0.64));
insulatedSides[0] = new IndexedCuboid6(0, new Cuboid6(0.3, 0.0, 0.3, 0.7, 0.3, 0.7));
insulatedSides[1] = new IndexedCuboid6(1, new Cuboid6(0.3, 0.7, 0.3, 0.7, 1.0, 0.7));
insulatedSides[2] = new IndexedCuboid6(2, new Cuboid6(0.3, 0.3, 0.0, 0.7, 0.7, 0.3));
insulatedSides[3] = new IndexedCuboid6(3, new Cuboid6(0.3, 0.3, 0.7, 0.7, 0.7, 1.0));
insulatedSides[4] = new IndexedCuboid6(4, new Cuboid6(0.0, 0.3, 0.3, 0.3, 0.7, 0.7));
insulatedSides[5] = new IndexedCuboid6(5, new Cuboid6(0.7, 0.3, 0.3, 1.0, 0.7, 0.7));
insulatedSides[6] = new IndexedCuboid6(6, new Cuboid6(0.3, 0.3, 0.3, 0.7, 0.7, 0.7));
}
protected Object[] connections = new Object[6];
protected Object[] connections = new Object[6];
protected N node;
protected N node;
/**
* Bitmask connections
*/
public byte currentConnections = 0x00;
/** Bitmask connections */
public byte currentConnections = 0x00;
/** Client Side */
private ForgeDirection testingSide;
/** Client Side */
private ForgeDirection testingSide;
@SideOnly(Side.CLIENT)
protected Icon breakIcon;
@SideOnly(Side.CLIENT)
protected Icon breakIcon;
public PartFramedNode(Item insulationType)
{
super(insulationType);
}
public PartFramedNode(Item insulationType)
{
super(insulationType);
}
public void preparePlacement(int meta)
{
this.setMaterial(meta);
}
public void preparePlacement(int meta)
{
this.setMaterial(meta);
}
@Override
public boolean occlusionTest(TMultiPart other)
{
return NormalOcclusionTest.apply(this, other);
}
@Override
public boolean occlusionTest(TMultiPart other)
{
return NormalOcclusionTest.apply(this, other);
}
@Override
public Iterable<IndexedCuboid6> getSubParts()
{
Set<IndexedCuboid6> subParts = new HashSet<IndexedCuboid6>();
IndexedCuboid6[] currentSides = isInsulated() ? insulatedSides : sides;
@Override
public Iterable<IndexedCuboid6> getSubParts()
{
Set<IndexedCuboid6> subParts = new HashSet<IndexedCuboid6>();
IndexedCuboid6[] currentSides = isInsulated() ? insulatedSides : sides;
if (tile() != null)
{
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
int ord = side.ordinal();
if (connectionMapContainsSide(getAllCurrentConnections(), side) || side == testingSide)
subParts.add(currentSides[ord]);
}
}
if (tile() != null)
{
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
int ord = side.ordinal();
if (connectionMapContainsSide(getAllCurrentConnections(), side) || side == testingSide)
subParts.add(currentSides[ord]);
}
}
subParts.add(currentSides[6]);
return subParts;
}
subParts.add(currentSides[6]);
return subParts;
}
/**
* Rendering and block bounds.
*/
@Override
public Iterable<Cuboid6> getCollisionBoxes()
{
Set<Cuboid6> collisionBoxes = new HashSet<Cuboid6>();
collisionBoxes.addAll((Collection<? extends Cuboid6>) getSubParts());
/** Rendering and block bounds. */
@Override
public Iterable<Cuboid6> getCollisionBoxes()
{
Set<Cuboid6> collisionBoxes = new HashSet<Cuboid6>();
collisionBoxes.addAll((Collection<? extends Cuboid6>) getSubParts());
return collisionBoxes;
}
return collisionBoxes;
}
@Override
public float getStrength(MovingObjectPosition hit, EntityPlayer player)
{
return 10F;
}
@Override
public float getStrength(MovingObjectPosition hit, EntityPlayer player)
{
return 10F;
}
@Override
public void drawBreaking(RenderBlocks renderBlocks)
{
if (breakIcon != null)
{
CCRenderState.reset();
RenderUtils.renderBlock(sides[6], 0, new Translation(x(), y(), z()), new IconTransformation(breakIcon), null);
}
}
@Override
public void drawBreaking(RenderBlocks renderBlocks)
{
if (breakIcon != null)
{
CCRenderState.reset();
RenderUtils.renderBlock(sides[6], 0, new Translation(x(), y(), z()), new IconTransformation(breakIcon), null);
}
}
@Override
public Cuboid6 getBounds()
{
return new Cuboid6(0.375, 0.375, 0.375, 0.625, 0.625, 0.625);
}
@Override
public Cuboid6 getBounds()
{
return new Cuboid6(0.375, 0.375, 0.375, 0.625, 0.625, 0.625);
}
@Override
public Icon getBreakingIcon(Object subPart, int side)
{
return breakIcon;
}
@Override
public Icon getBreakingIcon(Object subPart, int side)
{
return breakIcon;
}
@Override
public Icon getBrokenIcon(int side)
{
return breakIcon;
}
@Override
public Icon getBrokenIcon(int side)
{
return breakIcon;
}
@Override
public Iterable<Cuboid6> getOcclusionBoxes()
{
return getCollisionBoxes();
}
@Override
public Iterable<Cuboid6> getOcclusionBoxes()
{
return getCollisionBoxes();
}
@Override
public int getSlotMask()
{
return PartMap.CENTER.mask;
}
@Override
public int getSlotMask()
{
return PartMap.CENTER.mask;
}
@Override
public int getHollowSize()
{
return isInsulated ? 8 : 6;
}
@Override
public int getHollowSize()
{
return isInsulated ? 8 : 6;
}
@Override
public void addHitEffects(MovingObjectPosition hit, EffectRenderer effectRenderer)
{
IconHitEffects.addHitEffects(this, hit, effectRenderer);
}
@Override
public void addHitEffects(MovingObjectPosition hit, EffectRenderer effectRenderer)
{
IconHitEffects.addHitEffects(this, hit, effectRenderer);
}
@Override
public void addDestroyEffects(EffectRenderer effectRenderer)
{
IconHitEffects.addDestroyEffects(this, effectRenderer, false);
}
@Override
public void addDestroyEffects(EffectRenderer effectRenderer)
{
IconHitEffects.addDestroyEffects(this, effectRenderer, false);
}
public boolean isBlockedOnSide(ForgeDirection side)
{
TMultiPart blocker = tile().partMap(side.ordinal());
testingSide = side;
boolean expandable = NormalOcclusionTest.apply(this, blocker);
testingSide = null;
return !expandable;
}
public boolean isBlockedOnSide(ForgeDirection side)
{
TMultiPart blocker = tile().partMap(side.ordinal());
testingSide = side;
boolean expandable = NormalOcclusionTest.apply(this, blocker);
testingSide = null;
return !expandable;
}
public byte getAllCurrentConnections()
{
return (currentConnections);
}
public byte getAllCurrentConnections()
{
return (currentConnections);
}
public static boolean connectionMapContainsSide(byte connections, ForgeDirection side)
{
byte tester = (byte) (1 << side.ordinal());
return ((connections & tester) > 0);
}
public static boolean connectionMapContainsSide(byte connections, ForgeDirection side)
{
byte tester = (byte) (1 << side.ordinal());
return ((connections & tester) > 0);
}
@Override
public void bind(TileMultipart t)
{
node.deconstruct();
super.bind(t);
node.reconstruct();
}
@Override
public void bind(TileMultipart t)
{
node.deconstruct();
super.bind(t);
node.reconstruct();
}
public boolean isCurrentlyConnected(ForgeDirection side)
{
return connectionMapContainsSide(getAllCurrentConnections(), side);
}
public boolean isCurrentlyConnected(ForgeDirection side)
{
return connectionMapContainsSide(getAllCurrentConnections(), side);
}
@Override
public void onWorldJoin()
{
node.reconstruct();
}
@Override
public void onWorldJoin()
{
node.reconstruct();
}
@Override
public void onNeighborChanged()
{
node.reconstruct();
}
@Override
public void onNeighborChanged()
{
node.reconstruct();
}
@Override
public void onWorldSeparate()
{
node.deconstruct();
}
@Override
public void onWorldSeparate()
{
node.deconstruct();
}
public void copyFrom(PartFramedNode<M, N, T> other)
{
this.isInsulated = other.isInsulated;
this.color = other.color;
this.connections = other.connections;
this.material = other.material;
}
public void copyFrom(PartFramedNode<M, N, T> other)
{
this.isInsulated = other.isInsulated;
this.color = other.color;
this.connections = other.connections;
this.material = other.material;
}
/** Packet Methods */
public void sendConnectionUpdate()
{
tile().getWriteStream(this).writeByte(0).writeByte(currentConnections);
}
/** Packet Methods */
public void sendConnectionUpdate()
{
tile().getWriteStream(this).writeByte(0).writeByte(currentConnections);
}
@Override
public void readDesc(MCDataInput packet)
{
super.readDesc(packet);
currentConnections = packet.readByte();
}
@Override
public void readDesc(MCDataInput packet)
{
super.readDesc(packet);
currentConnections = packet.readByte();
}
@Override
public void writeDesc(MCDataOutput packet)
{
super.writeDesc(packet);
packet.writeByte(currentConnections);
}
@Override
public void writeDesc(MCDataOutput packet)
{
super.writeDesc(packet);
packet.writeByte(currentConnections);
}
@Override
public void read(MCDataInput packet)
{
read(packet, packet.readUByte());
}
@Override
public void read(MCDataInput packet)
{
read(packet, packet.readUByte());
}
@Override
public void read(MCDataInput packet, int packetID)
{
if (packetID == 0)
{
currentConnections = packet.readByte();
tile().markRender();
}
else
{
super.read(packet, packetID);
}
}
@Override
public void read(MCDataInput packet, int packetID)
{
if (packetID == 0)
{
currentConnections = packet.readByte();
tile().markRender();
}
else
{
super.read(packet, packetID);
}
}
@SuppressWarnings("hiding")
@Override
public <N extends INode> N getNode(Class<? super N> nodeType, ForgeDirection from)
{
if (nodeType.isAssignableFrom(node.getClass()))
return (N) node;
return null;
}
@SuppressWarnings("hiding")
@Override
public INode getNode(Class<? extends INode> nodeType, ForgeDirection from)
{
if (node != null && nodeType != null)
{
if (nodeType.isAssignableFrom(node.getClass()))
{
return (N) node;
}
}
return null;
}
@Override
public void save(NBTTagCompound nbt)
{
super.save(nbt);
node.save(nbt);
}
@Override
public void save(NBTTagCompound nbt)
{
super.save(nbt);
node.save(nbt);
}
@Override
public void load(NBTTagCompound nbt)
{
super.load(nbt);
node.load(nbt);
}
@Override
public void load(NBTTagCompound nbt)
{
super.load(nbt);
node.load(nbt);
}
}