Skip to content

Commit

Permalink
Update AttacherBuiltInEnchantments.java
Browse files Browse the repository at this point in the history
Fixes issue #35 by limiting capability attachments to items that can only be stacked and enchanted
  • Loading branch information
dje4321 authored May 20, 2023
1 parent ff07aa3 commit 9f4091c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public void deserializeNBT(CompoundTag nbt) {

public static void attach(final AttachCapabilitiesEvent<ItemStack> 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);
}
}
}

0 comments on commit 9f4091c

Please sign in to comment.