mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-09 09:57:45 +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(getMetadataPacket());
|
||||
|
||||
// Passenger
|
||||
if (hasPassenger()) {
|
||||
playerConnection.sendPacket(getPassengersPacket());
|
||||
}
|
||||
|
||||
// Head position
|
||||
{
|
||||
EntityHeadLookPacket entityHeadLookPacket = new EntityHeadLookPacket();
|
||||
entityHeadLookPacket.entityId = getEntityId();
|
||||
entityHeadLookPacket.yaw = position.getYaw();
|
||||
playerConnection.sendPacket(entityHeadLookPacket);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -552,6 +552,11 @@ public class LivingEntity extends Entity implements EquipmentHandler {
|
||||
final PlayerConnection playerConnection = player.getPlayerConnection();
|
||||
playerConnection.sendPacket(getEquipmentsPacket());
|
||||
playerConnection.sendPacket(getPropertiesPacket());
|
||||
|
||||
if (getTeam() != null){
|
||||
playerConnection.sendPacket(getTeam().createTeamsCreationPacket());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -593,13 +593,12 @@ public class Player extends LivingEntity implements CommandSender {
|
||||
|
||||
@Override
|
||||
public boolean addViewer0(@NotNull Player player) {
|
||||
if (player == this || !super.addViewer0(player)) {
|
||||
if (player == this) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerConnection viewerConnection = player.getPlayerConnection();
|
||||
showPlayer(viewerConnection);
|
||||
return true;
|
||||
viewerConnection.sendPacket(getAddPlayerToList());
|
||||
return super.addViewer0(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user