public BlockRigidBody[] addLootableBlocks(Vector3f position, Block block) {
    BlockRigidBody result[] = new BlockRigidBody[8];

    for (int i = 0; i < block.getLootAmount(); i++) {
      // Position the smaller blocks
      Vector3f offsetPossition =
          new Vector3f(
              (float) _random.randomDouble() * 0.5f,
              (float) _random.randomDouble() * 0.5f,
              (float) _random.randomDouble() * 0.5f);
      offsetPossition.add(position);

      result[i] =
          addBlock(
              offsetPossition,
              block.getId(),
              new Vector3f(0.0f, 4000f, 0.0f),
              BLOCK_SIZE.QUARTER_SIZE,
              false);
    }

    return result;
  }
Example #2
0
 public void removeBlock(Block block) {
   _blocksById.remove(block.getId());
   _blocksByTitle.remove(block.getTitle());
 }
Example #3
0
 public void addBlock(Block block) {
   _blocksById.put(block.getId(), block);
   _blocksByTitle.put(block.getTitle(), block);
 }