RedNesto / Box O' Utils

Control what blocks/mobs can loot (items, experience, money), right-click to harvest; more to come
1
Download

Custom Drops

The Custom Drops lets you decide which block/mob drops what. There are two configuration files for this feature:

  • one for blocks, called blocksdrops.conf;
  • the other one for mobs, called mobsdrops.conf.

By default, Custom Drops are disabled (like all this plugin’s features). To enable it, go into the plugin’s configuration directory and open the configuration file of the wanted feature, then set enabled on true; that’s it!

Now that you have enabled this feature, you can start configuring it.

During the rest of this page, we will talk about the blocks, but everything also applies to mobs (the options are the same), so instead of blocks, you would use mobs.

Defining Custom Drops

Now, make a new category called blocks, inside it you can put any category you want as long as the the key is the ID of the target block, like "minecraft:iron_ore" (be sure to include the quotes!).

The file should look like this:

enabled=true
blocks {
  "minecraft:iron_ore" {
  }
}

Then, we can define a custom drop inside the drops array. Since this is an array, we can put as many objects as we want:

enabled=true
blocks {
  "minecraft:iron_ore" {
    drops=[
    ]
  }
}

Inside the drops array we create an object (category) with the property type (the Minecraft item ID of the item to drop). You can also use FileInventories for more control over items with the property file_inv_id (which replaces the type property).

We can also add a chance, which will define the chance of dropping this item, but this is optional.

enabled=true
blocks {
  "minecraft:iron_ore" {
    drops=[
      {
        type="minecraft:cobblestone"
        chance=25
      }
    ]
  }
}

You can stop here if you only want to drop a cobblestone 25% of the time we break an iron ore. But we can go further by giving experience for breaking the ore:

enabled=true
blocks {
  "minecraft:iron_ore" {
    experience=5
    drops=[
      {
        type="minecraft:cobblestone"
        chance=25
      }
    ]
  }
}

You can also totally replace all the drops from a block by using overwrite:

enabled=true
blocks {
  "minecraft:iron_ore" {
    experience=5
    overwrite=true
    drops=[
      {
        type="minecraft:cobblestone"
        chance=25
      }
      {
        type="minecraft:ingot"
      }
    ]
  }
}

The same goes for experience with exp-overwrite.

You can also define the quantity of one loot to drop with quantity by using a min-max syntax:

enabled=true
blocks {
  "minecraft:iron_ore" {
    experience=5
    overwrite=true
    drops=[
      {
        type="minecraft:cobblestone"
        chance=25
      }
      {
        type="minecraft:ingot"
        quantity=2-4
      }
    ]
  }
}

One last thing, you can set the loot’s displayname, with & color codes support. You can have a reference of all available color codes here and formatting codes here.

You will just have to replace ยง by &:

enabled=true
blocks {
  "minecraft:iron_ore" {
    experience=5
    overwrite=true
    drops=[
      {
        type="minecraft:cobblestone"
        chance=25
      }
      {
        type="minecraft:ingot"
        displayname="&7&oSilver"
        quantity=2-4
      }
    ]
  }
}

Note: if you place a color code after a formatting code, the formatting will be reset.

Economy support

You can set a given amount of money to give to players when breaking a block or killing an entity.

Let’s reuse the previous example:

enabled=true
blocks {
  "minecraft:iron_ore" {
  }
}

Now you can add the money category with the amount property to the block’s property:

enabled=true
blocks {
  "minecraft:iron_ore" {
    money {
      amount=5-15
    }
  }
}

The plugin also supports multiple currencies, you can use the currency property. The value is an ID in the format pluginid:singular_currency_name and must be surrounded with quotes, if not set it will use the default currency:

enabled=true
blocks {
  "minecraft:iron_ore" {
    money {
      amount=5-15
      currency = "economylite:coin"
    }
  }
}

This will add between 5 or 15 of the default currency to the player’s account.

You can also set a chance to give the previously configured amount of money, and a message to display when it has been successfully given:

enabled=true
blocks {
  "minecraft:iron_ore" {
    money {
      amount=5-15
      currency = "economylite:coin"
      chance=50
      message="&aYou earned {money_amount}"
    }
  }
}

Category: Miscellaneous

Published on Jan 19, 2018

1049 views

1 stars

63 total downloads

Licensed under MIT

Members