diff --git a/polymer-common/src/main/java/eu/pb4/polymer/common/impl/CommonImplUtils.java b/polymer-common/src/main/java/eu/pb4/polymer/common/impl/CommonImplUtils.java index 9ac57009..617d82d4 100644 --- a/polymer-common/src/main/java/eu/pb4/polymer/common/impl/CommonImplUtils.java +++ b/polymer-common/src/main/java/eu/pb4/polymer/common/impl/CommonImplUtils.java @@ -97,7 +97,7 @@ public static Predicate permission(String path, int operato public static boolean permissionCheck(ServerPlayerEntity player, String path, int operatorLevel) { if (CompatStatus.FABRIC_PERMISSION_API_V0) { - return Permissions.check(player, "polymer." + path, operatorLevel); + return Permissions.check(player.getCommandSource(), "polymer." + path, operatorLevel); } else { return player.hasPermissionLevel(operatorLevel); } diff --git a/polymer-core/src/main/java/eu/pb4/polymer/core/api/item/PolymerItemUtils.java b/polymer-core/src/main/java/eu/pb4/polymer/core/api/item/PolymerItemUtils.java index e9a66d52..cee2adc3 100644 --- a/polymer-core/src/main/java/eu/pb4/polymer/core/api/item/PolymerItemUtils.java +++ b/polymer-core/src/main/java/eu/pb4/polymer/core/api/item/PolymerItemUtils.java @@ -380,6 +380,18 @@ public static ItemStack createItemStack(ItemStack itemStack, TooltipType tooltip } var lookup = context.getRegistryWrapperLookup(); + { + var current = itemStack.get(DataComponentTypes.USE_COOLDOWN); + if (current == null) { + out.set(DataComponentTypes.USE_COOLDOWN, new UseCooldownComponent(0.00001f, Optional.of(Registries.ITEM.getId(itemStack.getItem())))); + } else if (current.cooldownGroup().isEmpty()) { + out.set(DataComponentTypes.USE_COOLDOWN, new UseCooldownComponent(current.seconds(), Optional.of(Registries.ITEM.getId(itemStack.getItem())))); + } + } + + + out.set(DataComponentTypes.ENCHANTMENT_GLINT_OVERRIDE, itemStack.hasGlint()); + // Set item name { @@ -415,16 +427,6 @@ public static ItemStack createItemStack(ItemStack itemStack, TooltipType tooltip out.set(DataComponentTypes.CUSTOM_DATA, NbtComponent.DEFAULT.with(RegistryOps.of(NbtOps.INSTANCE, lookup), POLYMER_STACK_ID_CODEC, Registries.ITEM.getId(itemStack.getItem())).getOrThrow()); } - { - var current = itemStack.get(DataComponentTypes.USE_COOLDOWN); - if (current == null) { - out.set(DataComponentTypes.USE_COOLDOWN, new UseCooldownComponent(0.00001f, Optional.of(Registries.ITEM.getId(itemStack.getItem())))); - } else if (current.cooldownGroup().isEmpty()) { - out.set(DataComponentTypes.USE_COOLDOWN, new UseCooldownComponent(current.seconds(), Optional.of(Registries.ITEM.getId(itemStack.getItem())))); - } - } - - out.set(DataComponentTypes.HIDE_ADDITIONAL_TOOLTIP, Unit.INSTANCE); for (var x : HIDEABLE_TOOLTIPS) { @@ -436,9 +438,6 @@ public static ItemStack createItemStack(ItemStack itemStack, TooltipType tooltip } } - out.set(DataComponentTypes.ENCHANTMENT_GLINT_OVERRIDE, itemStack.hasGlint()); - - try { var tooltip = itemStack.getTooltip(context.getPlayer() != null ? Item.TooltipContext.create(context.getPlayer().getWorld()) : Item.TooltipContext.DEFAULT, context.getPlayer(), tooltipContext); if (!tooltip.isEmpty()) {