Ender-Development / Embers-Extended-Life

Continuation of Embers Rekindled, a dwarven magic mod for Minecraft 1.12.2.
https://curseforge.com/minecraft/mc-mods/embers-extended-life
MIT License
8 stars 5 forks source link

Tinker's Hammer Crafting Clearing Hammer NBT #48

Closed Invadermonky closed 1 month ago

Invadermonky commented 1 month ago

Description

Any recipe using (but not consuming) the Tinker's Hammer causes all tag data to be stripped from the hammer. I am unsure if this is intentional behavior, but it breaks compatibility with Omniwand, Morph-o-Tool, or any other mod that stores information in the item tag.

The Problem

https://github.com/Ender-Development/Embers-Extended-Life/blob/2466f6cb0929b979ad97dcd84f2414e0aa8e8c3f/src/main/java/teamroots/embers/item/ItemTinkerHammer.java#L87

In this line of code, the container item is actually being reset after every craft as a new ItemStack with a stack size of 1 is being created and placed in the crafting grid. This is resetting the item completely.

The Fix

The passed ItemStack from the above method should be used to define the container item.

public ItemStack getContainerItem(ItemStack stack){
    return stack.copy();
}
MasterEnderman commented 1 month ago

Will be implemented shortly. 👍🏻

Invadermonky commented 1 month ago

Made a small mistake, the returned ItemStack needs to be a copy of the passed ItemStack since it is a temporary item used by the crafting recipe.

public ItemStack getContainerItem(ItemStack stack){
    return stack.copy();
}