Skip to main content

The Forge System

The Forge System

note

By default, the Oraxen/ItemsAdder plugin handles all custom armor, weapons, and relics. However, there are some items that will be handled by the HyronicSkyblockCore plugin, which is a custom plugin developed by HyronicStudios.

How Forging Menu Work​

The Forging System is built using CommandPanel, with each item forging being a panel, and is command-based. I will now explain how to add a forging item to your server.

How to add a forging item:​

caution

Before you begin the tutorial, it is recommended that you read the CommandPanels wiki and familiarize yourself with the features of HyronicSkyblockCore.

Step 1:​

You need to define the recipe for the forging item. Let's take a look at the forges.yml file in the HyronicSkyblockCore plugin. I will demonstrate by adding a recipe to forge a ruby_ingot, which requires 1 topaz_ingot from Oraxen/ItemsAdder and 2 iron ingots from vanilla Minecraft.

forges.yml
ruby_ingot:
materials:
# Pattern: "<item-source>;<name>;amount"
# minecraft mean the vanilla default material
# hyronic mean the item from Oraxen or ItemsAdder
- "minecraft;IRON_INGOT;2"
- "hyronic;topaz_ingot;9"

Reload the recipes by command /hrn reload

Step 2:​

Add the button to open the ruby ingot forge menu to the blacksmith. I will add the ruby ingot to the material menu for display purposes and to access the forge menu. The material menu can be found at: plugins/CommandPanels/panels/Blacksmith/BlackSmithMaterial.yml.

forges.yml
"21": # The slot in the menu
material: PAPER # the material of ruby
customdata: 203 # the model data of ruby
name: "&fRuby Ingot"
lore: []
commands:
- "open= RubyIngotForge" # Open the RubyIngotFoge panel, let create it in step 3

Step 3:​

This is the most important step, and it can be a bit complicated. Please pay close attention

Since we added the ruby ingot to the materials panel, we need to create a panel for it in the materials folder. It is located at: plugins/CommandPanels/panels/Blacksmith/Materials.yml Create a file with any name you want and paste the following simple menu configuration:

Materials.yml
panels:
RubyIngotForge: # Must match the menu open above.
perm: "default"
rows: 5
title: "&f%hrn_getIcon:neg_shift_8%%hrn_getIcon:blacksmith_forging%"
item:
"44": # This is back to material menu.
material: PAPER
customdata: 9999
name: "&fBack"
commands:
- "open= BlackSmithMaterial"

Remember the recipe we defined in Step 1? We need 2 iron ingots and 1 topaz ingot. Now, let's check the amount of these items your player has using the placeholder:

RubyIngot.yml
%hrn_getItemAmount:VANILLA:IRON_INGOT%
%hrn_getItemAmount:HYRONIC:topaz_ingot%

Since we will reuse those placeholders later, let's define 2 variables for the 2 placeholders we just used. We can do this using the pre-load-commands feature of CommandPanels, and it will allow us to reuse them with shorter placeholders in the format of %cp-data-{variable}%. Your panel should now look like this:

RubyIngot.yml
panels:
RubyIngotForge:
perm: 'default'
pre-load-commands:
# Vanilla Item %cp-data-iron%
- 'set-data= iron %hrn_getItemAmount:VANILLA:IRON_INGOT%'
# Custom Item %cp-data-topaz%
- 'set-data= topaz %hrn_getItemAmount:HYRONIC:topaz_ingot%'
panelType:
- unmovable
- nocommand
commands-on-open:
- 'sound= BLOCK_ANVIL_USE 1 1'
rows: 5
title: '&f%hrn_getIcon:neg_shift_8%%hrn_getIcon:blacksmith_forging%'
item:
'44':
material: PAPER
customdata: 9999
name: '&fBack'
commands:
- 'open= BlackSmithMaterial'yyam

Now you can put the recipe information on the panel to let the player know what they need to forge a ruby ingot for decoration purposes. Your panel should now look like this:

