DropFactory

A simple way to edit item drops! You can either edit the config file, or edit drops in the console.

When you first start up the plugin, it will install a rule to make grass blocks have a 50% chance of dropping diamond boots with level 2 fire protection when mined with a Silk Touch Gold Pickaxe. This is so that you have an example to work with in case you prefer to make rules by editing the config file. If you prefer to edit your drops from the console, you can remove it with the command dfrm GRASS. Otherwise you can edit the config file and then run the dfrl command. Changes made from the console are saved immediately to the file, so you can even mix the two methods; just keep in mind that comments will be stripped out when saving and rules may be reordered.

Commands

There are several utility commands which are subcommands of the dropfactory command; each also has a standalone abbreviation beginning with df. (Note: The | character indicates alternates.)

  • dropfactory reload|rl :: Reloads drop rules from the config file. This reverts any rules you added or removed using commands, unless you saved them first. (Abbreviation: dfrl)
  • dropfactory list|ls :: Lists all current drop rules. (Abbreviation: dfls)
  • dropfactory info BLOCK :: Lists all details on the specified drop rule. (Abbreviation: dfi)
  • dropfactory delete|remove|del|rm BLOCK :: Deletes the specified drop rule. Note that this may change the ID of another existing drop rule. (Abbreviation: dfrm)
  • dropfactory save :: Saves the config. Use after adding rules if you've chosen to disable auto-saving. (Abbreviation: dfs)
  • dropfactory swap|move|mv BLOCK INDEX1 INDEX2 :: Use this to alter the order of rules for a given block. The rules with the given indices (use - to indicate the first rule with no indices) will exchange places. For example, /dfmv GRASS - 1 will swap the GRASS and GRASS~1 rules. (Abbreviation: dfmv)
  • dropfactory add [BLOCK] [TOOL] :: Use this to add new drop rules. You can optionally specify the block and the tool type; if you specify the block, you can also include an index (eg GRASS~3), which will cause that rule to be overwritten if it already exists. Once you've executed the command, DropFactory will start asking you for more information to create the drop rule, which you can just enter normally into chat (no commands, just chat text). You can cancel at any time. Once done, DropFactory will print a summary of the rule that was added.

The original dropfactory command (abbreviated df) can still be used to add drop rules, but it probably won't be updated to support newer things as I add them. The syntax is a little complex, but I think it's fairly intuitive; the most basic form is df BLOCK TOOL -> DROP. Exactly what these parts are will be explained in the next section.

  • Full syntax: dropfactory BLOCK [param=value] TOOL -> DROP [enchantment=value]

Rule IDs

The ID of a rule is a block name from the Bukkit Material or CreatureType enum, with a number optionally appended. Rules are processed in order, starting from the one with no number appended and then moving on to 0, 1, 2, etc, until the next number is not found. This means that if there are gaps in the numbering, some rules will be ignored. The number, if present, is separated from the block or creature by a tilde, so if you had three drops for grass they'd be GRASS, GRASS~0, and GRASS~1.

In addition to block names from the Material enum, the following item names from the same enum are permitted: MINECART, POWERED_MINECART, STORAGE_MINECART, BOAT, PAINTING, and FISH (the last only works if the tool is FISHING_ROD, though).

Tools

A tool is specified as one of the following special keywords, some of which require additional information following them:

  • AXE :: Must also specify the material and may optionally specify an enchantment type.
  • PICK :: Must also specify the material and may optionally specify an enchantment type.
  • SHOVEL :: Must also specify the material and may optionally specify an enchantment type.
  • HOE :: Must also specify the material and may optionally specify an enchantment type.
  • SWORD :: Must also specify the material and may optionally specify an enchantment type.
  • SHEARS :: This is triggered when right-clicking certain creatures with shears; sheep (with wool only), pigs (with saddle only), powered creepers, mooshrooms, and snowmen are currently supported. If you want a drop when mining with shears, use ITEM.
  • FISHING_ROD :: This is triggered when reeling in a fishing rod. The target may be any creature; it can also be WATER to trigger on an unsuccessful attempt, and FISH to trigger only when you successfully catch a fish. If you want a drop when mining with a fishing rod, use ITEM.
  • BOW :: This is triggered when killing a creature by firing a bow at it. If you want a drop when mining with a bow, use ITEM.
  • FIREBALL, SNOWBALL, EGG, POTION :: These are triggered when killing a creature by throwing things at it. This does mean that some of these can't trigger in all situations. For example, a tool of SNOWBALL will never trigger for most mobs since they are not damaged by snowballs, but it can trigger for blazes, which are vulnerable to snowballs. A tool of POTION most likely can only be triggered by throwing potions of harming, not just any potion; it might also work with potions of poison (I haven't tested this). If you want a drop when mining with an item that's normally a projectile, use ITEM.
  • ITEM :: Use this to specify any item as a tool; you need to specify which item (as a Material enum constant) and optionally a required data value. If you don't specify a data value it'll match any data. If you specify an axe, pickaxe, shovel, hoe, or sword here, I'm fairly sure it won't be matched; this is a small oversight which I'd like to correct at some point.
  • NONE :: Requires that your hands are empty for the drop to occur.
  • ANY :: Bypasses the check for what tool you're using.

