Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix player rotation lock while riding boats for 1.16.210+ #2114

Merged
merged 2 commits into from
Apr 9, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import com.nukkitx.protocol.bedrock.data.entity.EntityLinkData;
import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket;
import com.nukkitx.protocol.bedrock.v428.Bedrock_v428;
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.entity.living.ArmorStandEntity;
Expand Down Expand Up @@ -87,7 +88,13 @@ public void translate(ServerEntitySetPassengersPacket packet, GeyserSession sess
if (entity.getEntityType() == EntityType.BOAT) {
passenger.getMetadata().put(EntityData.RIDER_ROTATION_LOCKED, (byte) 1);
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);
Camotoy marked this conversation as resolved.
Show resolved Hide resolved
}
} else {
passenger.getMetadata().put(EntityData.RIDER_ROTATION_LOCKED, (byte) 0);
passenger.getMetadata().put(EntityData.RIDER_MAX_ROTATION, 0f);
Expand Down