9
0
mirror of https://github.com/GeyserExtensionists/GeyserUtils.git synced 2025-12-19 15:09:24 +00:00

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(() -> {
for (GeyserSession session : GeyserImpl.getInstance().onlineConnections()) { try {
Entity v = session.getPlayerEntity().getVehicle(); for (GeyserSession session : GeyserImpl.getInstance().onlineConnections()) {
if (v != null && v.getDefinition() == EntityDefinitions.ARMOR_STAND) { Entity v = session.getPlayerEntity().getVehicle();
long vehicleBedrockId = v.getGeyserId(); if (v != null && v.getDefinition() == EntityDefinitions.ARMOR_STAND) {
if (session.getPlayerEntity().getVehicle().getGeyserId() == vehicleBedrockId) { session.setShouldSendSneak(true);
// The Bedrock client, as of 1.19.51, dismounts on its end. The server may not agree with this. long vehicleBedrockId = v.getGeyserId();
// If the server doesn't agree with our dismount (sends a packet saying we dismounted), if (session.getPlayerEntity().getVehicle().getGeyserId() == vehicleBedrockId) {
// then remount the player. // The Bedrock client, as of 1.19.51, dismounts on its end. The server may not agree with this.
SetEntityLinkPacket linkPacket = new SetEntityLinkPacket(); // If the server doesn't agree with our dismount (sends a packet saying we dismounted),
linkPacket.setEntityLink(new EntityLinkData(vehicleBedrockId, session.getPlayerEntity().getGeyserId(), EntityLinkData.Type.RIDER, true, false)); // then remount the player.
session.sendUpstreamPacket(linkPacket); 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);
} }