LcorpOfficial / LCC-Minecraft-Server

Tracking issues and updates within the Lcorp City Minecraft Server
2 stars 0 forks source link

[Bug Report] - Custom Crafting issue with stackable items #72

Closed Nine-JuanJuan closed 2 years ago

Nine-JuanJuan commented 2 years ago

Describe the bug

When crafting more than one item, auto crafter accepts. When crafting only one item, auto crafter does not accept. Occurs with any stackable item. CustomCrafting bug

To Reproduce

You already did

Expected behavior

No response

Actual behavior

No response

Client info

- OS:
- Client type:
- Mods:

Additional Notes

No response

LcorpOfficial commented 2 years ago

stackable - bulk crafted, works with autocrafter:

{HideFlags: 1, CustomModelData: 5, display: {Name: '{"italic":false,"color":"white","text":"Basic Wand"}', Lore: ['{"italic":false,"color":"dark_gray","text":"Craft this wand with magic-oriented"}', '{"italic":false,"color":"dark_gray","text":"items to give it abilities"}', '{"italic":false,"color":"light_purple","text":"MAGICAL ARTIFACT"}']}, MYTHIC_TYPE: "wandbasic"}

single crafted, does not work

{HideFlags: 1, CustomModelData: 5, display: {Name: '{"italic":false,"color":"white","text":"Basic Wand"}', Lore: ['{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"dark_gray","text":"Craft this wand with magic-oriented"}],"text":""}', '{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"dark_gray","text":"items to give it abilities"}],"text":""}', '{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"light_purple","text":"MAGICAL ARTIFACT"}],"text":""}']}, MYTHIC_TYPE: "wandbasic"}

WolfyScript commented 2 years ago

I am not exactly sure how the autocrafter actually crafts the items, but I found that I do something different for bulk crafting and single crafting. When bulk crafting, CC gets the ItemStack directly from the MM API and adds it to the inventory. When single crafting, CC gets the ItemStack from the crafting inventory. I suspect that Bukkit converts the ItemStack when you add it to the crafting inventory... which usually only happens in the GUI or on de-/serialization.

Some code reference: https://github.com/WolfyScript/CustomCrafting/blob/f04e82469e13b4f1d1684a89a6bc6aa1396cccc4/src/main/java/me/wolfyscript/customcrafting/utils/CraftManager.java#L149-L169

My idea would be to change the line 164 to use the same method like line 155, to directly get the item from the API instead of relaying on Bukkit.

LcorpOfficial commented 2 years ago

seems to be fixed in my testing. closing ticket.