Tools lose their oredicts after deal a damage
Exzept1on opened this issue ยท 8 comments
GregTech CEu Version
2.5.0
Modpack Used
TFG:NH R4.1.12
Addons Installed
GM v1.1.6
Environment
Singleplayer
New Worlds
Yes
Cross-Mod Interaction
Unsure
Expected Behavior
Tool must not lose oredict
Actual Behavior
Lose their oredicts
Steps to Reproduce
- Take any tool, for example knife
- Do something..
- If you have spent durability, then the oredicts are also gone, congratulations.
Additional Information
2023-01-26.18-26-04.mp4
On the current master branch, with commit hash 96e838b, I am unable to reproduce this. Can you provide further reproduction steps?
Personally, I am playing on TFGNH-Extended 4.2.2 if that helps. https://github.com/TerraFirmaGreg-New-Horizons/TFG-NewHorizons-1.12.2/releases/tag/R4.2.2
After further investigation we found the reason why, and it is something you can fix within your scripts.
Currently adding a GT tool to an oredict with CT, like this, will have the problem:
<ore:mySword>.add(<gregtech:sword>)
The root cause of this is a bug in the Forge OreDictionary, which uses the item's damage/durability to retrieve the ore dictionaries it possesses. It in reality should be using the item's metadata. In order to work around this bug, we create a special case where a tool is using the wildcard metadata upon oredict registration, so it behaves correctly.
In order to utilize our workaround, you will need to adjust your scripts to look like the following:
<ore:mySword>.add(<gregtech:sword:*>)
// or
<ore:mySword>.add(<gregtech:sword:32767>)
Both methods are equivalent. *
or 32767
is the item meta wildcard value, which is intended for use when you want to accept any meta value for your itemstack.
If you add GT tools to ore dictionaries with the meta wildcard value, you should no longer experience this bug.