Class FastNoiseLite

java.lang.Object
fr.rodofire.ewc.util.FastNoiseLite

public class FastNoiseLite extends Object
Noise to generate perlin noise. It is a powerful class to add "randomness" to build. It can also be used to chose a Block BlockPlaceUtil
  • Constructor Details

    • FastNoiseLite

      public FastNoiseLite()
      Create new FastNoise object with default seed
    • FastNoiseLite

      public FastNoiseLite(int seed)
      Create new FastNoise object with specified seed
      Parameters:
      seed - the seed of the noise
  • Method Details

    • SetSeed

      public void SetSeed(int seed)
      Sets seed used for all noise types
      Parameters:
      seed - the seed of the noise, Default: 1337
    • SetFrequency

      public void SetFrequency(float frequency)
      Sets frequency for all noise types
      Parameters:
      frequency - Default: 0.01
    • SetNoiseType

      public void SetNoiseType(FastNoiseLite.NoiseType noiseType)
      Sets noise algorithm used for GetNoise(...)
      Parameters:
      noiseType - Default: OpenSimplex2
    • SetRotationType3D

      public void SetRotationType3D(FastNoiseLite.RotationType3D rotationType3D)
      Sets domain rotation type for 3D Noise and 3D DomainWarp. Can aid in reducing directional artifacts when sampling a 2D plane in 3D
      Parameters:
      rotationType3D - Default: None
    • SetFractalType

      public void SetFractalType(FastNoiseLite.FractalType fractalType)
      Sets method for combining octaves in all fractal noise types
      Parameters:
      fractalType - Default: None Note: FractalType.DomainWarp... only affects DomainWarp(...)
    • SetFractalOctaves

      public void SetFractalOctaves(int octaves)
      Sets octave count for all fractal noise types
      Parameters:
      octaves - Default: 3
    • SetFractalLacunarity

      public void SetFractalLacunarity(float lacunarity)
      Sets octave lacunarity for all fractal noise types
      Parameters:
      lacunarity - Default: 2.0
    • SetFractalGain

      public void SetFractalGain(float gain)
      Sets octave gain for all fractal noise types
      Parameters:
      gain - Default: 0.5
    • SetFractalWeightedStrength

      public void SetFractalWeightedStrength(float weightedStrength)
      Sets octave weighting for all none DomainWarp fratal types
      Parameters:
      weightedStrength - Default: 0.0 Note: Keep between 0...1 to maintain -1...1 output bounding
    • SetFractalPingPongStrength

      public void SetFractalPingPongStrength(float pingPongStrength)
      Sets strength of the fractal ping pong effect
      Parameters:
      pingPongStrength - Default: 2.0
    • SetCellularDistanceFunction

      public void SetCellularDistanceFunction(FastNoiseLite.CellularDistanceFunction cellularDistanceFunction)
      Sets distance function used in cellular noise calculations
      Parameters:
      cellularDistanceFunction - Default: Distance
    • SetCellularReturnType

      public void SetCellularReturnType(FastNoiseLite.CellularReturnType cellularReturnType)
      Sets return type from cellular noise calculations
      Parameters:
      cellularReturnType - Default: EuclideanSq
    • SetCellularJitter

      public void SetCellularJitter(float cellularJitter)
      Sets the maximum distance a cellular point can move from it's grid position
      Parameters:
      cellularJitter - Default: 1.0 Note: Setting this higher than 1 will cause artifacts
    • SetDomainWarpType

      public void SetDomainWarpType(FastNoiseLite.DomainWarpType domainWarpType)
      Sets the warp algorithm when using DomainWarp(...)
      Parameters:
      domainWarpType - Default: OpenSimplex2
    • SetDomainWarpAmp

      public void SetDomainWarpAmp(float domainWarpAmp)
      Sets the maximum warp distance from original position when using DomainWarp(...)
      Parameters:
      domainWarpAmp - Default: 1.0
    • GetNoise

      public float GetNoise(net.minecraft.core.BlockPos pos)
      addition for simpler use This is only used to return the value for a 3d noise.
      Parameters:
      pos - the pos of the noise.
      Returns:
      the value of the noise.
    • GetNoise

      public float GetNoise(long pos)
    • Get2DNoise

      public float Get2DNoise(long pos)
    • GetNoise

      public float GetNoise(float x, float y)
      2D noise at given position using current settings
      Parameters:
      x - the coordinates of the noise
      y - the coordinates of the noise
      Returns:
      Noise output bounded between -1...1
    • GetNoise

      public float GetNoise(float x, float y, float z)
      3D noise at given position using current settings
      Parameters:
      x - the coordinates of the noise
      y - the coordinates of the noise
      z - the coordinates of the noise
      Returns:
      Noise output bounded between -1...1