Expand preview for full orbit
Build / build (push) Canceled after 0s

This commit is contained in:
dnorberg committed 2026-09-21 08:36:19 -04:00
1 parent b6f321e6cb
commit bff34b9341
6 files changed
+18 -11

No files matched your search

@@ -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);
@@ -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<SnapshotBlock> 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<LinkPreviewPayload> TYPE = new Type<>(
ResourceLocation.fromNamespaceAndPath(Rivencraft.MOD_ID, "link_preview")
);
@@ -114,10 +114,12 @@ public final class ModNetworking {
BlockPos origin = target.location().pos();
List<LinkPreviewPayload.SnapshotBlock> 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();