-
Notifications
You must be signed in to change notification settings - Fork 146
Open
Labels
Description
Region#encode currently skips ground items and projectiles and so updates for these wont be sent.
public Set<RegionUpdateMessage> encode(int height) {
Set<RegionUpdateMessage> additions = entities.values().stream()
.flatMap(Set::stream) // TODO fix this to work for ground items + projectiles
.filter(entity -> entity instanceof DynamicGameObject && entity.getPosition().getHeight() == height)
.map(entity -> ((GroupableEntity) entity).toUpdateOperation(this, EntityUpdateType.ADD).toMessage())
.collect(Collectors.toSet());
ImmutableSet.Builder<RegionUpdateMessage> builder = ImmutableSet.builder();
builder.addAll(additions).addAll(updates.get(height)).addAll(removedObjects.get(height));
return builder.build();
}