#1937 reconnect to P2P ME tunnels after chunk load

This commit is contained in:
Matthias Mann committed 2015-02-17 17:08:33 +01:00
1 parent bcb15c725d
commit a7cb123f1a
2 files changed
+19 -4

No files matched your search

@@ -16,7 +16,6 @@ import appeng.api.networking.IGridHost;
import appeng.api.networking.IGridNode;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartHost;
import appeng.api.util.AECableType;
import cpw.mods.fml.common.Optional.Method;
import crazypants.enderio.EnderIO;
import crazypants.enderio.conduit.AbstractConduit;
@@ -128,15 +127,31 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
BlockCoord pos = getLocation();
TileEntity te = world.getTileEntity(pos.x + dir.offsetX, pos.y + dir.offsetY, pos.z + dir.offsetZ);
if(te instanceof TileConduitBundle) {
return false;
}
// because the AE2 API doesn't allow an easy query like "which side can connect to an ME cable" it needs this mess
if(te instanceof IPartHost) {
IPart part = ((IPartHost) te).getPart(dir.getOpposite());
if(part == null) {
part = ((IPartHost) te).getPart(ForgeDirection.UNKNOWN);
return part != null;
}
return part.getExternalFacingNode() != null;
if(part.getExternalFacingNode() != null) {
return true;
}
String name = part.getClass().getSimpleName();
return "PartP2PTunnelME".equals(name) || "PartQuartzFiber".endsWith(name) ||
"PartToggleBus".equals(name) || "PartInvertedToggleBus".equals(name);
} else if(te instanceof IGridHost) {
return !(te instanceof TileConduitBundle) && ((IGridHost) te).getCableConnectionType(dir.getOpposite()) != AECableType.NONE;
IGridNode node = ((IGridHost) te).getGridNode(dir.getOpposite());
if(node == null) {
node = ((IGridHost) te).getGridNode(ForgeDirection.UNKNOWN);
}
if(node != null) {
return node.getGridBlock().getConnectableSides().contains(dir.getOpposite());
}
}
return false;
}
@@ -14,7 +14,7 @@ import appeng.api.util.DimensionalCoord;
public class MEConduitGrid implements IGridBlock {
private IMEConduit conduit;
private final IMEConduit conduit;
public MEConduitGrid(IMEConduit conduit) {
this.conduit = conduit;