Remove shadows from linking book text
Build / build (push) Canceled after 0s

This commit is contained in:
dnorberg committed 2026-09-21 08:02:17 -04:00
1 parent f57afab363
commit 5e1a3fc150
3 files changed
+25 -10

No files matched your search

+3
View File
@@ -107,6 +107,9 @@ Version 0.1.11 opens the stored book interface when a Book Stand is used with
an empty hand. Linking Books travel through the preview panel, and the server
revalidates the stand position, interaction distance, stored item, and target.
Version 0.1.12 replaces the Linking Book screen's convenience text draws with
explicit no-shadow rendering for clearer dark ink on the parchment texture.
The preview code is separated behind a renderer interface and uses an isolated
Ponder level. The first iteration supplies the animated loading boundary; the
next iteration will add server-authoritative snapshot transport and populate
+1 -1
View File
@@ -33,7 +33,7 @@ mod_name=Rivencraft
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=LGPL-3.0-or-later
# The mod version. See https://semver.org/
mod_version=0.1.11
mod_version=0.1.12
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
@@ -15,6 +15,7 @@ import net.minecraft.client.gui.screens.Screen;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.FormattedCharSequence;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.item.ItemStack;
import net.neoforged.neoforge.network.PacketDistributor;
@@ -100,22 +101,22 @@ public final class LinkingBookScreen extends Screen {
TEXTURE_WIDTH, TEXTURE_HEIGHT, TEXTURE_WIDTH, TEXTURE_HEIGHT);
if (target == null) {
graphics.drawWordWrap(font, Component.translatable("screen.rivencraft.book.name_prompt"),
left + 177, top + 45, 124, BOOK_TEXT_COLOR);
drawWrappedWithoutShadow(graphics, Component.translatable("screen.rivencraft.book.name_prompt"),
left + 177, top + 45, 124);
} else {
int previewLeft = left + PREVIEW_X;
int previewTop = top + PREVIEW_Y;
preview.render(graphics, previewLeft, previewTop, PREVIEW_WIDTH, PREVIEW_HEIGHT, partialTick);
int rightCenter = left + 239;
graphics.drawWordWrap(font, title, left + 177, top + 43, 124, BOOK_TEXT_COLOR);
drawWrappedWithoutShadow(graphics, title, left + 177, top + 43, 124);
BlockPos pos = target.location().pos();
graphics.drawCenteredString(font, Component.literal(target.location().dimension().location().toString()),
rightCenter, top + 76, BOOK_TEXT_COLOR);
graphics.drawCenteredString(font, Component.literal(pos.getX() + ", " + pos.getY() + ", " + pos.getZ()),
rightCenter, top + 89, BOOK_TEXT_COLOR);
graphics.drawCenteredString(font, Component.translatable("screen.rivencraft.book.click_to_link"),
rightCenter, top + 119, BOOK_TEXT_COLOR);
drawCenteredWithoutShadow(graphics,
Component.literal(target.location().dimension().location().toString()), rightCenter, top + 76);
drawCenteredWithoutShadow(graphics,
Component.literal(pos.getX() + ", " + pos.getY() + ", " + pos.getZ()), rightCenter, top + 89);
drawCenteredWithoutShadow(graphics,
Component.translatable("screen.rivencraft.book.click_to_link"), rightCenter, top + 119);
}
super.render(graphics, mouseX, mouseY, partialTick);
@@ -158,4 +159,15 @@ public final class LinkingBookScreen extends Screen {
}
onClose();
}
private void drawCenteredWithoutShadow(GuiGraphics graphics, Component text, int centerX, int y) {
graphics.drawString(font, text, centerX - font.width(text) / 2, y, BOOK_TEXT_COLOR, false);
}
private void drawWrappedWithoutShadow(GuiGraphics graphics, Component text, int x, int y, int width) {
for (FormattedCharSequence line : font.split(text, width)) {
graphics.drawString(font, line, x, y, BOOK_TEXT_COLOR, false);
y += font.lineHeight;
}
}
}