[BUG] restrict is not working with tag "Damage"
h0sk1 opened this issue ยท 4 comments
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?
Damaged diamond sword has tag "Damage". It ignored by the function "restrict"
Hello, can you please include the script that you are using to create this restriction?
Yes. of course!
I ve changed the file format, because i cant attach file with format .zs
Hello, can you please include the script that you are using to create this restriction?
@h0sk1 Sorry it took me a bit to look at this. There are a few issues with your script.
-
You have
minercraft
instead ofminecraft
in that script. Not sure if that's intentional or not, but I changed it tominecraft
in my script so I could test it with vanilla. -
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);
@Darkhax I just didnt find it in the documentation for the mod. It s working! Thanks for the help!