GregTech CE Unofficial

GregTech CE Unofficial

412k Downloads

Tools lose their oredicts after deal a damage

Exzept1on opened this issue ยท 8 comments

commented

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

  1. Take any tool, for example knife
  2. Do something..
  3. If you have spent durability, then the oredicts are also gone, congratulations.

Additional Information

2023-01-26.18-26-04.mp4
commented

error persisted
gregtech-1.12.2-2.5.2-beta
image
image

commented

I'm also seeing this on 2.5.2-beta.

commented

On the current master branch, with commit hash 96e838b, I am unable to reproduce this. Can you provide further reproduction steps?

commented

they lose the oredict that Crafttweaker or Groovyscript(not tested) assigns to them

before using the tool:
image

after using(where knife oredict)
image

Steps:

  1. Assign any oredict to GT tool
  2. Try to use tool in world
  3. And now, where added oredict :trollface:
commented

Can confirm on 2.5.2 beta. Testing with current master now.

commented

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

commented

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.

commented

Nice, it's really works, thank you!