Item Stages

Item Stages

20M Downloads

[BUG] restrict is not working with tag "Damage"

h0sk1 opened this issue ยท 4 comments

commented

Minecraft Version

1.19.2

Mod Version

5.1.4

Mod Loader

Forge

What environment are you running the mod in?

Dedicated Server

Issue Description

Function "restrict" is not working with damaged items. Could it be that tag "Damage" depends seperately from other tags?

HWOaEtf5PKA

ega8RmOC00w

Damaged diamond sword has tag "Damage". It ignored by the function "restrict"

y0aTgjok5ZQ

commented

Hello, can you please include the script that you are using to create this restriction?

Yes. of course!

Stages.txt

I ve changed the file format, because i cant attach file with format .zs

commented

Hello, can you please include the script that you are using to create this restriction?

commented

@h0sk1 Sorry it took me a bit to look at this. There are a few issues with your script.

  1. You have minercraft instead of minecraft in that script. Not sure if that's intentional or not, but I changed it to minecraft in my script so I could test it with vanilla.

  2. CraftTweaker ingredients are damage sensitive by default so your script is only matching the default damage state. You can use the anyDamage method to accept any damage value.

Here is a working script where the diamond sword acts like your example, and the golden sword works with any damage value.

import mods.itemstages.ItemStages;

ItemStages.restrict(<item:minecraft:diamond_sword>, "one").preventPickup(false).preventInventory(false);
ItemStages.restrict(<item:minecraft:golden_sword>.anyDamage(), "two").preventPickup(false).preventInventory(false);
commented

@Darkhax I just didnt find it in the documentation for the mod. It s working! Thanks for the help!