예제 #1
0
 @Override
 public void setBlockMetadataAt(int metadata, BlockLocation blockLocation) {
   ChunkLocation location = new ChunkLocation(blockLocation);
   BlockLocation chunkBlockOffset = new BlockLocation(location);
   Chunk chunk = getChunkAt(location);
   if (chunk == null) return;
   chunk.setBlockMetadataAt(
       metadata,
       blockLocation.getX() - chunkBlockOffset.getX(),
       blockLocation.getY() - chunkBlockOffset.getY(),
       blockLocation.getZ() - chunkBlockOffset.getZ());
 }
예제 #2
0
 @Override
 public int getBlockMetadataAt(BlockLocation blockLocation) {
   ChunkLocation location = new ChunkLocation(blockLocation);
   BlockLocation chunkBlockOffset = new BlockLocation(location);
   Chunk chunk = getChunkAt(location);
   if (chunk == null) return 0;
   int metadata =
       chunk.getBlockMetadataAt(
           blockLocation.getX() - chunkBlockOffset.getX(),
           blockLocation.getY() - chunkBlockOffset.getY(),
           blockLocation.getZ() - chunkBlockOffset.getZ());
   return metadata;
 }
예제 #3
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);
 }