Refined Storage

Refined Storage

77M Downloads

Damageable item handling confuses RS

DarkHelmet433 opened this issue ยท 3 comments

commented

Issue description:

Damageable items seem to have inconsistent behavior in modded minecraft and this can confuse RS's damaged item heuristics and leads to crafting malfunctions.

What happens:

In my test world, the cutting tool is ID 6680 with no ID metadata. Damage is stored in NBT. Most items seem to be like this including Shears, Immersive engineering wire cutters, hammer, etc.

Other mods (eg: IC2) tend to store the damage value in ID metadata. eg: forge hammer might be 1123/0 for undamaged, 1123/1 for 1% damaged etc.

When RS does crafting with an ingredient that is marked as damageable, it has a heuristic to ignore both NBT and ID/metadata.

This is fine until you try and craft with items like the Thermal Expansion Flux Capacitors. In my case, the tiers are: basic flux capacitor is 4429/0, hardened is 4429/1, reinforced 4429/2 etc.

Crafting each tier requires the previous one. However, they are chargeable items and RS applies the damage rules - ignore NBT and ignore ID metadata. When doing this RS can't tell the difference between the unique items 4429/1 and 4429/2.

Example: with this in the system: https://i.imgur.com/wZjpoSW.png
this malfunction happens: https://i.imgur.com/MQQXSst.png

What you expected to happen:

I expected items with unique ID/metadata to be treated as unique unless I enabled substitutions, even though that would break mods like IC2 with its damageable items.

I would suggest making the damage equivalency more selective. Specifically, Damageable items should continue to ignore NBT but should NOT ignore player-visible ID/metadata differences. Also, so that IC2-style damageable items can be reused, either:

  1. change "OreDict" in patterns to "Allow substitutions" (which would allow both ID/metadata substitutions and oredict variations
  2. or add an additional pattern checkbox: "Ignore Metadata"

In the 1) case, it would be "[X] Processing [X] Allow substitions", while 2) would be "[X] Processing [X] Ignore Metadata [X] Oredict".

If you wanted to treat the ignore-damage as a special case for the cutting tool, then there would need to be an additional pattern property, eg: '[X] Ignore NBT'. If there's no user-accessible toggle for this in the pattern interface then there should be a configurable whitelist for users and pack makers list item-id's that should be damage-ignored. "Ignore NBT" and "Ignore Metadata" are not equivalent in the TE Flux Capacitor case.

Version

  • Minecraft: 1.12.2
  • Forge: 14.23.4.2759
  • Refined Storage: 1.6.6-289 (Jenkins dev build)

Was first encountered a few versions ago. I suspect (but have not verified) that it applies to the entire 1.6 line.

Does this issue occur on a server? Yes (and single player)

commented

I really don't like the solutions you suggested so I'm just removing the heuristics alltogether with no alternative. I'll think about this and we can do something else later.

commented

I think there might have been an oversight in the heuristic. The ICompare.COMPARE_NBT / COMPARE_DAMAGE checks didn't have code for handling subtypes.

I've seen sample code for comparing damage equivalence that also checks getHasSubtypes() to determine whether getMetadata() should be a factor.

Perhaps the heuristic could have been refined rather than removed?

commented

Hijacking this for some brainstorming/ideas on the issue. I can think of 3 issues that the Oredict/metadata/NBT thing comes with.

  1. The magic button. This is the biggest one IMO. Most players have no or only a very rough idea what Oredict/metadata/NBT actually means. That means you either need to show exactly what the option does or make it reasonable to figure out. If there is a solution with just one option to test that would maybe work. Adding a button for each just results in players enabling them on everything.

  2. All or nothing. In some rare cases, it might be desirable to enable Oredict on only a part of the recipe. For example, a recipe that uses copper and thermal expansion hardened glass. You want all types of copper but not all types of hardened glass.
    Similarly, wanting only hardened glass and copper hardened glass to be used in crafting is currently not possible.

  3. Calculation time. Mostly in correlation to issue 1 when players just enable the Oredictionary on all their recipes. No idea about fixing this one as I do not know the code (Caching?).

My still very unrefined solution would be a type of filter interface. Right-clicking an item opens a dialog with multiple options like ignore metadata, ignore NBT, match oredict. But each showing a preview of the Items that match that filter.
Not sure if possible but maybe an option that ignores specific NBT tags? For example, when right-clicking a chargeable item it has an option for ignore Energy.
A config for relevant NBT tags would then be needed I believe. Custom filters seem easy to add then too.

Still don't like how bulky this makes the whole process though. Maybe someone else has better ideas.