Simple Planes (Forge)

Simple Planes (Forge)

7M Downloads

client-server desync on dismounting plane

przemykomo opened this issue · 2 comments

commented

If player dismounts the plane while it's flying, the plane on client side teleports back to where it was on ground, but server mantains correct position of plane like seen on this video: https://www.youtube.com/watch?v=5Aa07bt0yqI

@adoxentor could you help? I'm out of ideas what could be the cause of this bug.

commented

Okay so I made plane not teleport to it's previous location using this:

    @SubscribeEvent
    public static void dismountPlane(EntityMountEvent event) {
        if (event.isDismounting() && event.getEntityBeingMounted() instanceof FurnacePlaneEntity
                && event.getEntityMounting() instanceof ServerPlayerEntity) {
            MinecraftServer minecraftServer = event.getWorldObj().getServer();
            if (minecraftServer != null) {
                new CMoveVehiclePacket(event.getEntityBeingMounted()).processPacket(
                        new ServerPlayNetHandler(minecraftServer, new NetworkManager(PacketDirection.SERVERBOUND),
                                (ServerPlayerEntity) event.getEntityMounting()));
            }
        }
    }

But after unmounting the plane, entire server-client desynchronisation happens. My only idea now is to get ServerPlayNetHandler instance from somewhere instead of creating new.

commented

I actually recorded a video myself to ask for help... 🤷‍♂️