Ejemplo n.º 1
0
 static {
   for (BlockFace face1 : new BlockFace[] {BlockFace.THIS, BlockFace.TOP, BlockFace.BOTTOM}) {
     for (BlockFace face2 : new BlockFace[] {BlockFace.THIS, BlockFace.WEST, BlockFace.EAST}) {
       for (BlockFace face3 : new BlockFace[] {BlockFace.THIS, BlockFace.NORTH, BlockFace.SOUTH}) {
         BlockFaces faces = new BlockFaces(face1, face2, face3);
         Vector3 offset = faces.getOffset();
         byte hash = getOffsetHash(offset);
         offsetHash.put(hash, faces);
       }
     }
   }
 }
Ejemplo n.º 2
0
 public static BlockFaces fromOffset(Vector3 offset) {
   return offsetHash.get(getOffsetHash(offset));
 }
Ejemplo n.º 3
0
 public void addAllBlocks(Map<Byte, Block> blocks) {
   _blocksById.putAll(blocks);
   for (Block b : blocks.values()) {
     _blocksByTitle.put(b.getTitle(), b);
   }
 }
Ejemplo n.º 4
0
 public void removeBlock(Block block) {
   _blocksById.remove(block.getId());
   _blocksByTitle.remove(block.getTitle());
 }
Ejemplo n.º 5
0
 public void addBlock(Block block) {
   _blocksById.put(block.getId(), block);
   _blocksByTitle.put(block.getTitle(), block);
 }
Ejemplo n.º 6
0
 public int availableBlocksSize() {
   return _blocksById.size();
 }
Ejemplo n.º 7
0
 public Block getBlock(byte id) {
   return _blocksById.get(id);
 }