Class WorldgenRandom

java.lang.Object
net.minecraft.world.level.levelgen.LegacyRandomSource
net.minecraft.world.level.levelgen.WorldgenRandom
All Implemented Interfaces:
RandomSource, BitRandomSource

public class WorldgenRandom extends LegacyRandomSource
  • Field Details

    • randomSource

      private final RandomSource randomSource
    • count

      private int count
  • Constructor Details

    • WorldgenRandom

      public WorldgenRandom(RandomSource pRandomSource)
  • Method Details

    • getCount

      public int getCount()
    • fork

      public RandomSource fork()
      Specified by:
      fork in interface RandomSource
      Overrides:
      fork in class LegacyRandomSource
    • forkPositional

      public PositionalRandomFactory forkPositional()
      Specified by:
      forkPositional in interface RandomSource
      Overrides:
      forkPositional in class LegacyRandomSource
    • next

      public int next(int pBits)
      Specified by:
      next in interface BitRandomSource
      Overrides:
      next in class LegacyRandomSource
    • setSeed

      public void setSeed(long pSeed)
      Specified by:
      setSeed in interface RandomSource
      Overrides:
      setSeed in class LegacyRandomSource
    • 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 by setDecorationSeed(long, int, int)
      pIndex - The cumulative index of the generating feature within the biome's list of features.
      pDecorationStep - The ordinal of the GenerationStep.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 the spacing of the structure settings.
      Parameters:
      pSalt - A salt unique to each structure.
    • seedSlimeChunk

      public static RandomSource seedSlimeChunk(int pChunkX, int pChunkZ, long pLevelSeed, long pSalt)
      Creates a new RandomSource, seeded for determining whether a chunk is a slime chunk or not.
      Parameters:
      pSalt - For vanilla slimes, this is always 987234911L