Skip to content

OnapleRPG/Harvester

Repository files navigation

Harvester Github Action Reliability Rating License sponge version

Harvester is a Sponge Minecraft plugin that restricts block break events for every non-creative players, according to the rules described in a configuration file. It handles block reappearance, so you can have a mining system with regenerating resources.

Installation

On a sponge server 1.12, download our latest release, and drop the file into your server's mods/ folder. Restart your server.
Default configuration files should be generated into your /config folder, and your server logs should include a line about Harvester being loaded.

Configuration file

Different configuration files exist to declare how Harvester should change block breaks and drop events.
They can be found in your config/harvester/ folder.

Global configuration

Global configuration is used for a few settings. It should be set within a global.conf file if you wish to override the default behavior.

  • You can set worlds where you want Harvester to be enabled within the global.conf. Please note that world name are case sensitive. (by default, every worlds will be taken into account)
  • You can also prevent block growth by setting the blockGrowth boolean to false. Useful if you don't want crops to grow (for instance if you use the crops different stage textures for multiple purpose). If equal to true or non specified, crops will grow normally.
worlds = ["worldName1","WorldName2"]
blockGrowth = true

Harvest regeneration

A file named harvestables.conf is required within the harvester config folder.
This file is going to describe which blocks can be broken, and when they will respawn.

The file uses HOCON format, and must begin with the array harvestables.
For each block that can be mined, you must specify some data :

  • The type field must contain the blocktype id (ex : minecraft:iron_ore)
  • respawnmin is the minimum amount of minutes before block respawn
  • respawnmax is the maximum amount of minutes before block respawn
  • (Optional) The state object can contain a list of BlockState to authorize only a given subtype of block to be mined (like log/stone variants)
harvestables = [
    {
        type: "minecraft:dirt",
        respawnmin: 2,
        respawnmax: 5
    },
    {
        type: "minecraft:stone",
        state {
            variant { value = "andesite" }
        },
        respawnmin: 5,
        respawnmax: 10
    }
]

Following the above example, dirt can be mined and will respawn between 2 and 5 minutes later. Only the andesite variant of stone can be broken, and it will respawn between 5 and 10 minutes later.

Harvest drops

The config file named drops.conf is used to define the items that will come out of the mined blocks.

The file also uses HOCON and contains two arrays :

  • The default array contains the resources that will use vanilla drops. By default, all vanilla drops won't happen.
    It can be used in addition to harvest_items if you'd like a resource to drop its normal loot plus something else.
  • The harvest_items array contains the data specifying which item we want to be dropped for a block
    • type is the name of the block affected
    • (Optional) The state object, if present, specify that only a subtype of a block is affected
    • (Optional) The item_name, when present, defines an item by its name
    • (Optional) The item_ref, when present, mean that the plugin will try to communicate with Itemizer plugin to retrieve a configured item identified by its id
    • (Optional) The pool_ref, when present, will fetch an item (or nothing) from an itempool from the plugin Itemizer
default = [
   	"minecraft:dirt",
   	"minecraft:stone"
]
harvest_items = [
   {
       type: "minecraft:stone",
       state {
           variant { value = "diorite" }
       },
       item_name: "minecraft:cobblestone",
       item_ref: 2,
       pool_ref: 1
   }
]

Following the above example, dirt and stone are going to drop their default drop, but diorite stone will drop a cobblestone block, the item number 2 of Itemizer, and an item from the first Itemizer pool, as well as its default drop (since diorite is a type of stone).

Commands and permissions

  • Granting a player with the harvester.block.breaking permission will allow him to break blocks normally, without being restricted by the plugin.
    People in creative mode can also break blocks normally.
  • The /harvester reload command will reloads configuration files without needing to restart the server.
    Permission: harvester.command.reload