Materials are one of GOLD, WOOD, STONE, IRON, DIAMOND, ANY; most of them imply "this material or better", but gold is excluded from this ranking and instead implies only gold; that's why there is an option of any.

Enchantments on tools are either FORTUNE with a number from 1-3 (eg FORTUNE2), which implies the Fortune enchantment (at the specified level or higher) when used on tools and the Looting enchantment (at the specified level or higher) when used on swords, or SILK, which of course implies the Silk Touch enchantment. You can also use SILKPLUS or FORTUNEPLUS for higher levels of these enchantments, though there's no way to specify an exact level beyond the norm.

In the config file, the tool is specified as the tool parameter, with subparameters tool, material, magic, id, and data (the latter two apply to ITEM only). There will also be an "==" subparameter in the sample config; don't modify or remove this, and be sure to copy it to any rules you make yourself.

Drops

Drops are specified as a Material enum constant. You can also optionally specify an amount and a datavalue; when using the commands, the amount must come before the data, which means if you want data you need to specify an amount. Amount defaults to 1 while data defaults to 0. You can also specify enchantments using the syntax enchantment=level, using an Enchantment enum constant. These can appear anywhere after the arrow in the commands, even mixed in with the other info.

In the config, the drop is specified as the drop parameter, with subparameters id, damage, amount, and meta which has an enchants subparameter; under the enchants you use the enchantment names as parameters and their levels as values. There will also be some "==" subparameters and a meta-type subparameter in the sample config; don't modify or remove these, and be sure to copy them to any rules you make yourself. For some items you might need a different value for meta-type than the usual; if in doubt, use the in-game command to add the drop, as this will automatically pick the correct value. (Though advanced meta for most items is not yet supported by the add command, the in-game command should at least properly set it to a default base value that could then be edited further in the config file.)

Parameters

