mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-12 11:21:31 +01:00
Fix retain passengers teleport flag (#11858)
This commit is contained in:
parent
edde7264c6
commit
4106da712c
@ -196,6 +196,7 @@ public net.minecraft.world.entity.Entity random
|
||||
public net.minecraft.world.entity.Entity setLevel(Lnet/minecraft/world/level/Level;)V
|
||||
public net.minecraft.world.entity.Entity setRot(FF)V
|
||||
public net.minecraft.world.entity.Entity setSharedFlag(IZ)V
|
||||
public net.minecraft.world.entity.Entity teleportPassengers()V
|
||||
public net.minecraft.world.entity.Entity unsetRemoved()V
|
||||
public net.minecraft.world.entity.Entity wasTouchingWater
|
||||
public net.minecraft.world.entity.ExperienceOrb count
|
||||
|
@ -245,7 +245,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
// Paper start - Teleport passenger API
|
||||
Set<io.papermc.paper.entity.TeleportFlag> flagSet = Set.of(flags);
|
||||
boolean dismount = !flagSet.contains(io.papermc.paper.entity.TeleportFlag.EntityState.RETAIN_VEHICLE);
|
||||
boolean ignorePassengers = flagSet.contains(io.papermc.paper.entity.TeleportFlag.EntityState.RETAIN_PASSENGERS);
|
||||
boolean retainPassengers = flagSet.contains(io.papermc.paper.entity.TeleportFlag.EntityState.RETAIN_PASSENGERS);
|
||||
// Don't allow teleporting between worlds while keeping passengers
|
||||
if (flagSet.contains(io.papermc.paper.entity.TeleportFlag.EntityState.RETAIN_PASSENGERS) && this.entity.isVehicle() && location.getWorld() != this.getWorld()) {
|
||||
return false;
|
||||
@ -257,7 +257,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
if ((!ignorePassengers && this.entity.isVehicle()) || this.entity.isRemoved()) { // Paper - Teleport passenger API
|
||||
if ((!retainPassengers && this.entity.isVehicle()) || this.entity.isRemoved()) { // Paper - Teleport passenger API
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -288,6 +288,9 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
// SPIGOT-619: Force sync head rotation also
|
||||
this.entity.setYHeadRot(location.getYaw());
|
||||
|
||||
// Ensure passengers of entity are teleported
|
||||
if (retainPassengers && this.entity.isVehicle()) this.entity.teleportPassengers();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user