classpublicPriority 3
SimplexNoiseAsset
com.hypixel.hytale.builtin.hytalegenerator.assets.noisegenerators.SimplexNoiseAsset
extends NoiseAsset
1
Methods
1
Public Methods
5
Fields
1
Constructors
Constants
BuilderCodec<SimplexNoiseAsset>CODEC= BuilderCodec.builder(SimplexNoiseAsset.class, SimplexNoiseAsset::new, NoiseAsset.ABSTRACT_CODEC)
...
Constructors
public
SimplexNoiseAsset()Methods
Public Methods (1)
public
SimplexNoiseField build(SeedBox parentSeed)@Nonnull
Fields
Private/Package Fields (5)
private
double lacunarityprivate
int octavesprivate
double persistenceprivate
double scaleprivate
String seedKeyInheritance
Parent
Current
Interface
Child
Use mouse wheel to zoom, drag to pan. Click nodes to navigate.
Related Classes
Source Code
package com.hypixel.hytale.builtin.hytalegenerator.assets.noisegenerators;
import com.hypixel.hytale.builtin.hytalegenerator.fields.noise.SimplexNoiseField;
import com.hypixel.hytale.builtin.hytalegenerator.seed.SeedBox;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.codec.validation.Validators;
import javax.annotation.Nonnull;
public class SimplexNoiseAsset extends NoiseAsset {
public static final BuilderCodec<SimplexNoiseAsset> CODEC = BuilderCodec.builder(SimplexNoiseAsset.class, SimplexNoiseAsset::new, NoiseAsset.ABSTRACT_CODEC)
.append(new KeyedCodec<>("Lacunarity", Codec.DOUBLE, true), (asset, lacunarity) -> asset.lacunarity = lacunarity, asset -> asset.lacunarity)
.addValidator(Validators.greaterThan(0.0))
.add()
.<Double>append(new KeyedCodec<>("Persistence", Codec.DOUBLE, true), (asset, persistence) -> asset.persistence = persistence, asset -> asset.persistence)
.addValidator(Validators.greaterThan(0.0))
.add()
.<Double>append(new KeyedCodec<>("Scale", Codec.DOUBLE, true), (asset, scale) -> asset.scale = scale, asset -> asset.scale)
.addValidator(Validators.greaterThan(0.0))
.add()
.<Integer>append(new KeyedCodec<>("Octaves", Codec.INTEGER, true), (asset, octaves) -> asset.octaves = octaves, asset -> asset.octaves)
.addValidator(Validators.greaterThan(0))
.add()
.append(new KeyedCodec<>("Seed", Codec.STRING, true), (asset, seed) -> asset.seedKey = seed, asset -> asset.seedKey)
.add()
.build();
private double lacunarity = 1.0;
private double persistence = 1.0;
private double scale = 1.0;
private int octaves = 1;
private String seedKey = "A";
public SimplexNoiseAsset() {
}
@Nonnull
public SimplexNoiseField build(@Nonnull SeedBox parentSeed) {
SeedBox childSeed = parentSeed.child(this.seedKey);
return SimplexNoiseField.builder()
.withAmplitudeMultiplier(this.persistence)
.withFrequencyMultiplier(this.lacunarity)
.withScale(this.scale)
.withSeed((long)childSeed.createSupplier().get().intValue())
.withNumberOfOctaves(this.octaves)
.build();
}
}