WolfyScript / CustomCrafting

Spigot based plugin to create your own custom Recipes & Items. Designed to be easy to use with in-game GUI and tons of configuration possibilities.
https://modrinth.com/plugin/customcrafting
GNU General Public License v3.0
115 stars 35 forks source link

Custom Item NBT data not correctly reproduced #360

Closed Veyjinn closed 5 months ago

Veyjinn commented 6 months ago

What happened?

When creating an custom item with the help of Itemsadder or the Give Command Item Generator (https://www.gamergeeks.net/apps/minecraft/give-command-generator/armor) the custom item is not being detected in the custom crafting recipe after reloading the plugin.

I've been trying to identify the issue for weeks now but with little to no success. The one thing I noticed is that sometimes when adding various types of nbt the recipe breaks. For example I've been trying to add knockback resistance. After modifying the recipe and reloading the plugin the recipe stops working.

I would really appreciate Your assistance in this matter.

How can the bug be reproduced?

An example command that has been used on a command block to create the custom item:

give @a iron_helmet{Trim:{pattern:host,material:iron},display:{Name:'["",{"text":"Iron Greathelm","italic":false,"color":"#6633ff"}]',Lore:['["",{"text":"It\'s a solid and","italic":false,"color":"gray"}]','["",{"text":"heavy piece of armor","italic":false,"color":"gray"}]','["",{"text":"(Upgrade 1/2)","italic":false,"color":"gray"}]','[""]','["",{"text":"〔","italic":false,"bold":true,"color":"#6633ff"},{"text":"TIER III","italic":false,"color":"#6633ff"},{"text":"〕","italic":false,"bold":true,"color":"#6633ff"}]']},Enchantments:[{lvl:2,id:protection}],Unbreakable:1,RepairCost:999999,AttributeModifiers:[{AttributeName:"generic.armor",Amount:1.3,Slot:head,Name:"generic.armor",UUID:[I;-12435,12450,92014,-24900]},{AttributeName:"generic.knockback_resistance",Amount:0.03,Slot:head,Name:"generic.knockback_resistance",UUID:[I;-12435,12750,92014,-25500]},{AttributeName:"generic.max_health",Amount:2,Slot:head,Name:"generic.max_health",UUID:[I;-12435,13050,92014,-26100]},{AttributeName:"generic.armor_toughness",Amount:1,Slot:head,Name:"generic.armor_toughness",UUID:[I;-12435,13350,92014,-26700]}],HideFlags:132}

Just try to create the armor and add it the customcrafting recipe

Expected Behaviour?

Custom armor should naturally be a part of Custom Crafting. The expected result is that custom armor should be recognized by the plugin.

Plugin version

customcrafting-spigot-4.16.9.1 & wolfyutils-spigot-4.16.15.1

Server software

paper-1.20.4-466 (newest 05.04.2024)

Relevant log output

No errors show on console

Submit issue

Veyjinn commented 5 months ago

I've found a workaround by saving and reloading the custom armor recipe and copying the custom armor direct from the CC folder in the recipe editor. By doing this the copied armor is detectable in the crafting table

WolfyScript commented 5 months ago

Alright, I was able to replicate the issue. I'll work on a fix now.

WolfyScript commented 5 months ago

I have found a really weird behaviour from Spigot here.
The NBT from the item stored in the recipe and the item from the give command are exactly the same, still Spigot says they are not equal. My suspicion is that the internal conversion Spigot is doing for items is messing things up.

Workarounds:

So this is not something I can fix, but the workarounds make it work.