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_MULTIPLIERFields inherited from interface net.minecraft.util.RandomSource
GAUSSIAN_SPREAD_FACTOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfork()intgetCount()intnext(int pBits) static RandomSourceseedSlimeChunk(int pChunkX, int pChunkZ, long pLevelSeed, long pSalt) Creates a newRandomSource, seeded for determining whether a chunk is a slime chunk or not.longsetDecorationSeed(long pLevelSeed, int pMinChunkBlockX, int pMinChunkBlockZ) Seeds the current random for chunk decoration, including spawning mobs and for use in feature placement.voidsetFeatureSeed(long pDecorationSeed, int pIndex, int pDecorationStep) Seeds the current random for placing features.voidsetLargeFeatureSeed(long pBaseSeed, int pChunkX, int pChunkZ) Seeds the current random for placing large features such as caves, strongholds, and mineshafts.voidsetLargeFeatureWithSalt(long pLevelSeed, int pRegionX, int pRegionZ, int pSalt) Seeds the current random for placing the starts of structure features.voidsetSeed(long pSeed) Methods inherited from class net.minecraft.world.level.levelgen.LegacyRandomSource
nextGaussianMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.world.level.levelgen.BitRandomSource
nextBoolean, nextDouble, nextFloat, nextInt, nextInt, nextLongMethods inherited from interface net.minecraft.util.RandomSource
consumeCount, nextInt, nextIntBetweenInclusive, triangle, triangle
-
Field Details
-
randomSource
-
count
private int count
-
-
Constructor Details
-
WorldgenRandom
-
-
Method Details
-
getCount
public int getCount() -
fork
- Specified by:
forkin interfaceRandomSource- Overrides:
forkin classLegacyRandomSource
-
forkPositional
- Specified by:
forkPositionalin interfaceRandomSource- Overrides:
forkPositionalin classLegacyRandomSource
-
next
public int next(int pBits) - Specified by:
nextin interfaceBitRandomSource- Overrides:
nextin classLegacyRandomSource
-
setSeed
public void setSeed(long pSeed) - Specified by:
setSeedin interfaceRandomSource- Overrides:
setSeedin 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.Decorationof 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 thespacingof 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
-