forked from GeyserMC/Geyser
Fix mounts being unmountable with cache chunks (#1576)
Teleports need to be confirmed before riding
This commit is contained in:
parent
894275b8c4
commit
11d9d30050
3 changed files with 10 additions and 3 deletions
|
@ -31,13 +31,14 @@ import org.geysermc.connector.network.session.GeyserSession;
|
||||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||||
import org.geysermc.connector.network.translators.Translator;
|
import org.geysermc.connector.network.translators.Translator;
|
||||||
|
|
||||||
// Used for horses
|
/**
|
||||||
|
* Sent by the client when moving a horse.
|
||||||
|
*/
|
||||||
@Translator(packet = MoveEntityAbsolutePacket.class)
|
@Translator(packet = MoveEntityAbsolutePacket.class)
|
||||||
public class BedrockMoveEntityAbsoluteTranslator extends PacketTranslator<MoveEntityAbsolutePacket> {
|
public class BedrockMoveEntityAbsoluteTranslator extends PacketTranslator<MoveEntityAbsolutePacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(MoveEntityAbsolutePacket packet, GeyserSession session) {
|
public void translate(MoveEntityAbsolutePacket packet, GeyserSession session) {
|
||||||
|
|
||||||
ClientVehicleMovePacket clientVehicleMovePacket = new ClientVehicleMovePacket(
|
ClientVehicleMovePacket clientVehicleMovePacket = new ClientVehicleMovePacket(
|
||||||
packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ(),
|
packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ(),
|
||||||
packet.getRotation().getY() - 90, packet.getRotation().getX()
|
packet.getRotation().getY() - 90, packet.getRotation().getX()
|
||||||
|
|
|
@ -31,7 +31,9 @@ import org.geysermc.connector.network.session.GeyserSession;
|
||||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||||
import org.geysermc.connector.network.translators.Translator;
|
import org.geysermc.connector.network.translators.Translator;
|
||||||
|
|
||||||
// Makes minecarts respond to player input
|
/**
|
||||||
|
* Sent by the client for minecarts and boats.
|
||||||
|
*/
|
||||||
@Translator(packet = PlayerInputPacket.class)
|
@Translator(packet = PlayerInputPacket.class)
|
||||||
public class BedrockPlayerInputTranslator extends PacketTranslator<PlayerInputPacket> {
|
public class BedrockPlayerInputTranslator extends PacketTranslator<PlayerInputPacket> {
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,10 @@ public class JavaEntitySetPassengersTranslator extends PacketTranslator<ServerEn
|
||||||
if (passengerId == session.getPlayerEntity().getEntityId()) {
|
if (passengerId == session.getPlayerEntity().getEntityId()) {
|
||||||
passenger = session.getPlayerEntity();
|
passenger = session.getPlayerEntity();
|
||||||
session.setRidingVehicleEntity(entity);
|
session.setRidingVehicleEntity(entity);
|
||||||
|
// We need to confirm teleports before entering a vehicle, or else we will likely exit right out
|
||||||
|
if (session.getConnector().getConfig().isCacheChunks()) {
|
||||||
|
session.confirmTeleport(passenger.getPosition().sub(0, EntityType.PLAYER.getOffset(), 0).toDouble());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Passenger hasn't loaded in and entity link needs to be set later
|
// Passenger hasn't loaded in and entity link needs to be set later
|
||||||
if (passenger == null && passengerId != 0) {
|
if (passenger == null && passengerId != 0) {
|
||||||
|
|
Loading…
Reference in a new issue