public static TileEntity getTileEntitySafe(World world, BlockPos pos) { if (world.isBlockLoaded(pos)) { Chunk chunk = world.getChunkFromBlockCoords(pos); return chunk.getTileEntity(pos, EnumCreateEntityType.CHECK); } return null; }
protected TileEntityTank getNeighourTank(BlockPos pos) { if (!world.isBlockLoaded(pos)) return null; Chunk chunk = world.getChunkFromBlockCoords(pos); TileEntity te = chunk.getTileEntity(pos, EnumCreateEntityType.CHECK); return (te instanceof TileEntityTank)? (TileEntityTank)te : null; }
@Override public @Nullable TileEntity getTileEntity() { if (world instanceof ChunkCache) { return ((ChunkCache) world).getTileEntity(pos, EnumCreateEntityType.CHECK); } return world.getTileEntity(pos); }