RubyIngot.yml
panels:
RubyIngotForge:
perm: "default"
pre-load-commands:
# Vanilla Item %cp-data-iron%
- "set-data= iron %hrn_getItemAmount:VANILLA:IRON_INGOT%"
# Custom Item %cp-data-topaz%
- "set-data= topaz %hrn_getItemAmount:HYRONIC:topaz_ingot%"
panelType:
- unmovable
- nocommand
commands-on-open:
- "sound= BLOCK_ANVIL_USE 1 1"
rows: 5
title: "&f%hrn_getIcon:neg_shift_8%%hrn_getIcon:blacksmith_forging%"
item:
"10": # Display purpose
material: IRON_INGOT
name: "&fIron Ingot &a%cp-data-iron%&8/&f2"
"11": # Display purpose
material: PAPER
customdata: 207
stack: 2
name: "&fTopaz Ingot &a%cp-data-ruby_ingot%&8/&f3"

"44":
material: PAPER
customdata: 9999
name: "&fBack"
commands:
- "open= BlackSmithMaterial"
danger

To understand this section, you must understand how CommandPanels has setion work.

The forge button have 3 stages:

  • Ready Stage: This is the default button when the player has enough items in their inventory to forge the ruby ingot.
  • Not Enought Items Stage: This button is displayed when the player does not have enough items to forge the ruby ingot.
  • Not Enought Inventory Space Stage: This button is displayed when the player's inventory is full.

This is the Ready Stage, which is displayed when the player meets all the requirements and is ready to remove their items and receive the ruby ingot:

RubyIngot.yml
'40':
material: PAPER
customdata: 203
name: '&fRuby Ingot'
lore:
- ''
- '&8- &c%cp-data-iron%&8/&a2&f Iron Ingot'
- '&8- &c%cp-data-topaz%&8/&a1&f Topaz Ingot'
- '
- '&a→ Click to start forging'
- '&athis item.'
commands:
# Remove player material for forging item.
- "console= hyronic remove-blacksmith-materials %player_name% ruby_ingot"
# Give player the forging item
- "console= hrn give-item %player_name% ruby_ingot 1"
# Play forging sound
- "sound= UI_TOAST_CHALLENGE_COMPLETE 1 1"
# Reopen the PANEL to update everything. (IMPORTANT)
- "open= RubyIngotForge"

Next, we will check if the player's inventory is full or not. If it's full, we will display an item that blocks the player from forging the item. Your button should now look like this:

RubyIngot.yml
'40':
material: PAPER
customdata: 203
name: '&fRuby Ingot'
lore:
- ''
- '&8- &c%cp-data-iron%&8/&a2&f Iron Ingot'
- '&8- &c%cp-data-topaz%&8/&a1&f Topaz Ingot'
- '
- '&a→ Click to start forging'
- '&athis item.'
commands:
# Remove player material for forging item.
- "console= hyronic remove-blacksmith-materials %player_name% ruby_ingot"
# Give player the forging item
- "console= hrn give-item %player_name% ruby_ingot 1"
# Play forging sound
- "sound= UI_TOAST_CHALLENGE_COMPLETE 1 1"
# Reopen the PANEL to update everything. (IMPORTANT)
- "open= RubyIngotForge"
has0: # Check player inventory empty slot
value0: '%player_empty_slots%'
compare0: '0'
material: PAPER
customdata: 203
name: '&fRuby Ingot'
lore:
- ''
- '&f%hrn_getIcon:error%&c You dont have enought'
- '&cinventory space to start'

The final step is to check if the player has enough items to forge using the placeholder %hrn_hasForgeMaterial:ruby_ingot%. If the player doesn't have enough items, we will display an item that doesn't do anything when clicked. Your button should now look like this:

