Public Access
This commit is contained in:
1 parent
f57afab363
commit
5e1a3fc150
3 files changed
+25
-10
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user