Crafting Tweaks

Crafting Tweaks

111M Downloads

Dupe(?) glitch when balancing/spreading items with NBT data

nathanrsfba opened this issue ยท 3 comments

commented

Minecraft Version

1.12

Mod Loader

Forge

Mod Loader Version

14.23.5.2847

Mod Version

8.1.9

Describe the Issue

I've discovered a "dupe" glitch when balancing or spreading items of the same type, but differing NBT data, in the crafting grid

The following steps will reproduce the glitch. This was tested in in 1.12.2 with Crafting Tweaks v8.1.9, Thermal Expansion (and its dependencies) and JEI, and no other mods installed. Forge version is 14.23.5.2847 if it matters.

  • Craft 4 redstone furnaces
  • Put one down
  • Install a resonant conversion kit into it
  • Pick it up
  • Put it in the crafting grid
  • Put the other 3 next to it in a single stack
  • Use the 'balance grid' function

You will now have 2 regular furnaces and 2 upgraded ones!

The bug is not restricted to Thermal Expansion; I've reproduced it with items from Actually Additions, Immersive Engineering, and RFTools as well. It seems to occur in any item that can stack and has NBT data. It seems like it's considering the two types of item identical, even though the NBT data differs

Scratch all that, I figured out an even simpler demonstration, that requires no other mods: Take an item that stacks. A piece of paper for instance. Name it in an anvil. Place it in a crafting grid with a stack of unnamed items and balance the grid. Suddenly half of the unnamed versions are now named.

Logs

No response

Do you use any performance-enhancing mods (e.g. OptiFine)?

No response

commented

TBH I'm not entirely sure if this is technically a 'dupe' glitch, as it doesn't duplicate items, so much as allow for upgrading lower-tier items to higher-tier for 'free'. Though it could potentially be used for actual duplication if used on machines that can hold items or energy when picked up

commented

Does this still happen on modern Minecraft versions?

commented

Apologies for not responding for so long.

In answer to your question, so far I've only tried it in 1.12, but I suspect later versions will have the same issue (see below).

Examining the code, it appears the problem is this bit of code in DefaultProviderV2Impl.java (1.12 version):

String key = itemStack.getUnlocalizedName() + "@" + itemStack.getItemDamage();

The code is creating a map and a set to keep track of each different 'type' of item in the grid. However, the key for both is only based on the item's resource name and damage, and not the NBT data. Thus, objects of the same type but different NBT values will 'look identical' to the balancing code.

Looking at the 1.16 code, I see similar (but slightly different) code, that doesn't appear to note NBT values, so will probably display the same issue.

I'm currently playing around with possible fixes on my own fork.