From 9c28ca0fb79dc8b1b11dd977e8230215d8037c68 Mon Sep 17 00:00:00 2001 From: Uraneptus Date: Mon, 5 Aug 2024 16:55:06 +0200 Subject: [PATCH 1/5] closes #112 --- changelog.txt | 3 +-- src/main/java/vazkii/akashictome/MorphingHandler.java | 6 ------ 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/changelog.txt b/changelog.txt index 0eb3b0e..bbc4039 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,2 +1 @@ -- 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 \ 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 143d3c8..6ead2d0 100644 --- a/src/main/java/vazkii/akashictome/MorphingHandler.java +++ b/src/main/java/vazkii/akashictome/MorphingHandler.java @@ -69,12 +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); From c68a53be006dc0446f1adaa0a195252cba3f4d20 Mon Sep 17 00:00:00 2001 From: Uraneptus Date: Mon, 5 Aug 2024 17:03:26 +0200 Subject: [PATCH 2/5] build --- build.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.properties b/build.properties index a1461c5..50529f5 100644 --- a/build.properties +++ b/build.properties @@ -1,9 +1,9 @@ -#Fri Feb 02 19:58:59 UTC 2024 +#Mon Aug 05 15:03:26 UTC 2024 mapping_channel=official forge_version=43.1.52 mod_id=akashictome dir_repo=./ -build_number=25 +build_number=26 arl_version=1.8.2-56.125 dir_output=../Build Output/AkashicTome/ mapping_version=1.19.2 From b84fac4ea97243ca1ff2d92aeaef97d0c383c1d5 Mon Sep 17 00:00:00 2001 From: Uraneptus Date: Mon, 5 Aug 2024 18:15:24 +0200 Subject: [PATCH 3/5] changing book hud now uses a Component instead of displaying raw name --- build.properties | 2 +- changelog.txt | 3 ++- .../java/vazkii/akashictome/client/HUDHandler.java | 13 ++++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/build.properties b/build.properties index 50529f5..2c9d4b0 100644 --- a/build.properties +++ b/build.properties @@ -3,7 +3,7 @@ mapping_channel=official forge_version=43.1.52 mod_id=akashictome dir_repo=./ -build_number=26 +build_number=25 arl_version=1.8.2-56.125 dir_output=../Build Output/AkashicTome/ mapping_version=1.19.2 diff --git a/changelog.txt b/changelog.txt index bbc4039..6c6c125 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1 +1,2 @@ -- Fix: Removing a book from the Tome changes its title to the raw name \ 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/client/HUDHandler.java b/src/main/java/vazkii/akashictome/client/HUDHandler.java index ca98089..ca83048 100644 --- a/src/main/java/vazkii/akashictome/client/HUDHandler.java +++ b/src/main/java/vazkii/akashictome/client/HUDHandler.java @@ -6,6 +6,8 @@ import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.language.I18n; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; @@ -49,17 +51,22 @@ 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.isSame(morphStack, tomeStack)) { drawStack = morphStack; - line1 = ItemNBTHelper.getCompound(morphStack, MorphingHandler.TAG_TOME_DISPLAY_NAME, false).getString("text"); + line1 = Component.Serializer.fromJson(ItemNBTHelper.getCompound(morphStack, MorphingHandler.TAG_TOME_DISPLAY_NAME, false).getString("text")).withStyle(ChatFormatting.GREEN); line2 = ChatFormatting.GRAY + I18n.get("akashictome.click_morph"); } + if (line1 == null) { + line1 = Component.literal(""); + } + if (!drawStack.isEmpty()) { RenderSystem.enableBlend(); RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); @@ -68,7 +75,7 @@ public void onDrawScreen(RenderGuiOverlayEvent.Post event) { mc.getItemRenderer().renderGuiItem(drawStack, sx, sy); mc.font.drawShadow(event.getPoseStack(), line1, sx + 20, sy + 4, 0xFFFFFFFF); - mc.font.drawShadow(event.getPoseStack(), line2, sx + 25, sy + 14, 0xFFFFFFFF); + mc.font.drawShadow(event.getPoseStack(), line2, sx + 20, sy + 14, 0xFFFFFFFF); } } } From 20dfe57e8d1fafe90fe2feda6e587c67280a958c Mon Sep 17 00:00:00 2001 From: Uraneptus Date: Mon, 5 Aug 2024 18:18:31 +0200 Subject: [PATCH 4/5] build --- build.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.properties b/build.properties index 2c9d4b0..1284a8e 100644 --- a/build.properties +++ b/build.properties @@ -1,9 +1,9 @@ -#Mon Aug 05 15:03:26 UTC 2024 +#Mon Aug 05 16:18:31 UTC 2024 mapping_channel=official forge_version=43.1.52 mod_id=akashictome dir_repo=./ -build_number=25 +build_number=26 arl_version=1.8.2-56.125 dir_output=../Build Output/AkashicTome/ mapping_version=1.19.2 From 572385e40df9ac43b154c20fbac76d7fc8e7daf2 Mon Sep 17 00:00:00 2001 From: Uraneptus Date: Mon, 5 Aug 2024 20:32:28 +0200 Subject: [PATCH 5/5] build --- build.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.properties b/build.properties index 1284a8e..ca549ab 100644 --- a/build.properties +++ b/build.properties @@ -1,9 +1,9 @@ -#Mon Aug 05 16:18:31 UTC 2024 +#Mon Aug 05 18:32:28 UTC 2024 mapping_channel=official forge_version=43.1.52 mod_id=akashictome dir_repo=./ -build_number=26 +build_number=27 arl_version=1.8.2-56.125 dir_output=../Build Output/AkashicTome/ mapping_version=1.19.2