Public Access
This commit is contained in:
1 parent
83af20ab6c
commit
3ecb01940d
7 files changed
+28
-20
No files matched your search
@@ -26,10 +26,11 @@ 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 book back and restore the vanilla lectern. Breaking a Book Stand drops both
|
||||||
the stored book and a vanilla lectern.
|
the stored book and a vanilla lectern.
|
||||||
|
|
||||||
Bound Linking Books request a server-validated 9-by-128-by-9 snapshot around
|
Bound Linking Books request a server-validated 9-by-64-by-9 snapshot around
|
||||||
their destination and render its blocks as a rotating Ponder scene on the left
|
their destination. The book renders a fixed 9-by-7-by-9 window centered on the
|
||||||
page, backed by the destination biome's sky color. The snapshot is visual only;
|
link point as a rotating Ponder scene on the left page, backed by the
|
||||||
the server independently validates every link.
|
destination biome's sky color. The snapshot is visual only; the server
|
||||||
|
independently validates every link.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
|
|||||||
@@ -131,6 +131,10 @@ Version 0.1.17 changes destination previews to a 9-by-128-by-9 volume: a
|
|||||||
square horizontal footprint with a vertical slice spanning 64 blocks below and
|
square horizontal footprint with a vertical slice spanning 64 blocks below and
|
||||||
63 blocks above the recorded linking location.
|
63 blocks above the recorded linking location.
|
||||||
|
|
||||||
|
Version 0.1.18 changes the preview cache to 9-by-64-by-9, spanning 32 blocks
|
||||||
|
below and 31 above the link point. The Ponder section remains locked to the
|
||||||
|
centered 9-by-7-by-9 window so the book retains a readable close-up.
|
||||||
|
|
||||||
The preview code is separated behind a renderer interface and uses an isolated
|
The preview code is separated behind a renderer interface and uses an isolated
|
||||||
Ponder level populated from server-authoritative destination snapshots.
|
Ponder level populated from server-authoritative destination snapshots.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -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.
|
# 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
|
mod_license=LGPL-3.0-or-later
|
||||||
# The mod version. See https://semver.org/
|
# The mod version. See https://semver.org/
|
||||||
mod_version=0.1.17
|
mod_version=0.1.18
|
||||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
# 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.
|
# This should match the base package used for the mod sources.
|
||||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
|
|||||||
+9
-8
@@ -34,7 +34,7 @@ public final class PonderDestinationPreviewRenderer implements DestinationPrevie
|
|||||||
private static final Vector3f DIFFUSE_LIGHT_0 = new Vector3f(0.4F, -1.0F, 0.7F).normalize();
|
private static final Vector3f DIFFUSE_LIGHT_0 = new Vector3f(0.4F, -1.0F, 0.7F).normalize();
|
||||||
private static final Vector3f DIFFUSE_LIGHT_1 = new Vector3f(-0.4F, -0.5F, 0.7F).normalize();
|
private static final Vector3f DIFFUSE_LIGHT_1 = new Vector3f(-0.4F, -0.5F, 0.7F).normalize();
|
||||||
private final PonderLevel previewLevel;
|
private final PonderLevel previewLevel;
|
||||||
private final Selection selection;
|
private final Selection snapshotSelection;
|
||||||
private final PonderSceneElement section;
|
private final PonderSceneElement section;
|
||||||
private int ticks;
|
private int ticks;
|
||||||
private boolean loaded;
|
private boolean loaded;
|
||||||
@@ -43,13 +43,16 @@ public final class PonderDestinationPreviewRenderer implements DestinationPrevie
|
|||||||
public PonderDestinationPreviewRenderer() {
|
public PonderDestinationPreviewRenderer() {
|
||||||
Minecraft minecraft = Minecraft.getInstance();
|
Minecraft minecraft = Minecraft.getInstance();
|
||||||
previewLevel = new PonderLevel(BlockPos.ZERO, minecraft.level);
|
previewLevel = new PonderLevel(BlockPos.ZERO, minecraft.level);
|
||||||
selection = SelectionImpl.of(new BoundingBox(0, 0, 0, 8, 127, 8));
|
snapshotSelection = SelectionImpl.of(new BoundingBox(0, 0, 0, 8, 63, 8));
|
||||||
section = new WorldSectionElementImpl(selection);
|
// The target sits at y=32 in the snapshot. Render only its familiar
|
||||||
|
// y=30..36 window, giving the page a fixed 9×7×9 close-up.
|
||||||
|
Selection viewSelection = SelectionImpl.of(new BoundingBox(0, 30, 0, 8, 36, 8));
|
||||||
|
section = new WorldSectionElementImpl(viewSelection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(LinkPreviewPayload payload) {
|
public void accept(LinkPreviewPayload payload) {
|
||||||
selection.forEach(pos -> previewLevel.setBlock(pos, Blocks.AIR.defaultBlockState(), 2));
|
snapshotSelection.forEach(pos -> previewLevel.setBlock(pos, Blocks.AIR.defaultBlockState(), 2));
|
||||||
payload.blocks().forEach(block -> previewLevel.setBlock(block.pos(), block.state(), 2));
|
payload.blocks().forEach(block -> previewLevel.setBlock(block.pos(), block.state(), 2));
|
||||||
((net.createmod.ponder.api.element.WorldSectionElement)section).queueRedraw();
|
((net.createmod.ponder.api.element.WorldSectionElement)section).queueRedraw();
|
||||||
backgroundColor = 0xFF000000 | payload.skyColor() & 0x00FFFFFF;
|
backgroundColor = 0xFF000000 | payload.skyColor() & 0x00FFFFFF;
|
||||||
@@ -105,10 +108,8 @@ public final class PonderDestinationPreviewRenderer implements DestinationPrevie
|
|||||||
poseStack.mulPose(Axis.XP.rotationDegrees(-28.0F));
|
poseStack.mulPose(Axis.XP.rotationDegrees(-28.0F));
|
||||||
poseStack.mulPose(Axis.YP.rotationDegrees((ticks + partialTick) * 0.6F));
|
poseStack.mulPose(Axis.YP.rotationDegrees((ticks + partialTick) * 0.6F));
|
||||||
UIRenderHelper.flipForGuiRender(poseStack);
|
UIRenderHelper.flipForGuiRender(poseStack);
|
||||||
// Fit the complete 128-block vertical slice, while keeping the 9×9
|
poseStack.scale(7.0F, 7.0F, 7.0F);
|
||||||
// footprint centered during the full horizontal orbit.
|
poseStack.translate(-4.5F, -31.5F, -4.5F);
|
||||||
poseStack.scale(0.58F, 0.58F, 0.58F);
|
|
||||||
poseStack.translate(-4.5F, -64.0F, -4.5F);
|
|
||||||
|
|
||||||
SuperRenderTypeBuffer buffer = DefaultSuperRenderTypeBuffer.getInstance();
|
SuperRenderTypeBuffer buffer = DefaultSuperRenderTypeBuffer.getInstance();
|
||||||
section.renderFirst(previewLevel, buffer, graphics, partialTick);
|
section.renderFirst(previewLevel, buffer, graphics, partialTick);
|
||||||
|
|||||||
@@ -65,7 +65,9 @@ public final class LinkingGameTests {
|
|||||||
BlockPos absoluteOrigin = helper.absolutePos(ORIGIN);
|
BlockPos absoluteOrigin = helper.absolutePos(ORIGIN);
|
||||||
for (BlockPos position : BlockPos.betweenClosed(
|
for (BlockPos position : BlockPos.betweenClosed(
|
||||||
absoluteOrigin.offset(-4, -2, -4), absoluteOrigin.offset(4, 2, 4))) {
|
absoluteOrigin.offset(-4, -2, -4), absoluteOrigin.offset(4, 2, 4))) {
|
||||||
helper.getLevel().setBlockAndUpdate(position, Blocks.STONE.defaultBlockState());
|
// This test only needs collision states. Avoid propagating 405
|
||||||
|
// neighbor updates through the GameTest world while preparing it.
|
||||||
|
helper.getLevel().setBlock(position, Blocks.STONE.defaultBlockState(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerPlayer player = helper.makeMockServerPlayerInLevel();
|
ServerPlayer player = helper.makeMockServerPlayerInLevel();
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import net.minecraft.world.level.block.Block;
|
|||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
|
||||||
public record LinkPreviewPayload(int skyColor, List<SnapshotBlock> blocks) implements CustomPacketPayload {
|
public record LinkPreviewPayload(int skyColor, List<SnapshotBlock> blocks) implements CustomPacketPayload {
|
||||||
/** A square footprint keeps every side visible during an orbit, with a tall vertical slice. */
|
/** A square footprint keeps every side visible during an orbit, with a vertical snapshot cache. */
|
||||||
private static final int MAX_BLOCKS = 9 * 128 * 9;
|
private static final int MAX_BLOCKS = 9 * 64 * 9;
|
||||||
public static final Type<LinkPreviewPayload> TYPE = new Type<>(
|
public static final Type<LinkPreviewPayload> TYPE = new Type<>(
|
||||||
ResourceLocation.fromNamespaceAndPath(Rivencraft.MOD_ID, "link_preview")
|
ResourceLocation.fromNamespaceAndPath(Rivencraft.MOD_ID, "link_preview")
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -114,12 +114,12 @@ public final class ModNetworking {
|
|||||||
|
|
||||||
BlockPos origin = target.location().pos();
|
BlockPos origin = target.location().pos();
|
||||||
List<LinkPreviewPayload.SnapshotBlock> blocks = new ArrayList<>();
|
List<LinkPreviewPayload.SnapshotBlock> blocks = new ArrayList<>();
|
||||||
// The square footprint survives every angle of the orbit. The vertical
|
// The square footprint survives every angle of the orbit. Retain a
|
||||||
// slice captures 64 blocks below through 63 blocks above the link point.
|
// 64-block vertical slice, while the renderer shows its 7-block window.
|
||||||
for (BlockPos pos : BlockPos.betweenClosed(origin.offset(-4, -64, -4), origin.offset(4, 63, 4))) {
|
for (BlockPos pos : BlockPos.betweenClosed(origin.offset(-4, -32, -4), origin.offset(4, 31, 4))) {
|
||||||
var state = level.getBlockState(pos);
|
var state = level.getBlockState(pos);
|
||||||
if (!state.isAir()) {
|
if (!state.isAir()) {
|
||||||
blocks.add(new LinkPreviewPayload.SnapshotBlock(pos.subtract(origin).offset(4, 64, 4), state));
|
blocks.add(new LinkPreviewPayload.SnapshotBlock(pos.subtract(origin).offset(4, 32, 4), state));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int skyColor = level.getBiome(origin).value().getSkyColor();
|
int skyColor = level.getBiome(origin).value().getSkyColor();
|
||||||
|
|||||||
Reference in new issue
Block a user