/** Returns the bounding box of the specific template. Used to make sure it doesn't intersect with other rooms. */
public static StructureBoundingBox getStructureBoundingBox(Template template, Rotation rotation, BlockPos center)
{
int minX = 0;
int maxX = 0;
int minY = 0;
int maxY = 0;
int minZ = 0;
int maxZ = 0;
// we offset everything by one to get the inner room with walls, ceilings, or floors. Rooms can connect through walls so we want those checks to pass.
if (rotation == Rotation.NONE || rotation == Rotation.CLOCKWISE_180)
{
minX = center.getX() - (template.getSize().getX() / 2) - 1;
maxX = center.getX() + (template.getSize().getX() / 2) - 1;
minY = center.getY() + 1;
maxY = center.getY() + template.getSize().getY() - 1;
minZ = center.getZ() - (template.getSize().getZ() / 2) - 1;
maxZ = center.getZ() + (template.getSize().getZ() / 2) - 1;
}
else
{
minX = center.getX() - (template.getSize().getZ() / 2) - 1;
maxX = center.getX() + (template.getSize().getZ() / 2) - 1;
minY = center.getY() + 1;
maxY = center.getY() + template.getSize().getY() - 1;
minZ = center.getZ() - (template.getSize().getX() / 2) - 1;
maxZ = center.getZ() + (template.getSize().getX() / 2) - 1;
}
return new StructureBoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
}
DungeonHelper.java 文件源码
java
阅读 17
收藏 0
点赞 0
评论 0
项目:Loot-Slash-Conquer
作者:
评论列表
文章目录