mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fix NPE when link entity not found and use non-deprecated constructor (#1706)
* Fix NPE when link entity not found and use non-deprecated constructor * Extract method call to variable * Update PlayerEntity.java * Fix indentation
This commit is contained in:
parent
462e9b8b0d
commit
498f7653d3
1 changed files with 4 additions and 1 deletions
|
@ -103,7 +103,10 @@ public class PlayerEntity extends LivingEntity {
|
|||
|
||||
long linkedEntityId = session.getEntityCache().getCachedPlayerEntityLink(entityId);
|
||||
if (linkedEntityId != -1) {
|
||||
addPlayerPacket.getEntityLinks().add(new EntityLinkData(session.getEntityCache().getEntityByJavaId(linkedEntityId).getGeyserId(), geyserId, EntityLinkData.Type.RIDER, false));
|
||||
Entity linkedEntity = session.getEntityCache().getEntityByJavaId(linkedEntityId);
|
||||
if (linkedEntity != null) {
|
||||
addPlayerPacket.getEntityLinks().add(new EntityLinkData(linkedEntity.getGeyserId(), geyserId, EntityLinkData.Type.RIDER, false, false));
|
||||
}
|
||||
}
|
||||
|
||||
valid = true;
|
||||
|
|
Loading…
Reference in a new issue