mirror of
https://github.com/GeyserExtensionists/GeyserUtils.git
synced 2025-12-19 14:59:18 +00:00
huh
This commit is contained in:
@@ -112,6 +112,7 @@ public class GeyserUtils implements Extension {
|
|||||||
replaceTranslator();
|
replaceTranslator();
|
||||||
logger().info("Defined " + LOADED_ENTITY_DEFINITIONS.size() + " entities");
|
logger().info("Defined " + LOADED_ENTITY_DEFINITIONS.size() + " entities");
|
||||||
particlesMappings.read(dataFolder().resolve("item_particles_mappings.json"));
|
particlesMappings.read(dataFolder().resolve("item_particles_mappings.json"));
|
||||||
|
MountFix.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
// the static here is crazy ;(
|
// the static here is crazy ;(
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package me.zimzaza4.geyserutils.geyser;
|
||||||
|
|
||||||
|
import org.cloudburstmc.protocol.bedrock.data.entity.EntityLinkData;
|
||||||
|
import org.cloudburstmc.protocol.bedrock.packet.SetEntityLinkPacket;
|
||||||
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
|
import org.geysermc.geyser.entity.EntityDefinition;
|
||||||
|
import org.geysermc.geyser.entity.EntityDefinitions;
|
||||||
|
import org.geysermc.geyser.entity.type.Entity;
|
||||||
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
|
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
public class MountFix {
|
||||||
|
|
||||||
|
public static void start() {
|
||||||
|
// just keep send SetEntityLinkPacket to fix the mount bug
|
||||||
|
// https://github.com/GeyserMC/Geyser/issues/3302
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 2000, 80, TimeUnit.MILLISECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user