diff --git a/changelog.txt b/changelog.txt index 0eb3b0e..6c6c125 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,2 +1,2 @@ -- Updated several lang files -- Added a bunch of mod books to the default config \ No newline at end of file +- Fix: Removing a book from the Tome changes its title to the raw name +- Fix: Changing book option when looking at a mod's block is using the raw name \ No newline at end of file diff --git a/src/main/java/vazkii/akashictome/MorphingHandler.java b/src/main/java/vazkii/akashictome/MorphingHandler.java index 9966dca..cdc78a3 100644 --- a/src/main/java/vazkii/akashictome/MorphingHandler.java +++ b/src/main/java/vazkii/akashictome/MorphingHandler.java @@ -37,7 +37,7 @@ public final class MorphingHandler { public void onPlayerLeftClick(PlayerInteractEvent.LeftClickEmpty event) { ItemStack stack = event.getItemStack(); if (!stack.isEmpty() && isAkashicTome(stack) && !stack.is(Registries.TOME.get())) { - NetworkHandler.sendToServer(new MessageUnmorphTome()); //TODO fix + NetworkHandler.sendToServer(new MessageUnmorphTome()); } } @@ -69,15 +69,6 @@ public void onItemDropped(ItemTossEvent event) { } copyCmp.remove("display"); - /* - Component displayName = null; - CompoundTag nameCmp = (CompoundTag) copyCmp.get(TAG_TOME_DISPLAY_NAME); - if (nameCmp != null) - displayName = Component.literal(nameCmp.getString("text")); - if (displayName != null && !displayName.getString().isEmpty() && displayName != copy.getHoverName()) - copy.setHoverName(displayName); - - */ copyCmp.remove(TAG_MORPHING); copyCmp.remove(TAG_TOME_DISPLAY_NAME); diff --git a/src/main/java/vazkii/akashictome/client/HUDHandler.java b/src/main/java/vazkii/akashictome/client/HUDHandler.java index 5cd25bc..7fdd28e 100644 --- a/src/main/java/vazkii/akashictome/client/HUDHandler.java +++ b/src/main/java/vazkii/akashictome/client/HUDHandler.java @@ -53,11 +53,12 @@ public void onDrawScreen(RenderGuiOverlayEvent.Post event) { if (!state.isAir()) { ItemStack drawStack = ItemStack.EMPTY; - String line1 = ""; + MutableComponent line1 = null; String line2 = ""; String mod = MorphingHandler.getModFromState(state); ItemStack morphStack = MorphingHandler.getShiftStackForMod(tomeStack, mod); + if (!morphStack.isEmpty() && !ItemStack.isSameItemSameTags(morphStack, tomeStack)) { drawStack = morphStack; line1 = NBTUtils.getCompound(morphStack, MorphingHandler.TAG_TOME_DISPLAY_NAME, false).getString("text"); @@ -70,7 +71,6 @@ public void onDrawScreen(RenderGuiOverlayEvent.Post event) { RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); int sx = res.getGuiScaledWidth() / 2 - 17; int sy = res.getGuiScaledHeight() / 2 + 2; - guiGraphics.renderItem(drawStack, sx, sy); guiGraphics.drawString(mc.font, line1Component.withStyle(ChatFormatting.GREEN), sx + 20, sy + 4, 0xFFFFFFFF); guiGraphics.drawString(mc.font, line2, sx + 25, sy + 14, 0xFFFFFFFF);