Skip to content

Commit

Permalink
Use EnchantmentHelper.hasBindingCurse() instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan-Khar committed Jan 3, 2024
1 parent 2c1109b commit 974adf4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/com/aqupd/aqupdhat/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import me.lucko.fabric.api.permissions.v0.Permissions;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
Expand All @@ -24,7 +25,7 @@ public void onInitialize() {
int hatItemCount = hatItem.getCount();
//logError(String.valueOf(hatItem.getEnchantments()));
if (Permissions.check(user, "aqupdhat.hat.usage", 0)) {
if (!hatItem.getEnchantments().toString().contains("minecraft:binding_curse") || Permissions.check(user, "aqupdhat.hat.bypassbinding") || user.isCreative()) {
if (!EnchantmentHelper.hasBindingCurse(hatItem) || Permissions.check(user, "aqupdhat.hat.bypassbinding") || user.isCreative()) {
if (handItem.isEmpty()) { // If there's no item in hands
if (!hatItem.isEmpty()) {
user.equipStack(EquipmentSlot.HEAD, handItem);
Expand Down

0 comments on commit 974adf4

Please sign in to comment.