BlockUtils.java 文件源码

java
阅读 37 收藏 0 点赞 0 评论 0

项目:Framez 作者:
@SuppressWarnings("rawtypes")
public static void removeTileEntity(World world, int x, int y, int z, boolean removeFromChunk, boolean removeFromWorld) {

    Chunk chunk = world.getChunkFromChunkCoords(x >> 4, z >> 4);
    TileEntity te = null;
    if (chunk != null) {
        if (removeFromChunk) {
            te = (TileEntity) chunk.chunkTileEntityMap.remove(new ChunkPosition(x & 15, y, z & 15));
        } else {
            te = (TileEntity) chunk.chunkTileEntityMap.get(new ChunkPosition(x & 15, y, z & 15));
        }
    }

    if (te != null && removeFromWorld) {
        Iterator it = world.loadedTileEntityList.iterator();
        while (it.hasNext()) {
            TileEntity tile = (TileEntity) it.next();
            if (tile == te)
                it.remove();
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号