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); } } } }
public static BlockFaces fromOffset(Vector3 offset) { return offsetHash.get(getOffsetHash(offset)); }
public void addAllBlocks(Map<Byte, Block> blocks) { _blocksById.putAll(blocks); for (Block b : blocks.values()) { _blocksByTitle.put(b.getTitle(), b); } }
public void removeBlock(Block block) { _blocksById.remove(block.getId()); _blocksByTitle.remove(block.getTitle()); }
public void addBlock(Block block) { _blocksById.put(block.getId(), block); _blocksByTitle.put(block.getTitle(), block); }
public int availableBlocksSize() { return _blocksById.size(); }
public Block getBlock(byte id) { return _blocksById.get(id); }