Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ public final class EntityDefinitions {

EntityDefinition<AvatarEntity> avatarEntityBase = EntityDefinition.<AvatarEntity>inherited(null, livingEntityBase)
.height(1.8f).width(0.6f)
.offset(1.62f)
.offset(1.62001f)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's mark why we're doing this? E.G. "Player offset sent by Bedrock. Verified on Bedrock 26.23".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

.addTranslator(null) // Player main hand
.addTranslator(MetadataTypes.BYTE, AvatarEntity::setSkinVisibility)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ public BoundingBox getActiveBoundingBox() {
return playerBoundingBox;
}

private static final double PLAYER_OFFSET = Double.parseDouble(Float.toString(EntityDefinitions.PLAYER.offset()));
Comment thread
onebeastchris marked this conversation as resolved.
Outdated

/**
* Adjust the Bedrock position before sending to the Java server to account for inaccuracies in movement between
* the two versions. Will also send corrected movement packets back to Bedrock if they collide with pistons.
Expand All @@ -174,9 +176,11 @@ public BoundingBox getActiveBoundingBox() {
if (pistonCache.isPlayerAttachedToHoney()) {
return null;
}

// We need to parse the float as a string since casting a float to a double causes us to
// lose precision and thus, causes players to get stuck when walking near walls
double javaY = Double.parseDouble(Float.toString(bedrockPosition.getY())) - EntityDefinitions.PLAYER.offset();
double rawY = Double.parseDouble(Float.toString(bedrockPosition.getY()));
double javaY = rawY - PLAYER_OFFSET;
Comment thread
onebeastchris marked this conversation as resolved.
Outdated

Vector3d position = Vector3d.from(Double.parseDouble(Float.toString(bedrockPosition.getX())), javaY, Double.parseDouble(Float.toString(bedrockPosition.getZ())));

Expand Down
Loading