From 9f4091cbffc59fe2d90a3524c74a40d69ee9ea8f Mon Sep 17 00:00:00 2001 From: dje4321 Date: Sat, 20 May 2023 03:37:09 -0500 Subject: [PATCH] Update AttacherBuiltInEnchantments.java Fixes issue #35 by limiting capability attachments to items that can only be stacked and enchanted --- .../builtinenchants/AttacherBuiltInEnchantments.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/infamous/dungeons_libraries/capabilities/builtinenchants/AttacherBuiltInEnchantments.java b/src/main/java/com/infamous/dungeons_libraries/capabilities/builtinenchants/AttacherBuiltInEnchantments.java index 326cf21..19651fc 100644 --- a/src/main/java/com/infamous/dungeons_libraries/capabilities/builtinenchants/AttacherBuiltInEnchantments.java +++ b/src/main/java/com/infamous/dungeons_libraries/capabilities/builtinenchants/AttacherBuiltInEnchantments.java @@ -45,6 +45,9 @@ public void deserializeNBT(CompoundTag nbt) { public static void attach(final AttachCapabilitiesEvent event) { final AttacherBuiltInEnchantments.BuiltInEnchantmentsProvider provider = new AttacherBuiltInEnchantments.BuiltInEnchantmentsProvider(event.getObject()); - event.addCapability(AttacherBuiltInEnchantments.BuiltInEnchantmentsProvider.IDENTIFIER, provider); + + if ( event.getObject().isEnchantable() && event.getObject().getMaxStackSize() == 1 ) { + event.addCapability(AttacherBuiltInEnchantments.BuiltInEnchantmentsProvider.IDENTIFIER, provider); + } } }