HyCodeYourTale
classpublicPriority 3

MeshPointGeneratorAsset

com.hypixel.hytale.builtin.hytalegenerator.assets.pointgenerators.MeshPointGeneratorAsset

extends PointGeneratorAsset

1

Methods

1

Public Methods

5

Fields

1

Constructors

Constants

BuilderCodec<MeshPointGeneratorAsset>CODEC= BuilderCodec.builder( MeshPointGeneratorAsset.class, MeshPointGeneratorAsset::new, Point...

Constructors

public
MeshPointGeneratorAsset()

Methods

Public Methods (1)

public
PointProvider build(SeedBox parentSeed)
@Override

Fields

Private/Package Fields (5)

privatedouble jitter
privatedouble scaleX
privatedouble scaleY
privatedouble scaleZ
privateString seedKey

Inheritance

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.pointgenerators;

import com.hypixel.hytale.builtin.hytalegenerator.fields.points.JitterPointField;
import com.hypixel.hytale.builtin.hytalegenerator.fields.points.PointProvider;
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 MeshPointGeneratorAsset extends PointGeneratorAsset {
   public static final BuilderCodec<MeshPointGeneratorAsset> CODEC = BuilderCodec.builder(
         MeshPointGeneratorAsset.class, MeshPointGeneratorAsset::new, PointGeneratorAsset.ABSTRACT_CODEC
      )
      .append(new KeyedCodec<>("Jitter", Codec.DOUBLE, true), (asset, v) -> asset.jitter = v, asset -> asset.jitter)
      .addValidator(Validators.range(0.0, 0.5))
      .add()
      .<Double>append(new KeyedCodec<>("ScaleX", Codec.DOUBLE, true), (asset, v) -> asset.scaleX = v, asset -> asset.scaleX)
      .addValidator(Validators.greaterThan(0.0))
      .add()
      .<Double>append(new KeyedCodec<>("ScaleY", Codec.DOUBLE, true), (asset, v) -> asset.scaleY = v, asset -> asset.scaleY)
      .addValidator(Validators.greaterThan(0.0))
      .add()
      .<Double>append(new KeyedCodec<>("ScaleZ", Codec.DOUBLE, true), (asset, v) -> asset.scaleZ = v, asset -> asset.scaleZ)
      .addValidator(Validators.greaterThan(0.0))
      .add()
      .append(new KeyedCodec<>("Seed", Codec.STRING, true), (asset, seed) -> asset.seedKey = seed, asset -> asset.seedKey)
      .add()
      .build();
   private double jitter = 0.35;
   private double scaleX = 1.0;
   private double scaleY = 1.0;
   private double scaleZ = 1.0;
   private String seedKey = "A";

   public MeshPointGeneratorAsset() {
   }

   @Override
   public PointProvider build(@Nonnull SeedBox parentSeed) {
      SeedBox childSeed = parentSeed.child(this.seedKey);
      return new JitterPointField(childSeed.createSupplier().get(), this.jitter).setScale(this.scaleX, this.scaleY, this.scaleZ, 1.0);
   }
}