RubyIngot.yml
"40":
material: PAPER
customdata: 203
name: "&fRuby Ingot"
lore:
- ""
- "&8- &c%cp-data-iron%&8/&a2&f Iron Ingot"
- "&8- &c%cp-data-topaz%&8/&a1&f Topaz Ingot"
- ""
- "&a→ Click to start forging"
- "&athis item."
commands:
# Remove player material for forging item.
- "console= hyronic remove-blacksmith-materials %player_name% ruby_ingot"
# Give player the forging item
- "console= hrn give-item %player_name% ruby_ingot 1"
# Play forging sound
- "sound= UI_TOAST_CHALLENGE_COMPLETE 1 1"
# Reopen the GUI to update everything. (IMPORTANT)
- "open= RubyIngotForge"
has0: # Check player inventory empty slot
value0: "%player_empty_slots%"
compare0: "0"
material: PAPER
customdata: 203
name: "&fRuby Ingot"
lore:
- ""
- "&f%hrn_getIcon:error%&c You dont have enought"
- "&cinventory space to start"
has1: # Check Item have enought materials to forging
value1: "%hrn_hasForgeMaterial:ruby_ingot%"
compare1: "false"
material: PAPER
customdata: 203
name: "&fRuby Ingot"
lore:
- ""
- "&f%hrn_getIcon:error%&c You dont have enought"
- "&cmaterial to forge this item"
- ""
- "&8- &c%cp-data-iron%&8/&a2&f Iron Ingot"
- "&8- &c%cp-data-topaz%&8/&a1&f Topaz Ingot"

Finally, add the button to your forge panel. Your final panel should now look like this:

RubyIngot.yml
panels:
RubyIngotForge:
perm: "default"
pre-load-commands:
# Vanilla Item %cp-data-iron%
- "set-data= iron %hrn_getItemAmount:VANILLA:IRON_INGOT%"
# Custom Item %cp-data-topaz%
- "set-data= topaz %hrn_getItemAmount:HYRONIC:topaz_ingot%"
panelType:
- unmovable
- nocommand
commands-on-open:
- "sound= BLOCK_ANVIL_USE 1 1"
rows: 5
title: "&f%hrn_getIcon:neg_shift_8%%hrn_getIcon:blacksmith_forging%"
item:
"10":
material: IRON_INGOT
name: "&fIron Ingot &a%cp-data-iron%&8/&f2"

"11":
material: PAPER
customdata: 207
stack: 2
name: "&fTopaz Ingot &a%cp-data-ruby_ingot%&8/&f3"

"40":
material: PAPER
customdata: 203
name: "&fRuby Ingot"
lore:
- ""
- "&8- &c%cp-data-iron%&8/&a2&f Iron Ingot"
- "&8- &c%cp-data-topaz%&8/&a1&f Topaz Ingot"
- ""
- "&a→ Click to start forging"
- "&athis item."
commands:
# Remove player material for forging item.
- "console= hyronic remove-blacksmith-materials %player_name% ruby_ingot"
# Give player the forging item
- "console= hrn give-item %player_name% ruby_ingot 1"
# Play forging sound
- "sound= UI_TOAST_CHALLENGE_COMPLETE 1 1"
# Reopen the GUI to update everything. (IMPORTANT)
- "open= RubyIngotForge"
has0: # Check player inventory empty slot
value0: "%player_empty_slots%"
compare0: "0"
material: PAPER
customdata: 203
name: "&fRuby Ingot"
lore:
- ""
- "&f%hrn_getIcon:error%&c You dont have enought"
- "&cinventory space to start"
has1: # Check Item have enought materials to forging
value1: "%hrn_hasForgeMaterial:ruby_ingot%"
compare1: "false"
material: PAPER
customdata: 203
name: "&fRuby Ingot"
lore:
- ""
- "&f%hrn_getIcon:error%&c You dont have enought"
- "&cmaterial to forge this item"
- ""
- "&8- &c%cp-data-iron%&8/&a2&f Iron Ingot"
- "&8- &c%cp-data-topaz%&8/&a1&f Topaz Ingot"

"44":
material: PAPER
customdata: 9999
name: "&fBack"
commands:
- "open= BlackSmithMaterial"