From d41794e5bd26019ac14e78535a495a53d50a69b1 Mon Sep 17 00:00:00 2001 From: Partonetrain Date: Wed, 10 Apr 2024 14:33:00 -0500 Subject: [PATCH] fix tag --- .../partonetrain/botaniacombat/item/SlaughtersawItem.java | 2 +- .../botaniacombat/mixin/EnchantmentMixin.java | 8 +++----- .../mixin/slaughtersaw/EnchantmentHelperMixin.java | 1 - src/main/resources/data/c/tags/blocks/mineable/knife.json | 3 +++ 4 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 src/main/resources/data/c/tags/blocks/mineable/knife.json diff --git a/src/main/java/info/partonetrain/botaniacombat/item/SlaughtersawItem.java b/src/main/java/info/partonetrain/botaniacombat/item/SlaughtersawItem.java index 447df89..2157b87 100644 --- a/src/main/java/info/partonetrain/botaniacombat/item/SlaughtersawItem.java +++ b/src/main/java/info/partonetrain/botaniacombat/item/SlaughtersawItem.java @@ -69,7 +69,7 @@ public static void initAllowedEnchantments() { } } - public static boolean enchantmentAllowed(Enchantment enchantment){ + public static boolean isEnchantmentAllowed(Enchantment enchantment){ return allowedEnchantments.contains(enchantment); } diff --git a/src/main/java/info/partonetrain/botaniacombat/mixin/EnchantmentMixin.java b/src/main/java/info/partonetrain/botaniacombat/mixin/EnchantmentMixin.java index fae8dce..60d62e1 100644 --- a/src/main/java/info/partonetrain/botaniacombat/mixin/EnchantmentMixin.java +++ b/src/main/java/info/partonetrain/botaniacombat/mixin/EnchantmentMixin.java @@ -3,10 +3,7 @@ import info.partonetrain.botaniacombat.item.SlaughtersawItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.enchantment.Enchantment; -import net.minecraft.world.item.enchantment.EnchantmentCategory; -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @@ -14,10 +11,11 @@ @Mixin(Enchantment.class) public abstract class EnchantmentMixin { - @Inject(method = "canEnchant", at = @At("RETURN"), cancellable = true) + @Inject(method = "canEnchant", at = @At("HEAD"), cancellable = true) private void botaniaCombat$canEnchant(ItemStack stack, CallbackInfoReturnable cir) { if(stack.getItem() instanceof SlaughtersawItem){ - cir.setReturnValue(SlaughtersawItem.enchantmentAllowed((Enchantment)(Object) this)); + Enchantment self = (Enchantment) (Object) this; + cir.setReturnValue(SlaughtersawItem.isEnchantmentAllowed(self)); //NOTE: FDRF overrides Backstabbing's canEnchant method. // As of writing, this code is ineffective for Backstabbing. //See issue: https://github.com/MehVahdJukaar/FarmersDelight/issues/22 diff --git a/src/main/java/info/partonetrain/botaniacombat/mixin/slaughtersaw/EnchantmentHelperMixin.java b/src/main/java/info/partonetrain/botaniacombat/mixin/slaughtersaw/EnchantmentHelperMixin.java index 050fc03..8be081e 100644 --- a/src/main/java/info/partonetrain/botaniacombat/mixin/slaughtersaw/EnchantmentHelperMixin.java +++ b/src/main/java/info/partonetrain/botaniacombat/mixin/slaughtersaw/EnchantmentHelperMixin.java @@ -1,6 +1,5 @@ package info.partonetrain.botaniacombat.mixin.slaughtersaw; -import info.partonetrain.botaniacombat.BotaniaCombat; import info.partonetrain.botaniacombat.item.SlaughtersawItem; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; diff --git a/src/main/resources/data/c/tags/blocks/mineable/knife.json b/src/main/resources/data/c/tags/blocks/mineable/knife.json new file mode 100644 index 0000000..86dde3d --- /dev/null +++ b/src/main/resources/data/c/tags/blocks/mineable/knife.json @@ -0,0 +1,3 @@ +{ + "values": [] +}