From 85200fe48f15ac694468f8706d60891c88266880 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Sun, 15 Jan 2023 15:07:45 +0100 Subject: [PATCH] Stop flying your vehicle --- .../components/structureMovement/ContraptionCollider.java | 4 ++-- .../components/structureMovement/sync/ClientMotionPacket.java | 1 + src/main/resources/META-INF/accesstransformer.cfg | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionCollider.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionCollider.java index e7c93ef12..970d6ea30 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionCollider.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionCollider.java @@ -340,8 +340,8 @@ public class ContraptionCollider { contraptionEntity.registerColliding(entity); entity.fallDistance = 0; for (Entity rider : entity.getIndirectPassengers()) - if (rider instanceof ServerPlayer playerRider) - playerRider.connection.aboveGroundTickCount = 0; + if (getPlayerType(rider) == PlayerType.CLIENT) + AllPackets.channel.sendToServer(new ClientMotionPacket(rider.getDeltaMovement(), true, 0)); boolean canWalk = bounce != 0 || slide == 0; if (canWalk || !rotation.hasVerticalRotation()) { if (canWalk) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ClientMotionPacket.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ClientMotionPacket.java index d8db6597d..7f95c9894 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ClientMotionPacket.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ClientMotionPacket.java @@ -53,6 +53,7 @@ public class ClientMotionPacket extends SimplePacketBase { sender.causeFallDamage(sender.fallDistance, 1, DamageSource.FALL); sender.fallDistance = 0; sender.connection.aboveGroundTickCount = 0; + sender.connection.aboveGroundVehicleTickCount = 0; } AllPackets.channel.send(PacketDistributor.TRACKING_ENTITY.with(() -> sender), new LimbSwingUpdatePacket(sender.getId(), sender.position(), limbSwing)); diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index b543a5b53..80e9c4ffb 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -11,6 +11,7 @@ public-f net.minecraft.network.protocol.game.ClientboundPlayerAbilitiesPacket f_ public net.minecraft.server.MinecraftServer f_129744_ # storageSource public net.minecraft.server.network.ServerGamePacketListenerImpl f_9737_ # aboveGroundTickCount +public net.minecraft.server.network.ServerGamePacketListenerImpl f_9739_ # aboveGroundVehicleTickCount public net.minecraft.world.entity.Entity f_146795_ # removalReason protected net.minecraft.world.entity.Entity m_19956_(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/entity/Entity$MoveFunction;)V # positionRider