Nbt Crafting (Fabric)

Nbt Crafting (Fabric)

630k Downloads

[bug] Remainder is applied to parts of the recipe it shouldn't be.

DuncanRuns opened this issue · 2 comments

commented

Version:
Minecraft 1.15.2, NBT Crafting Alpha 26

The bug:
We have item a and b in a shaped recipe, and both are the same item.
If item a has a remainder, then using the recipe will result in item b also having that remainder, creating an extra unintended item.
Example:

{
	"type": "minecraft:crafting_shaped",
	"pattern": [
		"ab"
	],
	"key": {
		"a": {
			"item": "minecraft:diamond",
			"remainder":{
				"item":"minecraft:dirt"
			}
		},
		"b":{
			"item": "minecraft:diamond"
		}
	},
	"result": {
		"item": "minecraft:stone",
		"count": 1
	}
}

In the example above, using 2 diamonds of any kind will produce the bug.

Further testing shows that if item a has data requirements, then the bug won't occur unless item b also matches those requirements when using the recipe.
Example:

{
	"type": "minecraft:crafting_shaped",
	"pattern": [
		"ab"
	],
	"key": {
		"a": {
			"item": "minecraft:diamond",
			"remainder":{
				"item":"minecraft:dirt"
			},
			"data":{
				"require":{
					"a":1
				}
			}
		},
		"b":{
			"item": "minecraft:diamond"
			}
		}
	},
	"result": {
		"item": "minecraft:stone",
		"count": 1
	}
}

In the example above, using a diamond with tag a:1, and a regular diamond will work as expected. However using 2 diamonds with a:1 (they don't have to be the exact same) will produce the bug.

Expected behavior:
For only item a to create the remainder

commented

still a problem

commented

I feared that this would blow up sometime 🤔

The current system has trouble differentiating between stacks that match to multiple ingredients.

Workarounds

  • You could possibly try to move the diamond ingredient without nbt data to the top so that ingredient will match first
  • An other attempt would be to deny the data on the simple diamond but that might not be what you want