BloodMagic/src/main/java/WayofTime/bloodmagic/routing/NodeHelper.java

22 lines
640 B
Java
Raw Normal View History

package WayofTime.bloodmagic.routing;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
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)) {
return false;
}
TileEntity tile = world.getTileEntity(testPos);
2017-08-15 21:30:48 -07:00
if (!(tile instanceof IRoutingNode)) {
return false;
}
IRoutingNode testNode = (IRoutingNode) tile;
return testNode.isConnectionEnabled(node.getBlockPos());
}
}