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();
GEYSER_LOADED = true;
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
Executors.newSingleThreadScheduledExecutor()
.scheduleAtFixedRate(() -> {
for (GeyserSession session : GeyserImpl.getInstance().onlineConnections()) {
Entity v = session.getPlayerEntity().getVehicle();
if (v != null && v.getDefinition() == EntityDefinitions.ARMOR_STAND) {
long vehicleBedrockId = v.getGeyserId();
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.
// If the server doesn't agree with our dismount (sends a packet saying we dismounted),
// then remount the player.
SetEntityLinkPacket linkPacket = new SetEntityLinkPacket();
linkPacket.setEntityLink(new EntityLinkData(vehicleBedrockId, session.getPlayerEntity().getGeyserId(), EntityLinkData.Type.RIDER, true, false));
session.sendUpstreamPacket(linkPacket);
try {
for (GeyserSession session : GeyserImpl.getInstance().onlineConnections()) {
Entity v = session.getPlayerEntity().getVehicle();
if (v != null && v.getDefinition() == EntityDefinitions.ARMOR_STAND) {
session.setShouldSendSneak(true);
long vehicleBedrockId = v.getGeyserId();
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.
// If the server doesn't agree with our dismount (sends a packet saying we dismounted),
// then remount the player.
SetEntityLinkPacket linkPacket = new SetEntityLinkPacket();
linkPacket.setEntityLink(new EntityLinkData(vehicleBedrockId, session.getPlayerEntity().getGeyserId(), EntityLinkData.Type.PASSENGER, true, false, 0f));
session.sendUpstreamPacket(linkPacket);
}
}
}
} catch (Throwable t) {
t.printStackTrace();
}
}, 2000, 80, TimeUnit.MILLISECONDS);
}, 200, 50, TimeUnit.MILLISECONDS);
}