Disable book exploration on stands
Build / build (push) Canceled after 0s

This commit is contained in:
dnorberg committed 2026-09-22 16:00:12 -04:00
1 parent 50cc2f4930
commit 4ba8516d54
4 files changed
+25 -9

No files matched your search

@@ -36,6 +36,7 @@ public final class DescriptiveBookScreen extends Screen implements ExplorableBoo
private static final int LINK_PANEL_Y = 35;
private static final int LINK_PANEL_WIDTH = 126;
private static final int LINK_PANEL_HEIGHT = 86;
private static final Component EXPLORE_ICON = Component.literal("👁");
private final AgeReference age;
private final ResourceLocation generationProfile;
@@ -87,16 +88,18 @@ public final class DescriptiveBookScreen extends Screen implements ExplorableBoo
}
if (preview.supportsExploration()) {
exploreButton = addRenderableWidget(Button.builder(
Component.translatable("screen.rivencraft.book.explore"), button -> enterExploreOverlay())
.bounds(left + 61, top + 145, 60, 20).build());
EXPLORE_ICON, button -> enterExploreOverlay())
.bounds(left + 81, top + 145, 20, 20).build());
exploreButton.active = bookStandPos == null;
}
if (requestPreview) {
boolean allowExploration = preview.supportsExploration() && bookStandPos == null;
PacketDistributor.sendToServer(new RequestLinkPreviewPayload(
true,
bookStandPos != null,
bookStandPos == null && hand == InteractionHand.OFF_HAND,
bookStandPos == null ? BlockPos.ZERO : bookStandPos,
preview.supportsExploration()
allowExploration
));
}
}
@@ -206,6 +209,9 @@ public final class DescriptiveBookScreen extends Screen implements ExplorableBoo
}
private void enterExploreOverlay() {
if (bookStandPos != null) {
return;
}
preview.setExploring(true);
movingToExploreOverlay = true;
ClientBookExploreOverlay.open(this);
@@ -214,7 +220,7 @@ public final class DescriptiveBookScreen extends Screen implements ExplorableBoo
private void resetExploration() {
preview.resetView();
exploreButton.setMessage(Component.translatable("screen.rivencraft.book.explore"));
exploreButton.setMessage(EXPLORE_ICON);
}
@Override
@@ -38,6 +38,7 @@ public final class LinkingBookScreen extends Screen implements ExplorableBookScr
private static final int PREVIEW_Y = 35;
private static final int PREVIEW_WIDTH = 126;
private static final int PREVIEW_HEIGHT = 86;
private static final Component EXPLORE_ICON = Component.literal("👁");
private final InteractionHand hand;
private final ItemStack book;
@@ -89,16 +90,18 @@ public final class LinkingBookScreen extends Screen implements ExplorableBookScr
}
if (preview.supportsExploration()) {
exploreButton = addRenderableWidget(Button.builder(
Component.translatable("screen.rivencraft.book.explore"), button -> enterExploreOverlay())
.bounds(left + 61, top + 145, 60, 20).build());
EXPLORE_ICON, button -> enterExploreOverlay())
.bounds(left + 81, top + 145, 20, 20).build());
exploreButton.active = bookStandPos == null;
}
if (requestPreview) {
boolean allowExploration = preview.supportsExploration() && bookStandPos == null;
PacketDistributor.sendToServer(new RequestLinkPreviewPayload(
false,
bookStandPos != null,
bookStandPos == null && hand == InteractionHand.OFF_HAND,
bookStandPos == null ? BlockPos.ZERO : bookStandPos,
preview.supportsExploration()
allowExploration
));
}
}
@@ -206,6 +209,9 @@ public final class LinkingBookScreen extends Screen implements ExplorableBookScr
}
private void enterExploreOverlay() {
if (bookStandPos != null) {
return;
}
preview.setExploring(true);
movingToExploreOverlay = true;
ClientBookExploreOverlay.open(this);
@@ -214,7 +220,7 @@ public final class LinkingBookScreen extends Screen implements ExplorableBookScr
private void resetExploration() {
preview.resetView();
exploreButton.setMessage(Component.translatable("screen.rivencraft.book.explore"));
exploreButton.setMessage(EXPLORE_ICON);
}
public void acceptPreview(LinkPreviewPayload payload) {