19 Mining and Block Regen
Jules edited this page 2025-10-20 13:58:17 +00:00

MMOCore features a custom mining system especially finetuned to RPG servers. Using this system, you can:

  • prevent players from destroying blocks and terrain while still allowing them to gather resources
  • have blocks naturally regenerate only after a set amount of time
  • setup fully custom block drop tables, while keeping or removing vanilla drops
  • have blocks give profession/main class experience when mined
  • require players to have a specific tool in order to break a block

xiL4NX0

Mining Experience Source

mineblock{type=BLOCK_MATERIAL;silk-touch=true;crop=false;player-placed=false}

Players earn experience by mining a specific type of block. These can be crops or ores; there are some specific options to help you prevent players from abusing this exp source. The list of all crops can be found in the default Farming profession config file.

Option Default Value Description
material --- The block you need to mine
silk-touch true When enabled, no EXP is earned when using silk touch
crop false When enabled, players don't get exp unless crops are fully grown
player-placed false When disabled, players don't get exp from blocks placed by players

Tool Restrictions

Tool restrictions (also called tool permission sets) define what blocks a specific item can mine. This is something you HAVE TO setup for custom mining to properly work; a common issue when not setting these up is not being able to break any block because your pickaxe does not let you break the block you're trying to mine.

Check this wiki page for more information.

Enabling custom mining

Head to your MMOCore/config.yml config file and look for the option called custom-mine-conditions. This is the list of all the conditions that a player must meet in order to enter regions where custom mining applies.

custom-mine-conditions:
  - 'world{name="world,world_nether,world_the_end"}'
  - 'region{name="example_region,example_region2,__global__"}'

This will disable custom mining entirely.

custom-mine-conditions: []

This will enable custom mining server wide.

custom-mine-conditions:
- 'world{name="__global__"}'

Last but not least toggling on the protect-custom-mine option will prevent players from destroying blocks that have no setup in the on-mine profession configuration section (see below). In other words, any block that has no drop/regen configuration would be protected by default.

Note that custom mining does not apply to creative mode.

Diamond Ore Example

The following example is part of the default /professions/mining.yml setup.

Note that in this example, custom mining is setup for ores (relative to the Mining profession), but you can also use custom mining to setup drop tables and exp for woodcutting (wood, logs...).

on-mine:

    # One rule for one type of block
    diamond:
        # The material you need to mine
        material: vanilla{type=DIAMOND_ORE}

        # The drop table/loot table used by the block.
        drop-table:
            items:
            - 'vanilla{type=DIAMOND} 1 1-3'
           # - 'mmoitem{type=material;id=RARE_DIAMOND} .1 1-3'
           # - 'droptable{id=other-drop-table} .1'
        
        # Triggers when destroying the block, can
        # be used to give exp to a player!
        triggers:
        - 'exp{profession=mining;amount=20}'
        
        options:
            # Set to false if you want to disable vanila drops.
            vanilla-drops: false
        
        regen:
        
            # Ticks the block takes to appear again
            time: 2000
            
            # The temporary block which shows
            # during the block regen time.
            #
            # !! Warning !!
            # When using the temp-block option, make sure you choose
            # one temp block and don't use it anywhere else in the
            # configuration so that block regens do not affect each other
            temp-block: vanilla{type=STONE}

This config does the following when a vanilla diamond ore is broken:

  • drop 1 to 3 diamonds in addition to the vanilla block drops
  • temporarily replace the block with a stone block (for 100 seconds)
  • give 20 Mining experience to the miner

Target Block

This parameter determines what block is affected. vanilla corresponds to the block type. There are three built-in block types in MMOCore: vanilla blocks, MMOItems custom blocks (only available when MMOItems is installed), and textured player heads/skulls.

on-mine:
    diamond_ore:
        material: vanilla{type=DIAMOND_ORE}
        # Other options:
        # material: vanilla{type=wheat;age=7}
        # material: mmoitems{id=10}
        # material: skull{value="........."}
        
        # .....

The following table provides all block types that are supported by the MMOCore custom mining system.

Block Type Description Example
MMOItems Custom Block When mining a MMOItems custom block. mmoitems{id=6}
Player Head When mining a player head with a custom texture. skull{value="aZd9fE8...48dfQX="}
Noteblock When mining a noteblock. note{note=1;instrument=PIANO}
Mushroom Block When mining a mushroom block. mushroom{type=MUSHROOM_STEM,faces="NORTH,EAST"}
Vanilla Block When mining any other block. Fallback. vanilla{type=DIAMOND_ORE}

Notes:

  • For player heads/skulls with textures, you need to provide the Base64 texture value of the skull, not the texture URL.
  • For noteblocks, the note is from 1 to 24. The list of intruments can be found in the Spigot javadocs.
  • For mushroom blocks, possible types are MUSHROOM_STEM, RED_MUSHROOM_BLOCK and BROWN_MUSHROOM_BLOCK. Available faces are UP, DOWN, NORTH, SOUTH, EAST, WEST.

Drop Table

This determines what drop table to call when the defined block is broken. It can either be a totally new drop table or a reference to an existing drop table from the /drop-tables folder. Please refer to this wiki page to learn about the syntax of drop tables.

on-mine:
    diamond_ore:
        # .....
        drop-table:
            items:
            - 'vanilla{type=DIAMOND} 1 1-3'
            - 'vanilla{type=COBBLESTONE} 1 1-3'
           # - 'mmoitem{type=material;id=RARE_DIAMOND} .1 1-3'
           # - 'droptable{id=other-drop-table} .1'

Vanilla Drops

Toggle on/off vanilla drops of the block being mined.

on-mine:
    diamond:
        # ....
        options:
            # Set to false if you want to disable vanila drops.
            vanilla-drops: false

Block Regen

time is the amount of time (in ticks) before the block reverts back to its initial state after being mined. temp-block is the block that will physically replace the broken block, indicating to players that it has recently been mined and that it is still regenerating (and therefore that it cannot be mined again just yet).

Note that the temp-block option (what temporary block to place) follows the exact same one-line JSON syntax as the material option (target block) described above.

on-mine:
    diamond_ore:
        # .....
        regen:
            time: 2000
            temp-block: 'vanilla{type=STONE}'

Known Issue with Player Heads

In recent Minecraft versions (1.20+), there is a known issue when using player heads as temporary blocks. If ALL of the following conditions are met,

  • vanilla drops are enabled
  • temporary block is set to a player head with texture
  • the target block is NOT a player head with texture.

Then the skull texture of the temporary skull block will not show.

Additional Example

on-mine:
    diamond_ore:
        # .....
    VOID_SHROOM:
        material: 'vanilla{type=BROWN_MUSHROOM}'
        conditions:
        - 'region{name=lapis,redstone}'
        drop-table:
            items:
            - 'mmoitem{type=QUEST;id=VOID_SHROOM} 1 1'
        options:
            vanilla-drops: false
        regen:
            time: 150
            temp-block: 'vanilla{type=BLACK_CONCRETE}'
        triggers:
        - 'exp{profession=mining;amount=4}'