use of org.spongepowered.common.util.NonNullArrayList in project SpongeCommon by SpongePowered.
the class MixinWorldServer method spawnEntities.
@Override
public Collection<Entity> spawnEntities(Iterable<? extends Entity> entities) {
List<Entity> entitiesToSpawn = new NonNullArrayList<>();
entities.forEach(entitiesToSpawn::add);
final SpawnEntityEvent.Custom event = SpongeEventFactory.createSpawnEntityEventCustom(Sponge.getCauseStackManager().getCurrentCause(), entitiesToSpawn);
if (Sponge.getEventManager().post(event)) {
return ImmutableList.of();
}
for (Entity entity : event.getEntities()) {
this.forceSpawnEntity(entity);
}
return event.getEntities().stream().filter(Entity::isLoaded).collect(ImmutableList.toImmutableList());
}
Aggregations