2016-01-12 12:23:26 -05:00
|
|
|
package WayofTime.bloodmagic.routing;
|
|
|
|
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2016-03-17 13:00:44 -07:00
|
|
|
import net.minecraft.util.math.BlockPos;
|
2016-01-12 12:23:26 -05:00
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
public class NodeHelper {
|
|
|
|
public static boolean isNodeConnectionEnabled(World world, IRoutingNode node, BlockPos testPos) {
|
|
|
|
if (!node.isConnectionEnabled(testPos)) {
|
2016-01-12 12:23:26 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
TileEntity tile = world.getTileEntity(testPos);
|
2017-08-15 21:30:48 -07:00
|
|
|
if (!(tile instanceof IRoutingNode)) {
|
2016-01-12 12:23:26 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
IRoutingNode testNode = (IRoutingNode) tile;
|
|
|
|
|
|
|
|
return testNode.isConnectionEnabled(node.getBlockPos());
|
|
|
|
}
|
|
|
|
}
|