3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 16:12:46 +01: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
Dieser Commit ist enthalten in:
rtm516 2021-01-28 16:33:26 +00:00 committet von GitHub
Ursprung 462e9b8b0d
Commit 498f7653d3
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -103,7 +103,10 @@ public class PlayerEntity extends LivingEntity {
long linkedEntityId = session.getEntityCache().getCachedPlayerEntityLink(entityId); long linkedEntityId = session.getEntityCache().getCachedPlayerEntityLink(entityId);
if (linkedEntityId != -1) { 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; valid = true;