mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fix player rotation lock while riding boats for 1.16.210+ (#2114)
This commit is contained in:
parent
7a7cf18e99
commit
e5497922d9
1 changed files with 11 additions and 1 deletions
|
@ -31,6 +31,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||||
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
|
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
|
||||||
import com.nukkitx.protocol.bedrock.data.entity.EntityLinkData;
|
import com.nukkitx.protocol.bedrock.data.entity.EntityLinkData;
|
||||||
import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket;
|
import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket;
|
||||||
|
import com.nukkitx.protocol.bedrock.v428.Bedrock_v428;
|
||||||
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
||||||
import org.geysermc.connector.entity.Entity;
|
import org.geysermc.connector.entity.Entity;
|
||||||
import org.geysermc.connector.entity.living.ArmorStandEntity;
|
import org.geysermc.connector.entity.living.ArmorStandEntity;
|
||||||
|
@ -87,7 +88,13 @@ public class JavaEntitySetPassengersTranslator extends PacketTranslator<ServerEn
|
||||||
if (entity.getEntityType() == EntityType.BOAT) {
|
if (entity.getEntityType() == EntityType.BOAT) {
|
||||||
passenger.getMetadata().put(EntityData.RIDER_ROTATION_LOCKED, (byte) 1);
|
passenger.getMetadata().put(EntityData.RIDER_ROTATION_LOCKED, (byte) 1);
|
||||||
passenger.getMetadata().put(EntityData.RIDER_MAX_ROTATION, 90f);
|
passenger.getMetadata().put(EntityData.RIDER_MAX_ROTATION, 90f);
|
||||||
passenger.getMetadata().put(EntityData.RIDER_MIN_ROTATION, !passengers.isEmpty() ? -90f : 0f);
|
// Can be removed once 1.16.200 to 1.16.201 support is dropped
|
||||||
|
if (session.getUpstream().getSession().getPacketCodec().getProtocolVersion() >= Bedrock_v428.V428_CODEC.getProtocolVersion()) {
|
||||||
|
passenger.getMetadata().put(EntityData.RIDER_MIN_ROTATION, 1f);
|
||||||
|
passenger.getMetadata().put(EntityData.RIDER_ROTATION_OFFSET, -90f);
|
||||||
|
} else {
|
||||||
|
passenger.getMetadata().put(EntityData.RIDER_MIN_ROTATION, -90f);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
passenger.getMetadata().put(EntityData.RIDER_ROTATION_LOCKED, (byte) 0);
|
passenger.getMetadata().put(EntityData.RIDER_ROTATION_LOCKED, (byte) 0);
|
||||||
passenger.getMetadata().put(EntityData.RIDER_MAX_ROTATION, 0f);
|
passenger.getMetadata().put(EntityData.RIDER_MAX_ROTATION, 0f);
|
||||||
|
@ -116,6 +123,9 @@ public class JavaEntitySetPassengersTranslator extends PacketTranslator<ServerEn
|
||||||
passenger.getMetadata().put(EntityData.RIDER_ROTATION_LOCKED, (byte) 0);
|
passenger.getMetadata().put(EntityData.RIDER_ROTATION_LOCKED, (byte) 0);
|
||||||
passenger.getMetadata().put(EntityData.RIDER_MAX_ROTATION, 0f);
|
passenger.getMetadata().put(EntityData.RIDER_MAX_ROTATION, 0f);
|
||||||
passenger.getMetadata().put(EntityData.RIDER_MIN_ROTATION, 0f);
|
passenger.getMetadata().put(EntityData.RIDER_MIN_ROTATION, 0f);
|
||||||
|
if (session.getUpstream().getSession().getPacketCodec().getProtocolVersion() >= Bedrock_v428.V428_CODEC.getProtocolVersion()) {
|
||||||
|
passenger.getMetadata().put(EntityData.RIDER_ROTATION_OFFSET, 0f);
|
||||||
|
}
|
||||||
|
|
||||||
this.updateOffset(passenger, entity, session, false, false, (packet.getPassengerIds().length > 1));
|
this.updateOffset(passenger, entity, session, false, false, (packet.getPassengerIds().length > 1));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue