• Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Supported Minecraft Versions
  1. 1.17
  2. 1.18
  3. 1.19
  4. 1.20
Item forge lets you easily create custom items in a YML file!
Requires skript-reflect and SkBee!
View Code

Usage

Create a .yml file inside plugins/Skript/scripts/ItemForge, the name doesn't matter and can be used to group your items. The root key will always be the ID of your item, the ID is used to give the item to someone. Inside the ID will be properties such as name, lore, type, etc. Here is an example file with all the properties vanilla ItemForge comes with.
Code:
testid:
  type: diamond pickaxe
  name: <red>test
  lore:
  - <red>abc 1abc
  - <blue>abc 2abc
  amount: 1
  enchantments:
  - protection 1
  - unbreaking 2
  nbt: "{myNBT:1}"
  durability: 15
Note that every property is optional and it uses MiniMessage rather than legacy colors (&). You must reload the script to reload the YML file.

To get the item, simply do give {-item::testid} to player


Getting ID of Pre-existing Item

If you want to get the ID of an item after it was given, get the ItemForgeID NBT tag of it.
Code:
set {_nbt} to nbt of player's tool
if {_nbt} has tag "ItemForgeID":
  send (tag "ItemForgeID" of {_nbt}) to player

Adding Your Own Properties

Item Forge allows you to add custom properties very easily. All you have to do is create a function for your property and that's all!


Adding a property with a single value:

Code:
# {_values} is an Object array
function itemForgeHandler_durability(id: string, values: object):
  set durability of {-item::%{_id}%} to {_values}[0]

Adding a property with multiple values:
Code:
function itemForgeHandler_enchantments(id: string, values: object):
  loop ...{_values}:
    set {_enchantment} to loop-value parsed as enchantment type
    if {_enchantment} isn't set:
      # Don't forget to add helpful error messages like this!
      send "&c[ItemForge] Invalid enchantment '%loop-value%' in '%{_id}.enchantments%'." to console
      continue
    enchant {-item::%{_id}%} with {_enchantment}

Adding a custom section property:
Code:
# ItemForge doesn't have any custom sections on it's own so the example is a bit random.

function itemForgeHandler_section(id: string, values: object):
  set {_section} to {_values}[0] # See org.bukkit.configuration.MemorySection
  set {_a} to {_section}.get("a") # 1
  set {_b} to {_section}.get("b") # 2
 
# the yml would look like:
itemid:
  section:
    a: 1
    b: 2

You can join our discord server here to get support.
If you would like to be notified about the updates, please download Update Checker Core.​
Author
erenkara
Downloads
70
Views
281
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from erenkara