mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-12-28 23:38:32 +01:00
JavaCollectItemTranslator: check null for entities (#1267)
This commit is contained in:
parent
3b274ef9d1
commit
9c8eb00cd5
1 changed files with 2 additions and 0 deletions
|
@ -41,6 +41,7 @@ public class JavaCollectItemTranslator extends PacketTranslator<ServerEntityColl
|
|||
TakeItemEntityPacket takeItemEntityPacket = new TakeItemEntityPacket();
|
||||
// Collected entity is the item
|
||||
Entity collectedEntity = session.getEntityCache().getEntityByJavaId(packet.getCollectedEntityId());
|
||||
if (collectedEntity == null) return;
|
||||
// Collector is the entity picking up the item
|
||||
Entity collectorEntity;
|
||||
if (packet.getCollectorEntityId() == session.getPlayerEntity().getEntityId()) {
|
||||
|
@ -48,6 +49,7 @@ public class JavaCollectItemTranslator extends PacketTranslator<ServerEntityColl
|
|||
} else {
|
||||
collectorEntity = session.getEntityCache().getEntityByJavaId(packet.getCollectorEntityId());
|
||||
}
|
||||
if (collectorEntity == null) return;
|
||||
takeItemEntityPacket.setRuntimeEntityId(collectorEntity.getGeyserId());
|
||||
takeItemEntityPacket.setItemRuntimeEntityId(collectedEntity.getGeyserId());
|
||||
session.sendUpstreamPacket(takeItemEntityPacket);
|
||||
|
|
Loading…
Reference in a new issue