fixed item names being surrounded by braces

This commit is contained in:
Ell 2021-12-28 11:58:37 +01:00
parent 5ea30ba1b4
commit bcfd9e7bf9
5 changed files with 6 additions and 6 deletions

View file

@ -6,7 +6,7 @@ import java.util.Comparator;
public enum ItemOrder { public enum ItemOrder {
AMOUNT(Comparator.comparingInt(ItemStack::getCount)), AMOUNT(Comparator.comparingInt(ItemStack::getCount)),
NAME(Comparator.comparing(s -> s.getDisplayName().getString())), NAME(Comparator.comparing(s -> s.getHoverName().getString())),
MOD(Comparator.comparing(s -> s.getItem().getCreatorModId(s))); MOD(Comparator.comparing(s -> s.getItem().getCreatorModId(s)));
public final Comparator<ItemStack> comparator; public final Comparator<ItemStack> comparator;

View file

@ -83,7 +83,7 @@ public class PacketButton {
NetworkHooks.openGui((ServerPlayer) player, new MenuProvider() { NetworkHooks.openGui((ServerPlayer) player, new MenuProvider() {
@Override @Override
public Component getDisplayName() { public Component getDisplayName() {
return stack.getDisplayName(); return stack.getHoverName();
} }
@Nullable @Nullable

View file

@ -149,7 +149,7 @@ public abstract class AbstractPipeGui<T extends AbstractPipeContainer<?>> extend
private void drawForeground(PoseStack matrix, int mouseX, int mouseY) { private void drawForeground(PoseStack matrix, int mouseX, int mouseY) {
if (mouseX < this.x || mouseY < this.y || mouseX >= this.x + 28 || mouseY >= this.y + 32) if (mouseX < this.x || mouseY < this.y || mouseX >= this.x + 28 || mouseY >= this.y + 32)
return; return;
AbstractPipeGui.this.renderTooltip(matrix, this.moduleStack.getDisplayName(), mouseX - AbstractPipeGui.this.leftPos, mouseY - AbstractPipeGui.this.topPos); AbstractPipeGui.this.renderTooltip(matrix, this.moduleStack.getHoverName(), mouseX - AbstractPipeGui.this.leftPos, mouseY - AbstractPipeGui.this.topPos);
} }
private boolean onClicked(double mouseX, double mouseY, int button) { private boolean onClicked(double mouseX, double mouseY, int button) {

View file

@ -157,7 +157,7 @@ public class ItemTerminalBlockEntity extends BlockEntity implements IPipeConnect
this.updateItems(); this.updateItems();
var requested = this.requestItemImpl(stack, onItemUnavailable(player)); var requested = this.requestItemImpl(stack, onItemUnavailable(player));
if (requested > 0) { if (requested > 0) {
player.sendMessage(new TranslatableComponent("info." + PrettyPipes.ID + ".sending", requested, stack.getDisplayName()).setStyle(Style.EMPTY.applyFormat(ChatFormatting.GREEN)), UUID.randomUUID()); player.sendMessage(new TranslatableComponent("info." + PrettyPipes.ID + ".sending", requested, stack.getHoverName()).setStyle(Style.EMPTY.applyFormat(ChatFormatting.GREEN)), UUID.randomUUID());
} else { } else {
onItemUnavailable(player).accept(stack); onItemUnavailable(player).accept(stack);
} }
@ -308,6 +308,6 @@ public class ItemTerminalBlockEntity extends BlockEntity implements IPipeConnect
} }
public static Consumer<ItemStack> onItemUnavailable(Player player) { public static Consumer<ItemStack> onItemUnavailable(Player player) {
return s -> player.sendMessage(new TranslatableComponent("info." + PrettyPipes.ID + ".not_found", s.getDisplayName()).setStyle(Style.EMPTY.applyFormat(ChatFormatting.RED)), UUID.randomUUID()); return s -> player.sendMessage(new TranslatableComponent("info." + PrettyPipes.ID + ".not_found", s.getHoverName()).setStyle(Style.EMPTY.applyFormat(ChatFormatting.RED)), UUID.randomUUID());
} }
} }

View file

@ -244,7 +244,7 @@ public class ItemTerminalGui extends AbstractContainerScreen<ItemTerminalContain
search = search.substring(1); search = search.substring(1);
} else { } else {
// don't use formatted text here since we want to search for name // don't use formatted text here since we want to search for name
toCompare = s.getLeft().getDisplayName().getString(); toCompare = s.getLeft().getHoverName().getString();
} }
return !toCompare.toLowerCase(Locale.ROOT).contains(search.toLowerCase(Locale.ROOT)); return !toCompare.toLowerCase(Locale.ROOT).contains(search.toLowerCase(Locale.ROOT));
}); });