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

26 lines
660 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;
public class NodeHelper
{
public static boolean isNodeConnectionEnabled(World world, IRoutingNode node, BlockPos testPos)
{
if (!node.isConnectionEnabled(testPos))
{
return false;
}
TileEntity tile = world.getTileEntity(testPos);
if (!(tile instanceof IRoutingNode))
{
return false;
}
IRoutingNode testNode = (IRoutingNode) tile;
return testNode.isConnectionEnabled(node.getBlockPos());
}
}