Fix position yaw/pitch not being copied

This commit is contained in:
themode 2021-03-02 19:36:11 +01:00
parent a927938677
commit 25c2dc661f
3 changed files with 6 additions and 5 deletions

View File

@ -13,13 +13,10 @@ import net.minestom.server.event.Event;
import net.minestom.server.event.EventCallback; import net.minestom.server.event.EventCallback;
import net.minestom.server.event.entity.*; import net.minestom.server.event.entity.*;
import net.minestom.server.event.handler.EventHandler; import net.minestom.server.event.handler.EventHandler;
import net.minestom.server.event.item.ArmorEquipEvent;
import net.minestom.server.instance.Chunk; import net.minestom.server.instance.Chunk;
import net.minestom.server.instance.Instance; import net.minestom.server.instance.Instance;
import net.minestom.server.instance.InstanceManager; import net.minestom.server.instance.InstanceManager;
import net.minestom.server.instance.block.CustomBlock; import net.minestom.server.instance.block.CustomBlock;
import net.minestom.server.inventory.EquipmentHandler;
import net.minestom.server.item.ItemStack;
import net.minestom.server.network.packet.server.play.*; import net.minestom.server.network.packet.server.play.*;
import net.minestom.server.network.player.PlayerConnection; import net.minestom.server.network.player.PlayerConnection;
import net.minestom.server.permission.Permission; import net.minestom.server.permission.Permission;
@ -43,7 +40,6 @@ import net.minestom.server.utils.validate.Check;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.time.Year;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
@ -838,6 +834,8 @@ public class Entity implements Viewable, EventHandler, DataContainer, Permission
this.lastX = this.position.getX(); this.lastX = this.position.getX();
this.lastY = this.position.getY(); this.lastY = this.position.getY();
this.lastZ = this.position.getZ(); this.lastZ = this.position.getZ();
this.lastYaw = this.position.getYaw();
this.lastPitch = this.position.getPitch();
this.isActive = true; this.isActive = true;
this.instance = instance; this.instance = instance;

View File

@ -743,7 +743,8 @@ public class Player extends LivingEntity implements CommandSender {
super.setInstance(instance, spawnPosition); super.setInstance(instance, spawnPosition);
if (!position.isSimilar(spawnPosition)) { if (!position.isSimilar(spawnPosition) && !firstSpawn) {
// Player changed instance at a different position
teleport(spawnPosition); teleport(spawnPosition);
} else if (updateChunks) { } else if (updateChunks) {
// Send newly visible chunks to player once spawned in the instance // Send newly visible chunks to player once spawned in the instance

View File

@ -345,6 +345,8 @@ public class Position implements PublicCloneable<Position> {
this.x = position.x; this.x = position.x;
this.y = position.y; this.y = position.y;
this.z = position.z; this.z = position.z;
this.yaw = position.yaw;
this.pitch = position.pitch;
} }
/** /**