Dieser Commit ist enthalten in:
Ursprung
d8825f0262
Commit
cf9b3ddf22
@ -70,7 +70,7 @@ public class REntityServer implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void addEntity(REntity entity) {
|
void addEntity(REntity entity) {
|
||||||
entities.computeIfAbsent(entityToId(entity), i -> new HashSet<>()).add(entity);
|
addEntityToChunk(entity);
|
||||||
entity.spawn(packet -> updateEntity(entity, packet));
|
entity.spawn(packet -> updateEntity(entity, packet));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,6 +81,7 @@ public class REntityServer implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
onMissing(players.get(fromId), players.get(toId), entity::despawn);
|
onMissing(players.get(fromId), players.get(toId), entity::despawn);
|
||||||
|
removeEntityFromChunk(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
void postEntityMove(REntity entity, double fromX, double fromZ) {
|
void postEntityMove(REntity entity, double fromX, double fromZ) {
|
||||||
@ -89,6 +90,7 @@ public class REntityServer implements Listener {
|
|||||||
if(fromId == toId)
|
if(fromId == toId)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
addEntityToChunk(entity);
|
||||||
onMissing(players.get(toId), players.get(fromId), entity::spawn);
|
onMissing(players.get(toId), players.get(fromId), entity::spawn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,6 +102,14 @@ public class REntityServer implements Listener {
|
|||||||
|
|
||||||
void removeEntity(REntity entity) {
|
void removeEntity(REntity entity) {
|
||||||
entity.despawn(packet -> updateEntity(entity, packet));
|
entity.despawn(packet -> updateEntity(entity, packet));
|
||||||
|
removeEntityFromChunk(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addEntityToChunk(REntity entity) {
|
||||||
|
entities.computeIfAbsent(entityToId(entity), i -> new HashSet<>()).add(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeEntityFromChunk(REntity entity) {
|
||||||
long id = entityToId(entity);
|
long id = entityToId(entity);
|
||||||
HashSet<REntity> entitiesInChunk = entities.get(id);
|
HashSet<REntity> entitiesInChunk = entities.get(id);
|
||||||
entitiesInChunk.remove(entity);
|
entitiesInChunk.remove(entity);
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren