Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emulate client side vehicle movement #4648

Merged
merged 43 commits into from
Aug 15, 2024
Merged
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
ff0fe96
WIP client side vehicles
AJ-Ferguson Jun 15, 2023
8ffcde9
Merge remote-tracking branch 'refs/remotes/upstream/master' into clie…
AJ-Ferguson May 8, 2024
72309fb
Address reviews and remove use of Optional
AJ-Ferguson May 16, 2024
4417331
Only tick active vehicle
AJ-Ferguson May 16, 2024
967d0a9
Merge remote-tracking branch 'upstream/master' into client-vehicle
AJ-Ferguson May 16, 2024
b250874
Track world ticks
AJ-Ferguson May 17, 2024
8d72970
Fixes for Camel dash and pose transition
AJ-Ferguson May 17, 2024
021e3bf
Remove vehicle parameter
AJ-Ferguson May 17, 2024
91574ef
Merge remote-tracking branch 'upstream/dev' into client-vehicle
AJ-Ferguson May 17, 2024
b79a12e
Start using blocks refactor
AJ-Ferguson May 17, 2024
a21ca99
Update BlockRegistryPopulator
AJ-Ferguson May 17, 2024
66bdb3b
Merge remote-tracking branch 'upstream/dev' into client-vehicle
AJ-Ferguson May 18, 2024
fa7b9fe
Update blocks
AJ-Ferguson May 18, 2024
f490af0
Support step height attribute
AJ-Ferguson May 18, 2024
8147848
Merge remote-tracking branch 'upstream/dev' into client-vehicle
AJ-Ferguson May 20, 2024
30a37fa
Use climbable block tag and TrapDoorBlock
AJ-Ferguson May 20, 2024
16d766d
Lock camel rotation if stationary
AJ-Ferguson May 20, 2024
de5b1a2
Fix boost ticking
AJ-Ferguson May 20, 2024
62822e0
Keep cache of surrounding blocks
AJ-Ferguson May 22, 2024
376b7ea
Fix bug causing BoundingBox position to change in CollisionManager
AJ-Ferguson May 22, 2024
32d587a
Merge remote-tracking branch 'upstream/dev' into client-vehicle
AJ-Ferguson May 23, 2024
818bef0
Clamp user input
AJ-Ferguson May 23, 2024
b33a023
Support weaving status effect
AJ-Ferguson May 23, 2024
d3b4ad4
Merge remote-tracking branch 'upstream/dev' into client-vehicle
AJ-Ferguson May 24, 2024
1f84b62
Support gravity attribute
AJ-Ferguson May 25, 2024
c348928
Merge remote-tracking branch 'upstream/master' into client-vehicle
AJ-Ferguson Jun 11, 2024
e1aebca
Merge remote-tracking branch 'upstream/master' into client-vehicle
AJ-Ferguson Jun 14, 2024
1a6c70f
Piston support
AJ-Ferguson Jun 15, 2024
cdbb276
Tick boost for Pig and Strider if any player is controlling
AJ-Ferguson Jun 15, 2024
77c6d5d
Merge remote-tracking branch 'upstream/master' into client-vehicle
AJ-Ferguson Jun 17, 2024
97c42d3
Submodule
AJ-Ferguson Jun 17, 2024
d49a3ec
Address some reviews
AJ-Ferguson Jun 21, 2024
9a92206
Merge remote-tracking branch 'upstream/master' into client-vehicle
AJ-Ferguson Jun 21, 2024
727604f
Merge remote-tracking branch 'upstream/master' into client-vehicle
AJ-Ferguson Jun 22, 2024
c86b41d
Support world border
AJ-Ferguson Jul 2, 2024
264b925
Merge remote-tracking branch 'upstream/master' into client-vehicle
AJ-Ferguson Jul 2, 2024
3a18ca9
Optimize world border check
AJ-Ferguson Jul 3, 2024
4c95d52
Small optimizations
AJ-Ferguson Jul 9, 2024
dae371f
Merge remote-tracking branch 'upstream/master' into client-vehicle
AJ-Ferguson Jul 9, 2024
6441514
Add comments
AJ-Ferguson Jul 17, 2024
efe8bd6
Merge remote-tracking branch 'upstream/master' into client-vehicle
AJ-Ferguson Jul 17, 2024
02b7477
Merge remote-tracking branch 'upstream/master' into client-vehicle
AJ-Ferguson Aug 3, 2024
fd314de
Merge remote-tracking branch 'upstream/master' into client-vehicle
AJ-Ferguson Aug 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'upstream/master' into client-vehicle
  • Loading branch information
AJ-Ferguson committed Jun 22, 2024
commit 727604f82cae0284e09c86714f9a4e4dc831e3cc
Original file line number Diff line number Diff line change
Expand Up @@ -329,4 +329,48 @@ public void setVehicleInput(Vector2f vehicleInput) {
public void setVehicleJumpStrength(int vehicleJumpStrength) {
this.vehicleJumpStrength = MathUtils.constrain(vehicleJumpStrength, 0, 100);
}

private boolean isBelowVoidFloor() {
return position.getY() < voidFloorPosition();
}

public int voidFloorPosition() {
// The void floor is offset about 40 blocks below the bottom of the world
BedrockDimension bedrockDimension = session.getChunkCache().getBedrockDimension();
return bedrockDimension.minY() - 40;
}

/**
* This method handles teleporting the player below or above the Bedrock void floor.
* The Java server should never see this desync as we adjust the position that we send to it
*
* @param up in which direction to teleport - true to resync our position, or false to be
* teleported below the void floor.
*/
public void teleportVoidFloorFix(boolean up) {
// Safety to avoid double teleports
if ((voidPositionDesynched && !up) || (!voidPositionDesynched && up)) {
return;
}

// Work around there being a floor at the bottom of the world and teleport the player below it
// Moving from below to above the void floor works fine
Vector3f newPosition = this.getPosition();
if (up) {
newPosition = newPosition.up(4f);
voidPositionDesynched = false;
} else {
newPosition = newPosition.down(4f);
voidPositionDesynched = true;
}

this.setPositionManual(newPosition);
MovePlayerPacket movePlayerPacket = new MovePlayerPacket();
movePlayerPacket.setRuntimeEntityId(geyserId);
movePlayerPacket.setPosition(newPosition);
movePlayerPacket.setRotation(getBedrockRotation());
movePlayerPacket.setMode(MovePlayerPacket.Mode.TELEPORT);
movePlayerPacket.setTeleportationCause(MovePlayerPacket.TeleportationCause.BEHAVIOR);
session.sendUpstreamPacketImmediately(movePlayerPacket);
}
}
You are viewing a condensed version of this merge commit. You can view the full changes here.