use of org.spongepowered.api.event.cause.entity.SpawnType in project SpongeCommon by SpongePowered.
the class TransactionSink method logEntitySpawn.
@SuppressWarnings("ConstantConditions")
default void logEntitySpawn(final PhaseContext<@NonNull ?> current, final TrackedWorldBridge serverWorld, final Entity entityIn) {
final WeakReference<ServerLevel> worldRef = new WeakReference<>((ServerLevel) serverWorld);
final Supplier<ServerLevel> worldSupplier = () -> Objects.requireNonNull(worldRef.get(), "ServerWorld dereferenced");
final Supplier<SpawnType> contextualType = current.getSpawnTypeForTransaction(entityIn);
final SpawnEntityTransaction transaction = new SpawnEntityTransaction(worldSupplier, entityIn, contextualType);
this.logTransaction(transaction);
}
Aggregations