Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-03 14:50:19 +01:00
Only add entity to entity cache if ID doesn't exist (#428)
Dieser Commit ist enthalten in:
Ursprung
35506f8bef
Commit
0caecf68db
@ -58,13 +58,19 @@ public class EntityCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void spawnEntity(Entity entity) {
|
public void spawnEntity(Entity entity) {
|
||||||
cacheEntity(entity);
|
if (cacheEntity(entity)) {
|
||||||
entity.spawnEntity(session);
|
entity.spawnEntity(session);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void cacheEntity(Entity entity) {
|
public boolean cacheEntity(Entity entity) {
|
||||||
|
// Check to see if the entity exists, otherwise we can end up with duplicated mobs
|
||||||
|
if (!entityIdTranslations.containsKey(entity.getEntityId())) {
|
||||||
entityIdTranslations.put(entity.getEntityId(), entity.getGeyserId());
|
entityIdTranslations.put(entity.getEntityId(), entity.getGeyserId());
|
||||||
entities.put(entity.getGeyserId(), entity);
|
entities.put(entity.getGeyserId(), entity);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean removeEntity(Entity entity, boolean force) {
|
public boolean removeEntity(Entity entity, boolean force) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren