rvandoosselaer / Blocks

A block (voxel) engine for jMonkeyEngine
BSD 3-Clause "New" or "Revised" License
42 stars 14 forks source link

Request for adding a BlockRegistry.remove() method for removing registered block #20

Closed Ali-RS closed 4 years ago

Ali-RS commented 4 years ago

Useful in editors.

    public boolean remove(Block block) {
        return remove(block.getName());
    }

    public boolean remove(String name) {
       if(registry.containsKey(name)) {
           Block remove = registry.remove(name);
           if (log.isTraceEnabled()) {
               log.trace("Removed block {} -> {}", name, remove);
           }
           return true;
       }
       return false;
    }
rvandoosselaer commented 4 years ago

Hey @Ali-RS, thanks for the input. It can be a useful addition to the registry to be able to remove a specific block.

If you want you can create a PR for it so it will be added in the next release.

Ali-RS commented 4 years ago

Done