use of org.spongepowered.common.event.tracking.context.transaction.block.ScheduleUpdateTransaction in project SpongeCommon by SpongePowered.
the class TransactionSink method logScheduledUpdate.
@SuppressWarnings("ConstantConditions")
default void logScheduledUpdate(final ServerLevel serverWorld, final TickNextTickData<?> data) {
final WeakReference<ServerLevel> worldRef = new WeakReference<>(serverWorld);
final Supplier<ServerLevel> worldSupplier = () -> Objects.requireNonNull(worldRef.get(), "ServerWorld dereferenced");
@Nullable final BlockEntity tileEntity = serverWorld.getBlockEntity(data.pos);
final BlockState existing = serverWorld.getBlockState(data.pos);
final SpongeBlockSnapshot original = TrackingUtil.createPooledSnapshot(existing, data.pos, BlockChangeFlags.NONE, Constants.World.DEFAULT_BLOCK_CHANGE_LIMIT, tileEntity, worldSupplier, Optional::empty, Optional::empty);
original.blockChange = BlockChange.MODIFY;
final ScheduleUpdateTransaction transaction = new ScheduleUpdateTransaction(original, data);
this.logTransaction(transaction);
}
Aggregations