Class TransactionalRandom
java.lang.Object
net.neoforged.neoforge.transfer.transaction.SnapshotJournal<Long>
net.neoforged.neoforge.transfer.item.TransactionalRandom
A deterministic random source whose internal state is transactional,
ensuring determinism across transactions until one is committed.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected LongReturns a new object containing a copy of this journal's current state.doublenextDouble(TransactionContext transaction) protected voidrevertToSnapshot(Long snapshot) Rolls back to a state previously created bySnapshotJournal.createSnapshot().Methods inherited from class SnapshotJournal
isInTransaction, onRootCommit, releaseSnapshot, updateSnapshots
-
Field Details
-
seed
private long seed
-
-
Constructor Details
-
TransactionalRandom
public TransactionalRandom()
-
-
Method Details
-
createSnapshot
Description copied from class:SnapshotJournalReturns a new object containing a copy of this journal's current state.
One may settle for a partial copy of this journal's state, as long as the returned snapshot will be sufficient to rollback (via
SnapshotJournal.revertToSnapshot(T)) all changes made to this journal's state since the snapshot was created.SnapshotJournal.isInTransaction()will returntrueinside this callback, and will continue to returntrueuntil all snapshots have either been reverted to or committed.- Specified by:
createSnapshotin classSnapshotJournal<Long>- Returns:
- a new object containing a copy of this journal's current state
-
revertToSnapshot
Description copied from class:SnapshotJournalRolls back to a state previously created bySnapshotJournal.createSnapshot().- Specified by:
revertToSnapshotin classSnapshotJournal<Long>
-
nextDouble
-