From bff34b93419ad85e51c33081d4c0a43c60ae45a8 Mon Sep 17 00:00:00 2001 From: Dustin Norberg Date: Mon, 21 Sep 2026 08:36:19 -0400 Subject: [PATCH] Expand preview for full orbit --- README.md | 2 +- docs/PORTING.md | 8 +++++--- gradle.properties | 2 +- .../client/preview/PonderDestinationPreviewRenderer.java | 8 +++++--- .../dnorberg/rivencraft/network/LinkPreviewPayload.java | 3 ++- .../net/dnorberg/rivencraft/network/ModNetworking.java | 6 ++++-- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 319f405..0f5ca0a 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ right-clicking with an empty hand. Sneak-right-click with an empty hand to take the book back and restore the vanilla lectern. Breaking a Book Stand drops both the stored book and a vanilla lectern. -Bound Linking Books request a server-validated 9-by-7-by-17 snapshot around +Bound Linking Books request a server-validated 17-by-7-by-17 snapshot around their destination and render its blocks as a rotating Ponder scene on the left page, backed by the destination biome's sky color. The snapshot is visual only; the server independently validates every link. diff --git a/docs/PORTING.md b/docs/PORTING.md index 310d045..c5c103c 100644 --- a/docs/PORTING.md +++ b/docs/PORTING.md @@ -123,10 +123,12 @@ component serialization, successful safe travel with restored orientation, and rejection of fully blocked destinations. The test suite uses a minimal bundled structure template and runs with `./gradlew runGameTestServer`. +Version 0.1.16 makes destination previews sample a centered 17-by-7-by-17 +volume. The Ponder scene uses a scale that keeps its full horizontal diagonal +inside the panel, so the complete snapshot remains available during its orbit. + 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 -that level with the destination blocks. +Ponder level populated from server-authoritative destination snapshots. ## Version policy diff --git a/gradle.properties b/gradle.properties index 25ab37a..e7508c5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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.15 +mod_version=0.1.16 # 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 diff --git a/src/main/java/net/dnorberg/rivencraft/client/preview/PonderDestinationPreviewRenderer.java b/src/main/java/net/dnorberg/rivencraft/client/preview/PonderDestinationPreviewRenderer.java index 5c439c2..705cb60 100644 --- a/src/main/java/net/dnorberg/rivencraft/client/preview/PonderDestinationPreviewRenderer.java +++ b/src/main/java/net/dnorberg/rivencraft/client/preview/PonderDestinationPreviewRenderer.java @@ -43,7 +43,7 @@ public final class PonderDestinationPreviewRenderer implements DestinationPrevie public PonderDestinationPreviewRenderer() { Minecraft minecraft = Minecraft.getInstance(); previewLevel = new PonderLevel(BlockPos.ZERO, minecraft.level); - selection = SelectionImpl.of(new BoundingBox(0, 0, 0, 8, 6, 16)); + selection = SelectionImpl.of(new BoundingBox(0, 0, 0, 16, 6, 16)); section = new WorldSectionElementImpl(selection); } @@ -105,8 +105,10 @@ public final class PonderDestinationPreviewRenderer implements DestinationPrevie poseStack.mulPose(Axis.XP.rotationDegrees(-28.0F)); poseStack.mulPose(Axis.YP.rotationDegrees((ticks + partialTick) * 0.6F)); UIRenderHelper.flipForGuiRender(poseStack); - poseStack.scale(7.0F, 7.0F, 7.0F); - poseStack.translate(-4.5F, -1.5F, -8.5F); + // A 17×17 footprint has a 24-block diagonal. This scale fits that + // diagonal in the panel, including at the 45° points of the orbit. + poseStack.scale(4.6F, 4.6F, 4.6F); + poseStack.translate(-8.5F, -1.5F, -8.5F); SuperRenderTypeBuffer buffer = DefaultSuperRenderTypeBuffer.getInstance(); section.renderFirst(previewLevel, buffer, graphics, partialTick); diff --git a/src/main/java/net/dnorberg/rivencraft/network/LinkPreviewPayload.java b/src/main/java/net/dnorberg/rivencraft/network/LinkPreviewPayload.java index 9dcae18..62b504b 100644 --- a/src/main/java/net/dnorberg/rivencraft/network/LinkPreviewPayload.java +++ b/src/main/java/net/dnorberg/rivencraft/network/LinkPreviewPayload.java @@ -12,7 +12,8 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; public record LinkPreviewPayload(int skyColor, List blocks) implements CustomPacketPayload { - private static final int MAX_BLOCKS = 9 * 7 * 17; + /** A square footprint keeps every side of the scene available during a full orbit. */ + private static final int MAX_BLOCKS = 17 * 7 * 17; public static final Type TYPE = new Type<>( ResourceLocation.fromNamespaceAndPath(Rivencraft.MOD_ID, "link_preview") ); diff --git a/src/main/java/net/dnorberg/rivencraft/network/ModNetworking.java b/src/main/java/net/dnorberg/rivencraft/network/ModNetworking.java index dad735a..b41b0ba 100644 --- a/src/main/java/net/dnorberg/rivencraft/network/ModNetworking.java +++ b/src/main/java/net/dnorberg/rivencraft/network/ModNetworking.java @@ -114,10 +114,12 @@ public final class ModNetworking { BlockPos origin = target.location().pos(); List blocks = new ArrayList<>(); - for (BlockPos pos : BlockPos.betweenClosed(origin.offset(-4, -2, -8), origin.offset(4, 4, 8))) { + // The preview rotates through a complete orbit. Use the same radius on + // both horizontal axes so no side falls outside the snapshot at 90°. + for (BlockPos pos : BlockPos.betweenClosed(origin.offset(-8, -2, -8), origin.offset(8, 4, 8))) { var state = level.getBlockState(pos); if (!state.isAir()) { - blocks.add(new LinkPreviewPayload.SnapshotBlock(pos.subtract(origin).offset(4, 2, 8), state)); + blocks.add(new LinkPreviewPayload.SnapshotBlock(pos.subtract(origin).offset(8, 2, 8), state)); } } int skyColor = level.getBiome(origin).value().getSkyColor();