16 Mining and Block Regen
Taner edited this page 2023-05-25 11:14:18 +00:00

MMOCore features a custom mining system that is much more adapted to RPG servers. Using this system you can:

  • prevent players from actually destroying blocks while conserving block drops for resource gathering
  • have blocks regen only after a certain period of time
  • have fully configurable drop tables for blocks (supports MMOItems)
  • have blocks give profession/main class experience when mined
  • keep or remove vanilla block drops
  • require players to have a specific tool in order to break a block

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](Tool Restrictions) for more information.

Enabling custom mining

Head to your MMOCore/config.yml config file and edit the custom-mine-conditions option. This is the list of all the conditions that a player must meet in order to undergo custom mining. Here is the default setup:

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).

Custom mining is fully disabled in creative mode.

Config Example

The following example is part of the default /professions/mining.yml default setup. Remember you can copy and paste this code snippet in any profession file! You can setup custom ore drops for mining but also custom log drops for woodcutting, etc (the custom mining system is not limited to mining).

on-mine:
    diamond:
        # The material you need to mine
        material: vanilla{type=DIAMOND_ORE}

        # Refer to drop-tables.yml
        # The drop 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}

Specified Block

This determines what block is affected when broken. vanilla indicates the block type: there are three [block types](Block Types) available: vanilla blocks, MMOItems custom blocks (only available when MMOItems is installed), and custom textured player heads.

        material: vanilla{type=DIAMOND_ORE}
        #material: vanilla{type=wheat;age=7}

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 the ID of another drop table, which you set up previously, using the /drop-tables folder. Learn to setup drop tables [here](Drop Tables).

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

Extra options

These are extra options you can utilize to change block behavior (only one atm).

Option Description Default Value
vanilla-drops Disables vanilla block drops when toggled off. True
Condition Description
region Which WorldGuard Region must this block be mined in?

Block Regen

        regen:
            time: 2000

This is the time in ticks before the block reverts back to its defined block, in this case it is diamond ore. You will also need to setup the block that will replace the mined block during this time interval (this option is called the temporary block).

            temp-block: vanilla{type=STONE}

Extra Example

    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}'