Disable Mount Fix (Fixed by Geyser official?)

This commit is contained in:
zimzaza4
2025-12-17 16:38:09 +08:00
parent ff664c41e7
commit b35d17b97b
2 changed files with 18 additions and 13 deletions

View File

@@ -339,7 +339,7 @@ public class GeyserUtils implements Extension {
replaceTranslator(); replaceTranslator();
GEYSER_LOADED = true; GEYSER_LOADED = true;
logger().info("Defined " + LOADED_ENTITY_DEFINITIONS.size() + " entities"); logger().info("Defined " + LOADED_ENTITY_DEFINITIONS.size() + " entities");
MountFix.start(); // MountFix.start();
} }

View File

@@ -18,21 +18,26 @@ public class MountFix {
// if the vehicle is too fast, the problem appear // if the vehicle is too fast, the problem appear
Executors.newSingleThreadScheduledExecutor() Executors.newSingleThreadScheduledExecutor()
.scheduleAtFixedRate(() -> { .scheduleAtFixedRate(() -> {
try {
for (GeyserSession session : GeyserImpl.getInstance().onlineConnections()) { for (GeyserSession session : GeyserImpl.getInstance().onlineConnections()) {
Entity v = session.getPlayerEntity().getVehicle(); Entity v = session.getPlayerEntity().getVehicle();
if (v != null && v.getDefinition() == EntityDefinitions.ARMOR_STAND) { if (v != null && v.getDefinition() == EntityDefinitions.ARMOR_STAND) {
session.setShouldSendSneak(true);
long vehicleBedrockId = v.getGeyserId(); long vehicleBedrockId = v.getGeyserId();
if (session.getPlayerEntity().getVehicle().getGeyserId() == vehicleBedrockId) { if (session.getPlayerEntity().getVehicle().getGeyserId() == vehicleBedrockId) {
// The Bedrock client, as of 1.19.51, dismounts on its end. The server may not agree with this. // The Bedrock client, as of 1.19.51, dismounts on its end. The server may not agree with this.
// If the server doesn't agree with our dismount (sends a packet saying we dismounted), // If the server doesn't agree with our dismount (sends a packet saying we dismounted),
// then remount the player. // then remount the player.
SetEntityLinkPacket linkPacket = new SetEntityLinkPacket(); SetEntityLinkPacket linkPacket = new SetEntityLinkPacket();
linkPacket.setEntityLink(new EntityLinkData(vehicleBedrockId, session.getPlayerEntity().getGeyserId(), EntityLinkData.Type.RIDER, true, false)); linkPacket.setEntityLink(new EntityLinkData(vehicleBedrockId, session.getPlayerEntity().getGeyserId(), EntityLinkData.Type.PASSENGER, true, false, 0f));
session.sendUpstreamPacket(linkPacket); session.sendUpstreamPacket(linkPacket);
} }
} }
} }
}, 2000, 80, TimeUnit.MILLISECONDS); } catch (Throwable t) {
t.printStackTrace();
}
}, 200, 50, TimeUnit.MILLISECONDS);
} }