There are a number of auxiliary parameters which you can specify on a drop rule; if using the commands, they must appear before the arrow in the form param=value, and if you're editing the config they should be indented to the same level as the tool and drop parameters. The following parameters are recognized:

  • shear :: If set to false on a drop rule with SHEARS as the tool, the creature will not be sheared. Shearing a creature for the most part means reverting it to its natural state; sheep will lose their wool, pigs will lose their saddles, creepers will lose their electrical armour, and mooshrooms will turn into normal cows. (Note that the SHEARS drop won't trigger at all if these conditions are already met.) Snowmen when sheared will simply disappear.
  • type :: This parameter applies a finer filter on the block matching. For example, if you only want a drop to trigger for birch logs, you would make a LOG rule with type set to BIRCH. Details of what types can apply to what blocks or creatures is in the next section.
  • chance :: The percentage chance of the drop occurring. If the roll fails, it is as if the drop didn't match; ie nothing whatsoever happens.
  • override :: If set to true, the default drop will be overridden. On a creature drop, this will also override any prior matched rules. On a non-creature drop it may sometimes override following rules that would otherwise match; this has not been verified through testing. Currently it has no effect on FISHING_ROD or SHEARS rules.
  • xp :: If you want the rule to drop an experience orb as well as an item, specify the amount of experience here. It's probable that you can't currently have a rule that drops only experience and no items; this has not been tested.

Block and Creature Types

The following blocks and creatures have subtypes that you can specify in the type parameter (this list is not comprehensive):

  • SAPLING, LOG, and LEAVES :: You can specify a tree species (one of GENERIC, REDWOOD, BIRCH).
  • LONG_GRASS :: You can specify a grass species (one of DEAD, NORMAL, FERN_LIKE).
  • STEP, DOUBLE_STEP :: You can specify the step material (one of STONE, SANDSTONE, WOOD, COBBLESTONE, BRICK, SMOOTH_BRICK).
  • MOB_SPAWNER :: You can specify the mob it spawns (use a CreatureType enum constant).
  • SNOW :: You can specify the height (an integer from 0 to 7). This is untested.
  • SMOOTH_BRICK :: You can specify the type (one of STONE, MOSSY_COBBLESTONE, COBBLESTONE).
  • HUGE_MUSHROOM_1, HUGE_MUSHROOM_2 :: You can specify either CAP or STEM.
  • WOOL, SHEEP :: You can specify a colour (use a DyeColor enum constant).
  • CREEPER :: You can specify POWERED or UNPOWERED.
  • ENDERMAN :: You can specify what it's carrying (use a Material enum constant).
  • SLIME, MAGMA_CUBE :: You can specify the size (an integer, usually between 1 and 3 though larger numbers are possible). It'll match any slime larger than or equal to the specified size, so if you specify size 2 slimes it'll also match size 3 and 4 (and larger) slimes.
  • PIG :: You can specify SADDLED or UNSADDLED.

Note

I made this because OtherDrops was getting a bit too complicated for my liking. If you have a bug to report, by all means do so, and I'll probably fix it; however, if you want to request new features, I'm probably going to suggest that you use OtherDrops instead. This is a simple plugin for people who don't need the immense power of OtherDrops, yet still want powerful abilities to customize what items things drop.

You must login to post a comment. Don't have an account? Register to get one!

  • Avatar of BMWBrandon BMWBrandon Mar 03, 2014 at 17:24 UTC - 0 likes

    @Celtic_Minstrel:

    Cool! I've been looking for a recently updated version of a plugin that would affect drops from blocks and mobs. Thank you very much for creating this and I can't wait to see the update!

    Last edited Mar 03, 2014 by BMWBrandon
  • Avatar of Celtic_Minstrel Celtic_Minstrel Feb 18, 2014 at 19:04 UTC - 0 likes

    I dunno if anyone actually wants to use this, but I have an update ready to be uploaded as soon as I get around to testing it. So... probably sometime this week?

    My github page.

    BFAK:28878,9e81cbd54aa5a742c94bd31fd664ea3c96b472069d9154dcabbc4145bc41831e

  • Avatar of Celtic_Minstrel Celtic_Minstrel Sep 28, 2013 at 16:33 UTC - 0 likes

    I don't know of any reason for it not to still work, but I haven't tested it or paid a lot of attention to whether there have been breaking changes recently.

  • Avatar of Hangar Hangar Aug 06, 2013 at 21:02 UTC - 0 likes

    Does this still work? OtherDrops dev build site is down and there is a bad bug with TNT there atm. I really only need simple functionality as well.

    I play with fun adults late at night :)

  • Avatar of kyllingman2 kyllingman2 Jul 15, 2013 at 20:03 UTC - 0 likes

    How would I make white sheeps and black sheeps drop different items when sheared? I don't want when they're killed but when you shear them

    Legendary Empire - Survival | Creative | SkyBlock | Survival Games & Other minigames 16GB DDR3 RAM - Intel Core E3 1270 3.4GHz - 1GBPS = No lag IP: 76.72.160.69

  • Avatar of Celtic_Minstrel Celtic_Minstrel Apr 21, 2013 at 14:25 UTC - 0 likes

    @Matthieu_S: Go

    Hm... list of items might only be possible by duplicating the entire drop rule... which is highly inefficient... I'll look into this sometime. I'm not sure what you mean by a quantity key.

    @Jemrada: Go

    I'm not really sure what you're missing; you could instead try adding the drop rule from in-game using commands? Even just add a generic "leaves drop saplings" rule and then edit the config to tweak it to your liking. You've obviously not gotten the itemstack format right; looking at it, it almost looks like you missed the itemstack info entirely.

    Last edited Apr 21, 2013 by Celtic_Minstrel
  • Avatar of Jemrada Jemrada Apr 18, 2013 at 06:23 UTC - 0 likes

    Hello,

    I am wanting to control the leaves drop rate of saplings. I tried the following and it doesn't work. What am I missing?

    LEAVES: drop:

    : org.bukkit.inventory.ItemStack

    type: GENERIC chance: 10 override: true

    Any help will be appreciated.

    I also get this error in console

    2013-04-18 01:15:27 [SEVERE] Could not call method 'public static org.bukkit.inventory.ItemStack org.bukkit.inventory.ItemStack.deserialize(java.util.Map)' of class org.bukkit.inventory.ItemStack for deserialization
    java.lang.NullPointerException
    
    Last edited Apr 18, 2013 by Jemrada
  • Avatar of Matthieu_S Matthieu_S Apr 17, 2013 at 03:12 UTC - 0 likes

    Works well in bukkit 1.5.1 I just don't quite understande how to make a list of items (tried to duplicate the entry and change the dropped item, tried to use a list using [a,b,c] and i tried a few things without any other possibility than a single dropped item) I also failed to use the quantity parameter itself... Otherwise, simple formulas are well tolerated by bukkit Also i'd like to contribute around and help documenting the plugin and make generic presets to share with the community.

    Last edited Apr 17, 2013 by Matthieu_S
  • Avatar of Celtic_Minstrel Celtic_Minstrel Sep 30, 2012 at 12:20 UTC - 0 likes

    I haven't checked whether this still works in the latest Bukkit builds; I wouldn't be particularly surprised if they broke something.

    @CosmicVoyager: Go

    It's supposed to be able to do this.

    @osamabinbulli: Go

    There doesn't seem to be source anywhere, unless I included it in the jar?

  • Avatar of CosmicVoyager CosmicVoyager Jun 10, 2012 at 19:46 UTC - 0 likes

    It is not clear to me if this can be use to catch other items when fishing. Can it?

Facts

Date created
Feb 15, 2012
Categories
Last update
Mar 03, 2014
Development stage
Release
License
MIT License
Curse link
DropFactory
Downloads
1,429
Recent files
  • R: v2.0 for CB 1.7.2-R0.3 Mar 03, 2014
  • R: v1.1 for CB 1.4.6-R0.1 Dec 23, 2012
  • R: v1.0 for CB 1.1-R4 Feb 15, 2012

Authors