Shovinus / ChopDownUpdated

Realistic Minecraft Tree Chopping
Other
6 stars 3 forks source link

IgnoreTools do not work #43

Closed Insane96 closed 5 years ago

Insane96 commented 5 years ago

Tried adding minecraft:wooden_axe or minecraft:golden_axe but trees still get chopped down with those tools. Even tried with minecraft:wooden_axe:* and minecraft:golden_axe:*

I might be thinking that the problem is here: https://github.com/Shovinus/ChopDownUpdated/blob/master/src/main/java/com/shovinus/chopdownupdated/tree/Tree.java#L341 And here: https://github.com/Shovinus/ChopDownUpdated/blob/master/src/main/java/com/shovinus/chopdownupdated/config/Config.java#L145

I'm thinking that the Tree.stackName(ItemStack) method returns even the metadata of the item so e.g. with a newly crafted golden axe you get minecraft:golden_axe:0 and instead in the config you check for minecraft:golden_axe(:*) so it doesn't match. Infact, setting minecraft:golden_axe:0 in the config works if the golden axe is and not damaged.

Shovinus commented 5 years ago

Ok, thank you I will check into this.

Shovinus commented 5 years ago

Ahh I see what you did now, it uses regex, not wildcards So what you typed was minecraft:golden_axe:* this means it will match minecraft:golden_axe or minecraft:golden_axe: or minecraft:golden_axe:: etc. * in regex means match the previous character or set 0 or more times. So you are matching : 0 or more times.

If you look at the tinkers example it is tconstruct:lumberaxe:.*, the . is a special character for regex that means any character. So this will match tconstruct:lumberaxe: and then anything else after it also.

To conclude, use minecraft:wooden_axe:.* and minecraft:golden_axe:.*

Insane96 commented 5 years ago

Awesome, thanks