Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Oct 24, 2024
1 parent a109ccc commit cc258a6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public static Predicate<ServerCommandSource> 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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) {
Expand All @@ -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()) {
Expand Down

0 comments on commit cc258a6

Please sign in to comment.