Crafting stations enable players to easily craft specific items using crafting recipes, which require ingredients and conditions. When opening a crafting station, players can see information about the station recipes, including the recipe conditions (permissions, levels), ingredients and output, and navigate through them using the pagination system.
You can make a player open a crafting station GUI by using the following command: /mi stations open {station-id} {player}. You can check the list of available crafting stations by using /mi stations list.
Creating a new crafting station
Crafting stations are saved in the /MMOItems/crafting-stations folder. Every YML file in that folder corresponds to a crafting station, therefore you can create a crafting station by creating a new YML file. Be careful when choosing the file name, because it corresponds to the ID you will be using as reference when opening a GUI to a player via the command as explained previously.
Configurating a crafting station
# Name which will be displayed
# when opening the station
name: 'Arcane Forge (#page#/#max#)'
# Configure GUI items here
items:
fill:
material: PINK_STAINED_GLASS_PANE
name: '&a'
no-recipe:
material: GRAY_DYE
name: '&a'
Every crafting station needs some basic information provided in the station config file, including the name
option which corresponds to the GUI name. The items
config section is used to change some of the GUI items. The fill
item is the item used to fill remaining GUI slots around the recipe items. The no-recipe
item is used to fill GUI recipe slots when there are no recipes. The previous config therefore displays that:
Creating a crafting recipe
The first step is to create the recipes
config section inside the station config. You then need to create a config section for your station recipe. The config section name corresponds to the recipe ID, which is only used internally in the plugin. What you put here does not really matter, just make sure the different recipes have different recipe IDs.
For this guide, we will be creating a recipe for the steel sword, which requires the player to be at least level 5. The recipe requires two specific player permissions, some steel ingots and vanilla wooden sticks as ingredients.
# Station recipes
recipes:
steel-sword: {}
The second step is setting up the recipe output. This is the MMOItem any player will obtain when using your recipe. Since we want the player to obtain 1 steel sword (which MMOItems type is SWORD
and ID is STEEL_SWORD
), this is how the output
section should look like:
recipes:
steel-sword:
output:
material: SWORD
sword: STEEL_SWORD
amount: 1
Recipes may also have a crafting time which is the time in seconds players spend crafting the item. When clicking on the recipe item in the GUI, players will temporarily quit the GUI and a progress bar will be prompted using the vanilla title feature till the crafting is complete. In order to setup a recipe crafting time, use the following config template:
recipes:
steel-sword:
crafting-time: 10 # time in seconds
If you want your recipe not to display in the GUI if any of its conditions are not met, use the hide-when-locked
recipe option, which you can enable using this template:
recipes:
steel-sword:
options:
hide-when-locked: true
Crafting Station Example
name: 'Steel Crafting Station (#page#/#max#)'
max-queue-size: 10
items:
fill:
material: AIR
no-recipe:
material: GRAY_STAINED_GLASS_PANE
name: '&a'
no-queue-item:
material: GRAY_STAINED_GLASS_PANE
name: '&aNo Item in Queue'
recipes:
two-handed-steel-sword:
output:
type: GREATSWORD
id: TWO_HANDED_STEEL_SWORD
amount: 1
crafting-time: 10
conditions:
- 'level{level=8}'
ingredients:
- 'mmoitem{type=MATERIAL,id=STEEL_INGOT,amount=8}'
- 'vanilla{type=STICK,amount=4}'