Skip to content

Encode ground items and projectiles in region updates #321

@Major-

Description

@Major-

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();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    mediumrequestA non-content feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions