public boolean detectSize()
{
if (this.mode != TileEntityStructure.Mode.SAVE)
{
return false;
}
else
{
BlockPos blockpos = this.getPos();
int i = 80;
BlockPos blockpos1 = new BlockPos(blockpos.getX() - 80, 0, blockpos.getZ() - 80);
BlockPos blockpos2 = new BlockPos(blockpos.getX() + 80, 255, blockpos.getZ() + 80);
List<TileEntityStructure> list = this.getNearbyCornerBlocks(blockpos1, blockpos2);
List<TileEntityStructure> list1 = this.filterRelatedCornerBlocks(list);
if (list1.size() < 1)
{
return false;
}
else
{
StructureBoundingBox structureboundingbox = this.calculateEnclosingBoundingBox(blockpos, list1);
if (structureboundingbox.maxX - structureboundingbox.minX > 1 && structureboundingbox.maxY - structureboundingbox.minY > 1 && structureboundingbox.maxZ - structureboundingbox.minZ > 1)
{
this.position = new BlockPos(structureboundingbox.minX - blockpos.getX() + 1, structureboundingbox.minY - blockpos.getY() + 1, structureboundingbox.minZ - blockpos.getZ() + 1);
this.size = new BlockPos(structureboundingbox.maxX - structureboundingbox.minX - 1, structureboundingbox.maxY - structureboundingbox.minY - 1, structureboundingbox.maxZ - structureboundingbox.minZ - 1);
this.markDirty();
IBlockState iblockstate = this.world.getBlockState(blockpos);
this.world.notifyBlockUpdate(blockpos, iblockstate, iblockstate, 3);
return true;
}
else
{
return false;
}
}
}
}
TileEntityStructure.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:Backmemed
作者:
评论列表
文章目录