mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-10 02:17:41 +01:00
Fix entity head position, improve performance for Player#addViewer0
This commit is contained in:
parent
5185a3efa6
commit
169dbedea2
@ -348,10 +348,19 @@ public class Entity implements Viewable, EventHandler, DataContainer, Permission
|
|||||||
playerConnection.sendPacket(getVelocityPacket());
|
playerConnection.sendPacket(getVelocityPacket());
|
||||||
playerConnection.sendPacket(getMetadataPacket());
|
playerConnection.sendPacket(getMetadataPacket());
|
||||||
|
|
||||||
|
// Passenger
|
||||||
if (hasPassenger()) {
|
if (hasPassenger()) {
|
||||||
playerConnection.sendPacket(getPassengersPacket());
|
playerConnection.sendPacket(getPassengersPacket());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Head position
|
||||||
|
{
|
||||||
|
EntityHeadLookPacket entityHeadLookPacket = new EntityHeadLookPacket();
|
||||||
|
entityHeadLookPacket.entityId = getEntityId();
|
||||||
|
entityHeadLookPacket.yaw = position.getYaw();
|
||||||
|
playerConnection.sendPacket(entityHeadLookPacket);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,6 +552,11 @@ public class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
final PlayerConnection playerConnection = player.getPlayerConnection();
|
final PlayerConnection playerConnection = player.getPlayerConnection();
|
||||||
playerConnection.sendPacket(getEquipmentsPacket());
|
playerConnection.sendPacket(getEquipmentsPacket());
|
||||||
playerConnection.sendPacket(getPropertiesPacket());
|
playerConnection.sendPacket(getPropertiesPacket());
|
||||||
|
|
||||||
|
if (getTeam() != null){
|
||||||
|
playerConnection.sendPacket(getTeam().createTeamsCreationPacket());
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,13 +593,12 @@ public class Player extends LivingEntity implements CommandSender {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addViewer0(@NotNull Player player) {
|
public boolean addViewer0(@NotNull Player player) {
|
||||||
if (player == this || !super.addViewer0(player)) {
|
if (player == this) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerConnection viewerConnection = player.getPlayerConnection();
|
PlayerConnection viewerConnection = player.getPlayerConnection();
|
||||||
showPlayer(viewerConnection);
|
viewerConnection.sendPacket(getAddPlayerToList());
|
||||||
return true;
|
return super.addViewer0(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user