Darkhax-Minecraft / ItemStages

Allows items to be put into stages.
GNU Lesser General Public License v2.1
7 stars 18 forks source link

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

Closed h0sk1 closed 2 months ago

h0sk1 commented 2 months ago

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

Darkhax commented 2 months ago

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

h0sk1 commented 2 months ago

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

Darkhax commented 2 months ago

@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);
h0sk1 commented 2 months ago

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