Skip to content

Commit 9824b49

Browse files
committed
Merge remote-tracking branch 'refs/remotes/upstream/master' into feature/custom-entities-api
# Conflicts: # core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java
2 parents ff99e17 + f66aec3 commit 9824b49

6 files changed

Lines changed: 10 additions & 8 deletions

File tree

core/src/main/java/org/geysermc/geyser/entity/VanillaEntities.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,8 @@ public final class VanillaEntities {
683683

684684
EntityTypeBase<AvatarEntity> avatarEntityBase = EntityTypeBase.baseInherited(AvatarEntity.class, livingEntityBase)
685685
.height(1.8f).width(0.6f)
686-
.offset(1.62f)
686+
// This is the offset sent by Bedrock in its player position. Verified on Bedrock 26.23.
687+
.offset(1.62001f)
687688
.addTranslator(null) // Player main hand
688689
.addTranslator(MetadataTypes.BYTE, AvatarEntity::setSkinVisibility)
689690
.build();

core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public class CollisionManager {
6161
public static final BlockCollision FLUID_COLLISION = new OtherCollision(new BoundingBox[]{new BoundingBox(0.5, 0.25, 0.5, 1, 0.5, 1)});
6262
// If you read this, feel free to suggest a more proper way to detect the Bedrock player's own onGround status instead of using a margin
6363
private static final double POSITION_ADJUSTMENT_MARGIN = 0.05;
64+
private static final double PLAYER_OFFSET = Double.parseDouble(Float.toString(EntityDefinitions.PLAYER.offset()));
6465

6566
private final GeyserSession session;
6667

@@ -176,7 +177,7 @@ public BoundingBox getActiveBoundingBox() {
176177
}
177178
// We need to parse the float as a string since casting a float to a double causes us to
178179
// lose precision and thus, causes players to get stuck when walking near walls
179-
double javaY = Double.parseDouble(Float.toString(bedrockPosition.getY())) - VanillaEntities.PLAYER_ENTITY_OFFSET;
180+
double javaY = Double.parseDouble(Float.toString(bedrockPosition.getY())) - PLAYER_OFFSET;
180181

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

core/src/main/java/org/geysermc/geyser/network/netty/GeyserServer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ private void modifyHandlers(ChannelFuture future) {
153153
}
154154

155155
Channel channel = f.channel();
156-
// Add our ping handler
156+
// Add our handlers
157157
channel.pipeline()
158-
.addFirst(RakConnectionRequestHandler.NAME, new RakConnectionRequestHandler(this))
158+
.addBefore(RakServerOfflineHandler.NAME, RakConnectionRequestHandler.NAME, new RakConnectionRequestHandler(this))
159159
.addAfter(RakServerOfflineHandler.NAME, RakPingHandler.NAME, new RakPingHandler(this));
160160
});
161161
}

core/src/main/java/org/geysermc/geyser/scoreboard/Objective.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void removeScore(String id) {
8383
}
8484

8585
public void updateProperties(Component displayNameComponent, ScoreType type, NumberFormat format) {
86-
String displayName = MessageTranslator.convertMessageRaw(displayNameComponent, scoreboard.session().locale());
86+
String displayName = MessageTranslator.convertMessageRaw(displayNameComponent, scoreboard.session().locale()).replace("%", "%%");
8787
boolean changed = !Objects.equals(this.displayName, displayName) || this.type != type;
8888

8989
this.displayName = displayName;

core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void updateBossBar() {
5959
BossEventPacket bossEventPacket = new BossEventPacket();
6060
bossEventPacket.setBossUniqueEntityId(entityId);
6161
bossEventPacket.setAction(BossEventPacket.Action.CREATE);
62-
bossEventPacket.setTitle(MessageTranslator.convertMessage(title, session.locale()));
62+
bossEventPacket.setTitle(MessageTranslator.convertMessage(title, session.locale()).replace("%", "%%%%"));
6363
bossEventPacket.setHealthPercentage(health);
6464
bossEventPacket.setColor(color);
6565
bossEventPacket.setOverlay(overlay);
@@ -73,7 +73,7 @@ public void updateTitle(Component title) {
7373
BossEventPacket bossEventPacket = new BossEventPacket();
7474
bossEventPacket.setBossUniqueEntityId(entityId);
7575
bossEventPacket.setAction(BossEventPacket.Action.UPDATE_NAME);
76-
bossEventPacket.setTitle(MessageTranslator.convertMessage(title, session.locale()));
76+
bossEventPacket.setTitle(MessageTranslator.convertMessage(title, session.locale()).replace("%", "%%%%"));
7777

7878
session.sendUpstreamPacket(bossEventPacket);
7979
}

core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerCombatKillTranslator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void translate(GeyserSession session, ClientboundPlayerCombatKillPacket p
4242
Component deathMessage = packet.getMessage();
4343
// TODO - could inject score in, but as of 1.19.10 newlines don't center and start at the left of the first text
4444
DeathInfoPacket deathInfoPacket = new DeathInfoPacket();
45-
deathInfoPacket.setCauseAttackName(MessageTranslator.convertMessage(deathMessage, session.locale()));
45+
deathInfoPacket.setCauseAttackName(MessageTranslator.convertMessage(deathMessage, session.locale()).replace("%", "%%"));
4646
session.sendUpstreamPacket(deathInfoPacket);
4747
}
4848
}

0 commit comments

Comments
 (0)