CraftTweaker

CraftTweaker

151M Downloads

Null item tag in recipe

Sarous opened this issue ยท 3 comments

commented

Describe the feature you'd like

Not sure if this is a bug report, a feature request, or an admission of my own ignorance, but..

Requesting a command function similar to item.withtag(tag) for use in scripts to specify that an ingredient cannot have a tag of any form: item.withNoTag()

Alternatively, a reverse item.withTag(tag) option which denies a SPECIFIC tag. Ideally, item.withoutTag(tag) would allow for multiple tag slots for more advanced usage: item.withoutTag(tag1,tag2,..)

Describe alternatives you've considered

Tried item.withEmptyTag(), however this does not function as desired. In fact, it seems to have no function at all, possibly a bug. It still permits items with tags (seemingly ANY tag), and does not permit tagless items.

Additional context

Specific context is that I am trying to write a repair recipe. When Item.withtag(uses: 5) is depleted, the tag is simply deleted, rather than being set to (uses: 0). It is currently impossible (else, I can't find a combination to make it possible) to make a recipe which ONLY repairs depleted Item, without also being able to repair partially-used and unused item.

Minecraft version

1.12

Modloader

Forge

commented

Have you tried

<item>.withTag(null)

?

commented

Tested it at your suggestion. .withTag(null) has no apparent affect. Both tagged and untagged versions of the item worked in the recipe.

commented
recipes.addShapeless("name", <minecraft:dirt>, [<minecraft:diamond>.only(function(stack) {
    return !stack.hasTag;
})]);

That works, you can also extract this out to a function like so:

function withNoTag(stack as IItemStack) as IItemStack {
    return stack.only(function(other) {
        return !other.hasTag;
    }
}

recipes.addShapeless("name", <minecraft:dirt>, [withNoTag(<minecraft:diamond>)]);