Fixed connecting to un-interfacable TE sides

This commit is contained in:
Calclavia 2013-12-01 15:27:58 +08:00
parent ab32553c2d
commit 57bcf19035
3 changed files with 15 additions and 5 deletions

View file

@ -75,7 +75,7 @@ public abstract class PartConductor extends PartAdvanced implements IConductor
public boolean canConnectBothSides(TileEntity tile, ForgeDirection side)
{
boolean notPrevented = !connectionPrevented(tile, side);
boolean notPrevented = !this.isConnectionPrevented(tile, side);
if (tile instanceof IConnector)
{
@ -97,7 +97,7 @@ public abstract class PartConductor extends PartAdvanced implements IConductor
* @param side The side we're checking
* @return Whether we're preventing connections on given side or to given tileEntity
*/
public boolean connectionPrevented(TileEntity tile, ForgeDirection side)
public boolean isConnectionPrevented(TileEntity tile, ForgeDirection side)
{
return false;
}
@ -217,7 +217,7 @@ public abstract class PartConductor extends PartAdvanced implements IConductor
{
Vector3 connectPos = new Vector3(tile()).modifyPositionFromSide(direction);
TileEntity connectTile = connectPos.getTileEntity(this.world());
return !connectionPrevented(connectTile, direction);
return !isConnectionPrevented(connectTile, direction);
}
@Override

View file

@ -55,6 +55,17 @@ public abstract class PartUniversalConductor extends PartConductor implements IE
return super.isValidAcceptor(tile);
}
@Override
public boolean isConnectionPrevented(TileEntity tile, ForgeDirection side)
{
if (tile instanceof IEnergyHandler)
{
return !((IEnergyHandler) tile).canInterface(side);
}
return super.isConnectionPrevented(tile, side);
}
@Override
public void onWorldJoin()
{
@ -208,7 +219,6 @@ public abstract class PartUniversalConductor extends PartConductor implements IE
/**
* Thermal Expansion Functions
*/
@Override
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate)
{

View file

@ -103,7 +103,7 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN
}
@Override
public boolean connectionPrevented(TileEntity tile, ForgeDirection side)
public boolean isConnectionPrevented(TileEntity tile, ForgeDirection side)
{
if (tile instanceof IWireMaterial)
{