Class WorldgenRandom
java.lang.Object
net.minecraft.world.level.levelgen.LegacyRandomSource
net.minecraft.world.level.levelgen.WorldgenRandom
- All Implemented Interfaces:
RandomSource
,BitRandomSource
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class net.minecraft.world.level.levelgen.LegacyRandomSource
LegacyRandomSource.LegacyPositionalRandomFactory
-
Field Summary
FieldsFields inherited from interface net.minecraft.world.level.levelgen.BitRandomSource
DOUBLE_MULTIPLIER, FLOAT_MULTIPLIER
Fields inherited from interface net.minecraft.util.RandomSource
GAUSSIAN_SPREAD_FACTOR
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfork()
int
getCount()
int
next
(int pBits) static RandomSource
seedSlimeChunk
(int pChunkX, int pChunkZ, long pLevelSeed, long pSalt) Creates a newRandomSource
, seeded for determining whether a chunk is a slime chunk or not.long
setDecorationSeed
(long pLevelSeed, int pMinChunkBlockX, int pMinChunkBlockZ) Seeds the current random for chunk decoration, including spawning mobs and for use in feature placement.void
setFeatureSeed
(long pDecorationSeed, int pIndex, int pDecorationStep) Seeds the current random for placing features.void
setLargeFeatureSeed
(long pBaseSeed, int pChunkX, int pChunkZ) Seeds the current random for placing large features such as caves, strongholds, and mineshafts.void
setLargeFeatureWithSalt
(long pLevelSeed, int pRegionX, int pRegionZ, int pSalt) Seeds the current random for placing the starts of structure features.void
setSeed
(long pSeed) Methods inherited from class net.minecraft.world.level.levelgen.LegacyRandomSource
nextGaussian
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.world.level.levelgen.BitRandomSource
nextBoolean, nextDouble, nextFloat, nextInt, nextInt, nextLong
Methods inherited from interface net.minecraft.util.RandomSource
consumeCount, nextInt, nextIntBetweenInclusive, triangle
-
Field Details
-
randomSource
-
count
private int count
-
-
Constructor Details
-
WorldgenRandom
-
-
Method Details
-
getCount
public int getCount() -
fork
- Specified by:
fork
in interfaceRandomSource
- Overrides:
fork
in classLegacyRandomSource
-
forkPositional
- Specified by:
forkPositional
in interfaceRandomSource
- Overrides:
forkPositional
in classLegacyRandomSource
-
next
public int next(int pBits) - Specified by:
next
in interfaceBitRandomSource
- Overrides:
next
in classLegacyRandomSource
-
setSeed
public void setSeed(long pSeed) - Specified by:
setSeed
in interfaceRandomSource
- Overrides:
setSeed
in classLegacyRandomSource
-
setDecorationSeed
public long setDecorationSeed(long pLevelSeed, int pMinChunkBlockX, int pMinChunkBlockZ) Seeds the current random for chunk decoration, including spawning mobs and for use in feature placement. The coordinates correspond to the minimum block position within a given chunk. -
setFeatureSeed
public void setFeatureSeed(long pDecorationSeed, int pIndex, int pDecorationStep) Seeds the current random for placing features. Each feature is seeded differently in order to seem more random. However, it does not do a good job of this, and issues can arise from the salt being small with features that have the same decoration step and are close together in the feature lists.- Parameters:
pDecorationSeed
- The seed computed bysetDecorationSeed(long, int, int)
pIndex
- The cumulative index of the generating feature within the biome's list of features.pDecorationStep
- The ordinal of theGenerationStep.Decoration
of the generating feature.
-
setLargeFeatureSeed
public void setLargeFeatureSeed(long pBaseSeed, int pChunkX, int pChunkZ) Seeds the current random for placing large features such as caves, strongholds, and mineshafts.- Parameters:
pBaseSeed
- This is passed in as the level seed, or in some cases such as carvers, as an offset from the level seed unique to each carver.
-
setLargeFeatureWithSalt
public void setLargeFeatureWithSalt(long pLevelSeed, int pRegionX, int pRegionZ, int pSalt) Seeds the current random for placing the starts of structure features. The region coordinates are the region which the target chunk lies in. For example, witch hut regions are 32x32 chunks, so all chunks within that region would be seeded identically. The size of the regions themselves are determined by thespacing
of the structure settings.- Parameters:
pSalt
- A salt unique to each structure.
-
seedSlimeChunk
Creates a newRandomSource
, seeded for determining whether a chunk is a slime chunk or not.- Parameters:
pSalt
- For vanilla slimes, this is always987234911L
-