Ejemplo n.º 1
0
 @Override
 public int getBlockIdAt(BlockLocation blockLocation) {
   ChunkLocation location = new ChunkLocation(blockLocation);
   BlockLocation chunkBlockOffset = new BlockLocation(location);
   Chunk chunk = getChunkAt(location);
   if (chunk == null) return 0;
   int id =
       chunk.getBlockIdAt(
           blockLocation.getX() - chunkBlockOffset.getX(),
           blockLocation.getY() - chunkBlockOffset.getY(),
           blockLocation.getZ() - chunkBlockOffset.getZ());
   return id;
 }
Ejemplo n.º 2
0
 @Override
 public Block getBlockAt(BlockLocation location) {
   ChunkLocation chunkLocation = new ChunkLocation(location);
   Chunk chunk = getChunkAt(chunkLocation);
   if (chunk == null) return null;
   BlockLocation chunkBlockOffset = new BlockLocation(chunkLocation);
   int chunkOffsetX = location.getX() - chunkBlockOffset.getX();
   int chunkOffsetY = location.getY() - chunkBlockOffset.getY();
   int chunkOffsetZ = location.getZ() - chunkBlockOffset.getZ();
   int id = chunk.getBlockIdAt(chunkOffsetX, chunkOffsetY, chunkOffsetZ);
   int metadata = chunk.getBlockMetadataAt(chunkOffsetX, chunkOffsetY, chunkOffsetZ);
   return new Block(this, chunk, location, id, metadata);
 }