Fuel
How fuel items work, how players add fuel, when a minion uses it and what happens when it runs out.
Fuel keeps minions from working forever for free. A fuel item gives a minion a number of actions, and fuel is used each time the minion actually does something: mines a block, harvests a crop, hits a mob, catches a fish. How much each action uses depends on its upgrades and fuel efficiency, see below. A minion that is waiting, full or has nothing to do uses nothing.
Fuel items
Fuel items are set up in fuel.yml. Each entry under fuel is one fuel, and its key (basic, advanced, ultimate) is its id.
fuel:
basic:
enabled: true
actions: 100
types: all
any-matching-item: false
item:
material: COAL
name: "<green>Basic Fuel"
lore:
- "<gray>Gives <green>100 <gray>actions."
custom-model-data: 0
itemsadder: ""
mythicmobs: ""
commands: []| Key | What it does |
|---|---|
enabled | false switches the fuel off without deleting it. Left out, it counts as true |
actions | How many actions one item gives. Must be above 0, or the fuel is skipped with a console warning |
types | all, or a list of type ids that may use this fuel |
any-matching-item | Whether any item like the one in item counts as this fuel, see below. false when left out |
item | The item players hold: material, name, lore, custom model data, an ItemsAdder id or a MythicMobs id |
commands | Console commands run each time this fuel is added. %player% is the player, %minion% the type id, %amount% the actions added |
The shipped fuels:
| Id | Item | Actions | Shipped as |
|---|---|---|---|
basic | Coal | 100 | On |
advanced | Blaze powder | 500 | On |
ultimate | Nether star | 2000 | On |
coal | Any plain coal | 10 | Off, an example of any-matching-item |
Admins give fuel with /minion fuel <player> <fuel> [amount], and you can sell it in the shop.
Plain and custom items as fuel
With any-matching-item: false, the default, only the fuel item MinionCore makes counts. It carries a hidden tag, so plain coal from a mine is not fuel even though basic looks like coal.
With any-matching-item: true, every item that matches the item section counts as that fuel, wherever it came from: mined, crafted, bought or dropped by a mob. The item is matched like this:
- A
saved-item, when set, has to match exactly and nothing else is checked. - Otherwise a
mythicmobsid, when set, has to be that MythicMobs item. - Otherwise an
itemsadderid, when set, has to be that ItemsAdder item. - Otherwise the
materialhas to match. - On top of that,
custom-model-datahas to match when it is not0.
Name and lore are never checked for these fuels. An item from /minion fuel or the shop still counts too, as it carries the tag. Minion items and upgrade items never count as fuel, whatever they are made of.
The shipped coal entry shows the idea. Switch it on and every lump of coal gives 10 actions:
fuel:
coal:
enabled: true
actions: 10
types: all
any-matching-item: true
item:
material: COAL
custom-model-data: 0
itemsadder: ""
mythicmobs: ""
commands: []Plain coal and the basic fuel item are both coal, but they do not clash. The tagged basic item is always read as basic, and only untagged coal falls through to coal.
Which fuel an item counts as
When an item goes into a minion, MinionCore looks for its fuel in this order:
- The tag on a fuel item MinionCore made.
- The
any-matching-itemfuels in the minion's own type file, underfuel.items. - The
any-matching-itemfuels infuel.yml, from the top of the file down.
The first one the minion's type takes is used. If an item matches only fuels the type does not take, it is refused with fuel.wrong-type.
Fuel for each type
Every type file has a fuel section. All three keys work for the shipped types and for your own.
fuel:
per-action: 1.0
accepted: all
items: {}| Key | Shipped value | What it does |
|---|---|---|
per-action | 1.0 | How much stored fuel one action uses before upgrades and fuel efficiency. 2.0 makes the type burn fuel twice as fast, 0.5 half as fast. Below 0 logs a warning and uses 1 |
accepted | all | all, or a list of fuel.yml ids this type takes. A fuel's own types list still has to allow the type as well |
items | {} | Fuels only this type takes, see below |
Fuels for one type only
Entries under fuel.items are written like the entries in fuel.yml, without types. They belong to that type alone, and accepted does not apply to them. Their id is the type id and the key joined by a colon, so coal under miner.yml is miner:coal. That id works with /minion fuel <player> miner:coal and in shop entries.
With any-matching-item: true, these entries are checked before the fuels in fuel.yml, so a type can give an item a different value from the rest of the server.
Worked examples
Plain coal for every minion
Switch on the shipped coal entry, as above, and reload. Every type with accepted: all now takes coal at 10 actions a lump. To keep it off one type, give that type a list without coal:
fuel:
per-action: 1.0
accepted:
- basic
- advanced
- ultimate
items: {}A custom item that only one type burns
Miners take a MythicMobs item called MagmaCore for 250 actions, and an ItemsAdder myitems:fuel_cell for 1000. No other type takes either of them:
fuel:
per-action: 1.0
accepted: all
items:
magma-core:
enabled: true
actions: 250
any-matching-item: true
item:
material: MAGMA_CREAM
mythicmobs: "MagmaCore"
fuel-cell:
enabled: true
actions: 1000
any-matching-item: true
item:
material: PAPER
itemsadder: "myitems:fuel_cell"Any MagmaCore a player picks up now works as fuel for miners, and /minion fuel <player> miner:magma-core 16 hands out tagged ones. If MythicMobs or ItemsAdder is not installed, nothing matches that entry, so the plain material on its own is never taken as fuel.
Adding fuel
Players need fuel access on the minion. There are three ways to add fuel.
- Straight from your hand: hold the fuel and right click the minion. As many items from the held stack as the minion can hold are added, without opening the menu. This works while sneaking too.
- One item at a time: pick the fuel up on your cursor and click the Fuel button (slot 15). One item from the stack is added.
- A whole stack: shift click a stack of fuel in your own inventory while the menu is open. As many items as the minion can hold are added in one go.
The last two need the minion menu open, which you get by right clicking the minion without fuel in hand. Right clicking with fuel only adds it on types with requires-fuel: true. On a type without fuel, the click opens the menu as usual.
When fuel goes in, the sounds.fuel sound and particles.fuel particle play, the player sees how many actions were added, the fuel's commands run, and a minion that was out of fuel starts working again.
Why fuel is refused
| Refused when | Message key |
|---|---|
The item is not a fuel, or the minion's type has requires-fuel: false | fuel.not-fuel |
The fuel's types list does not include this type, or the type's fuel.accepted list leaves the fuel out | fuel.wrong-type |
There is no room for even one more item under max-stored-actions | fuel.full |
How much a minion can hold
max-stored-actions in the type file is the most fuel a minion can store (5000 in every shipped file). Set it to 0 for no limit.
Items only go in whole. With 4950 actions stored and a limit of 5000, a basic fuel (100 actions) is refused. With 4800 stored, shift clicking a stack adds exactly two.
When fuel is used
Each time a minion's delay runs out, it checks whether it can work. Fuel is only taken after an action finishes. None is used when the minion:
- is broken, paused, in an unloaded chunk, or stopped by the offline rules
- has a full storage
- has nothing in range to work on
- had its action blocked, for example by another plugin
How much fuel an action uses
A finished action uses the type's fuel.per-action, 1.0 in every shipped file, made larger by upgrades and smaller by fuel efficiency:
use per action = per-action x (1 + increase / 100) x (1 - fuel efficiency / 100)-
per-action comes from the
fuelsection of the type file, see Fuel for each type. -
increase is the total of every applied upgrade. Each one adds
fuel.upgrade-increasefromconfig.yml,10by default, unless its entry inupgrades.ymlsets its ownfuel-increase.LEVELupgrades never add anything, and the shippedreliabilityupgrade hasfuel-increase: 0. -
fuel efficiency comes from the minion's level plus its fuel efficiency upgrades, capped at
100. At100the minion never uses fuel.
fuel:
upgrade-increase: 10| Minion | Increase | Fuel efficiency | Use per action |
|---|---|---|---|
| Level 1 miner, no upgrades | 0 | 0 | 1.00 |
| Level 4 miner, no upgrades | 0 | 15 | 0.85 |
Level 4 miner with storage-1, speed twice and range | 40 | 15 | 1.19 |
The same miner with per-action: 2.0 | 40 | 15 | 2.38 |
The use per action is shown as %fuel_use%, with two decimals, on the Fuel button of the minion menu and in the read only view. It can also be added to a hologram. See Holograms and effects.
Fractions carry over
Fuel is stored as a whole number of actions, so the whole part of the use is taken after each action and the rest is carried to the next one. At 1.20, one action takes 1 and carries 0.20, and five actions take exactly 6. At 0.85, most actions take 1 and about one in seven takes none. Over time the fuel taken matches the number on the Fuel button, with no luck involved.
The carried part is kept in memory only, so a restart or a pick up drops less than one action of fuel.
The Fuel used line on the Statistics button in the minion menu counts all the fuel taken.
Running out
When the last action is used:
- The status becomes Out of fuel, in the menu and on the hologram.
- The owner gets the
fuel.ran-outmessage, if they are online. - The
sounds.out-of-fuelsound andparticles.out-of-fuelparticle play at the minion. - The minion stops until someone adds fuel. It carries on by itself as soon as fuel goes in.
Minions without fuel
Set requires-fuel: false in a type file and that type never uses fuel. The Fuel and Fuel efficiency buttons disappear from its menu, and fuel items are refused. The shipped chunk loader and chunk collector are set up this way.
Chunk loaders and fuel
A chunk loader does not mine or harvest anything, so it measures fuel by time instead. With requires-fuel: true in chunkloader.yml, it uses one action of fuel every settings.fuel-interval-seconds (default 60) while it keeps its chunks loaded. When the fuel runs out, it lets the chunks go. See Chunk loader.
Feeders and fuel
A feeder stocks any item that counts as fuel, plain coal included when the coal entry is on. For each minion in range it works out the fuel that item is for that minion's type, so a type fuel such as miner:coal only goes to miners, a fuel left out of a type's accepted list never reaches that type, and each item gives the actions of the fuel the target type reads it as.
Fuel on pick up
With pickup.keep-fuel-on-pickup: true, the default, the fuel stays on the minion item when it is picked up and is there again when it is placed. Set it to false to clear the fuel on pick up. See Placing and picking up.
Upgrade kinds
Every upgrade kind, which minion types take it, what its amount does, where it stops, and the upgrade items upgrades.yml ships with.
Breakdowns and repairs
How upgraded minions can break down after an action, how the chance, repair price and repair items are worked out, and how players repair them.