Hey, i try since some days to make an hotfix for skStuff in 1.12 for item's NBT support (this unofficial fork does not allow NBT interaction for items https://github.com/Tuke-Nuke/SkStuff )
Spigot 1.12
Skript 2.2-dev35b
skript-mirror 0.14.1
The part of the *GET* works fine, now i need help for the part *SET*, i can maybe do *ADD* + *REMOVE* + *DELETE* if i learn how to SET.
exemple of final syntax (Unbreakable is an exemple !!! it will be other NBT after):
Some help : https://github.com/Tuke-Nuke/SkStuff/blob/master/src/me/TheBukor/SkStuff/util/NMS_v1_12_R1.java
https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/NBTTagCompound.java
https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/ItemStack.java
https://bukkit.org/threads/adding-multiple-nbt-tags-to-item.465371/
Thx for help
Spigot 1.12
Skript 2.2-dev35b
skript-mirror 0.14.1
The part of the *GET* works fine, now i need help for the part *SET*, i can maybe do *ADD* + *REMOVE* + *DELETE* if i learn how to SET.
exemple of final syntax (Unbreakable is an exemple !!! it will be other NBT after):
code_language.skript:
add "{Unbreakable:1b}" to item nbt of tool
set item nbt "Unbreakable" of tool to "1b"
set item nbt of tool to "{Unbreakable:1b}" >>> This is equal to an ADD
remove "Unbreakable" to nbt of tool
delete nbt of tool
code_language.skript:
import:
net.minecraft.server.v1_12_R1.NBTBase
net.minecraft.server.v1_12_R1.NBTTagString
net.minecraft.server.v1_12_R1.NBTTagCompound
org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack
net.minecraft.server.v1_12_R1.Item
net.minecraft.server.v1_12_R1.ItemStack
net.minecraft.server.v1_12_R1.Items
item property item[stack] nbt [%-string%]:
#GET work, need help in SET
get:
set {_object} to expression-1
#Return "{}" and not "<none>" if the item does not have any nbt
#set {_nbt} to new NBTTagCompound()
if {_object} is an item:
if expression-2 is not set:
set {_nbt} to CraftItemStack.asNMSCopy({_object}).getTag()
else:
set {_nbt} to CraftItemStack.asNMSCopy({_object}).getTag().get(expression-2)
return {_nbt}
set:
set {_object} to expression-1
if {_object} is an item:
set {_key} to expression-2
set {_nmsItem} to CraftItemStack.asNMSCopy({_object})
set {_comp} to {_nmsItem}.getTag()
set {_tag} to new NBTTagString(change value)
# Upward it's fine, need help below
# I had try to get the current NBT of an item, add/change the new NBT to the current, then save the result.
{_comp}.set({_key}, {_tag}) #Break the code
broadcast "1" #Not show , cause of break
{_nmsItem}.setTag({_comp}) #Break the code
{_nmsItem}.save({_comp}) #I had try something but he need to be parsed as NBTTagCompound
broadcast "2" #Not show , cause of break
# idk if i need the code below
set {_meta} to CraftItemStack.getItemMeta({_nmsItem})
{_object}.setItemMeta({_meta})
Some help : https://github.com/Tuke-Nuke/SkStuff/blob/master/src/me/TheBukor/SkStuff/util/NMS_v1_12_R1.java
https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/NBTTagCompound.java
https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/ItemStack.java
https://bukkit.org/threads/adding-multiple-nbt-tags-to-item.465371/
Thx for help
Last edited: