Public Access
This commit is contained in:
1 parent
00ed05e51a
commit
d878c89ba4
3 files changed
+69
-25
No files matched your search
@@ -306,6 +306,12 @@ screens while Explore mode is active. Movement, jump, and sneak now move the
|
||||
remote camera even though Minecraft suspends normal gameplay key states while
|
||||
a GUI is open.
|
||||
|
||||
Version 0.2.16.8 links Explore mode to real player movement in the current
|
||||
dimension. Entering Explore anchors the source player and destination camera;
|
||||
walking, jumping, falling, or being moved shifts the snapshot camera by the
|
||||
same displacement while the book remains open and normal collision still
|
||||
applies.
|
||||
|
||||
The preview code is separated behind a renderer interface and uses an isolated
|
||||
Ponder level populated from server-authoritative destination snapshots.
|
||||
|
||||
|
||||
+1
-1
@@ -35,7 +35,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. Rivencraft uses the x.y.z.b policy documented in README.md.
|
||||
mod_version=0.2.16.7
|
||||
mod_version=0.2.16.8
|
||||
immersive_portals_version=6.0.7
|
||||
# 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.
|
||||
|
||||
+62
-24
@@ -24,6 +24,8 @@ public final class ImmersivePortalsDestinationPreviewRenderer implements Destina
|
||||
private final Minecraft minecraft = Minecraft.getInstance();
|
||||
private LinkPreviewPayload destination;
|
||||
private Vec3 cameraPosition;
|
||||
private Vec3 explorationPlayerOrigin;
|
||||
private Vec3 explorationCameraOrigin;
|
||||
private float yaw;
|
||||
private float pitch;
|
||||
private int ticks;
|
||||
@@ -48,17 +50,8 @@ public final class ImmersivePortalsDestinationPreviewRenderer implements Destina
|
||||
if (!exploring || cameraPosition == null) {
|
||||
return;
|
||||
}
|
||||
double forward = (movingForward ? 1.0D : 0.0D) - (movingBackward ? 1.0D : 0.0D);
|
||||
double strafe = (movingRight ? 1.0D : 0.0D) - (movingLeft ? 1.0D : 0.0D);
|
||||
double vertical = (movingUp ? 1.0D : 0.0D) - (movingDown ? 1.0D : 0.0D);
|
||||
double radians = Math.toRadians(yaw);
|
||||
Vec3 motion = new Vec3(
|
||||
-Math.sin(radians) * forward + Math.cos(radians) * strafe,
|
||||
vertical,
|
||||
Math.cos(radians) * forward + Math.sin(radians) * strafe
|
||||
);
|
||||
if (motion.lengthSqr() > 0.0D) {
|
||||
cameraPosition = cameraPosition.add(motion.normalize().scale(0.22D));
|
||||
if (minecraft.player != null && explorationPlayerOrigin != null && explorationCameraOrigin != null) {
|
||||
cameraPosition = explorationCameraOrigin.add(minecraft.player.position().subtract(explorationPlayerOrigin));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +121,18 @@ public final class ImmersivePortalsDestinationPreviewRenderer implements Destina
|
||||
|
||||
@Override public boolean supportsExploration() { return true; }
|
||||
@Override public boolean isExploring() { return exploring; }
|
||||
@Override public void setExploring(boolean exploring) { this.exploring = exploring; }
|
||||
@Override
|
||||
public void setExploring(boolean exploring) {
|
||||
this.exploring = exploring;
|
||||
if (exploring && minecraft.player != null) {
|
||||
explorationPlayerOrigin = minecraft.player.position();
|
||||
explorationCameraOrigin = cameraPosition;
|
||||
} else {
|
||||
clearMovement();
|
||||
explorationPlayerOrigin = null;
|
||||
explorationCameraOrigin = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotate(double deltaX, double deltaY) {
|
||||
@@ -143,12 +147,25 @@ public final class ImmersivePortalsDestinationPreviewRenderer implements Destina
|
||||
if (!exploring) {
|
||||
return false;
|
||||
}
|
||||
if (minecraft.options.keyUp.matches(keyCode, scanCode)) movingForward = true;
|
||||
else if (minecraft.options.keyDown.matches(keyCode, scanCode)) movingBackward = true;
|
||||
else if (minecraft.options.keyLeft.matches(keyCode, scanCode)) movingLeft = true;
|
||||
else if (minecraft.options.keyRight.matches(keyCode, scanCode)) movingRight = true;
|
||||
else if (minecraft.options.keyJump.matches(keyCode, scanCode)) movingUp = true;
|
||||
else if (minecraft.options.keyShift.matches(keyCode, scanCode)) movingDown = true;
|
||||
if (minecraft.options.keyUp.matches(keyCode, scanCode)) {
|
||||
movingForward = true;
|
||||
minecraft.options.keyUp.setDown(true);
|
||||
} else if (minecraft.options.keyDown.matches(keyCode, scanCode)) {
|
||||
movingBackward = true;
|
||||
minecraft.options.keyDown.setDown(true);
|
||||
} else if (minecraft.options.keyLeft.matches(keyCode, scanCode)) {
|
||||
movingLeft = true;
|
||||
minecraft.options.keyLeft.setDown(true);
|
||||
} else if (minecraft.options.keyRight.matches(keyCode, scanCode)) {
|
||||
movingRight = true;
|
||||
minecraft.options.keyRight.setDown(true);
|
||||
} else if (minecraft.options.keyJump.matches(keyCode, scanCode)) {
|
||||
movingUp = true;
|
||||
minecraft.options.keyJump.setDown(true);
|
||||
} else if (minecraft.options.keyShift.matches(keyCode, scanCode)) {
|
||||
movingDown = true;
|
||||
minecraft.options.keyShift.setDown(true);
|
||||
}
|
||||
else return false;
|
||||
return true;
|
||||
}
|
||||
@@ -156,12 +173,25 @@ public final class ImmersivePortalsDestinationPreviewRenderer implements Destina
|
||||
@Override
|
||||
public boolean keyReleased(int keyCode, int scanCode) {
|
||||
boolean handled = true;
|
||||
if (minecraft.options.keyUp.matches(keyCode, scanCode)) movingForward = false;
|
||||
else if (minecraft.options.keyDown.matches(keyCode, scanCode)) movingBackward = false;
|
||||
else if (minecraft.options.keyLeft.matches(keyCode, scanCode)) movingLeft = false;
|
||||
else if (minecraft.options.keyRight.matches(keyCode, scanCode)) movingRight = false;
|
||||
else if (minecraft.options.keyJump.matches(keyCode, scanCode)) movingUp = false;
|
||||
else if (minecraft.options.keyShift.matches(keyCode, scanCode)) movingDown = false;
|
||||
if (minecraft.options.keyUp.matches(keyCode, scanCode)) {
|
||||
movingForward = false;
|
||||
minecraft.options.keyUp.setDown(false);
|
||||
} else if (minecraft.options.keyDown.matches(keyCode, scanCode)) {
|
||||
movingBackward = false;
|
||||
minecraft.options.keyDown.setDown(false);
|
||||
} else if (minecraft.options.keyLeft.matches(keyCode, scanCode)) {
|
||||
movingLeft = false;
|
||||
minecraft.options.keyLeft.setDown(false);
|
||||
} else if (minecraft.options.keyRight.matches(keyCode, scanCode)) {
|
||||
movingRight = false;
|
||||
minecraft.options.keyRight.setDown(false);
|
||||
} else if (minecraft.options.keyJump.matches(keyCode, scanCode)) {
|
||||
movingUp = false;
|
||||
minecraft.options.keyJump.setDown(false);
|
||||
} else if (minecraft.options.keyShift.matches(keyCode, scanCode)) {
|
||||
movingDown = false;
|
||||
minecraft.options.keyShift.setDown(false);
|
||||
}
|
||||
else handled = false;
|
||||
return handled;
|
||||
}
|
||||
@@ -173,12 +203,20 @@ public final class ImmersivePortalsDestinationPreviewRenderer implements Destina
|
||||
movingRight = false;
|
||||
movingUp = false;
|
||||
movingDown = false;
|
||||
minecraft.options.keyUp.setDown(false);
|
||||
minecraft.options.keyDown.setDown(false);
|
||||
minecraft.options.keyLeft.setDown(false);
|
||||
minecraft.options.keyRight.setDown(false);
|
||||
minecraft.options.keyJump.setDown(false);
|
||||
minecraft.options.keyShift.setDown(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetView() {
|
||||
exploring = false;
|
||||
clearMovement();
|
||||
explorationPlayerOrigin = null;
|
||||
explorationCameraOrigin = null;
|
||||
if (destination != null) {
|
||||
cameraPosition = Vec3.atCenterOf(destination.origin()).add(0.0D, 2.0D, ORBIT_RADIUS);
|
||||
yaw = destination.yaw();
|
||||
|
||||
Reference in new issue
Block a user