Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-28 00:50:20 +01:00
JavaCollectItemTranslator: check null for entities (#1267)
Dieser Commit ist enthalten in:
Ursprung
3b274ef9d1
Commit
9c8eb00cd5
@ -41,6 +41,7 @@ public class JavaCollectItemTranslator extends PacketTranslator<ServerEntityColl
|
|||||||
TakeItemEntityPacket takeItemEntityPacket = new TakeItemEntityPacket();
|
TakeItemEntityPacket takeItemEntityPacket = new TakeItemEntityPacket();
|
||||||
// Collected entity is the item
|
// Collected entity is the item
|
||||||
Entity collectedEntity = session.getEntityCache().getEntityByJavaId(packet.getCollectedEntityId());
|
Entity collectedEntity = session.getEntityCache().getEntityByJavaId(packet.getCollectedEntityId());
|
||||||
|
if (collectedEntity == null) return;
|
||||||
// Collector is the entity picking up the item
|
// Collector is the entity picking up the item
|
||||||
Entity collectorEntity;
|
Entity collectorEntity;
|
||||||
if (packet.getCollectorEntityId() == session.getPlayerEntity().getEntityId()) {
|
if (packet.getCollectorEntityId() == session.getPlayerEntity().getEntityId()) {
|
||||||
@ -48,6 +49,7 @@ public class JavaCollectItemTranslator extends PacketTranslator<ServerEntityColl
|
|||||||
} else {
|
} else {
|
||||||
collectorEntity = session.getEntityCache().getEntityByJavaId(packet.getCollectorEntityId());
|
collectorEntity = session.getEntityCache().getEntityByJavaId(packet.getCollectorEntityId());
|
||||||
}
|
}
|
||||||
|
if (collectorEntity == null) return;
|
||||||
takeItemEntityPacket.setRuntimeEntityId(collectorEntity.getGeyserId());
|
takeItemEntityPacket.setRuntimeEntityId(collectorEntity.getGeyserId());
|
||||||
takeItemEntityPacket.setItemRuntimeEntityId(collectedEntity.getGeyserId());
|
takeItemEntityPacket.setItemRuntimeEntityId(collectedEntity.getGeyserId());
|
||||||
session.sendUpstreamPacket(takeItemEntityPacket);
|
session.sendUpstreamPacket(takeItemEntityPacket);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren