StaticEntry class

Пакет: com.hypixel.hytale.builtin.worldgen.modifier.content.layer

Файл: com/hypixel/hytale/builtin/worldgen/modifier/content/layer/BiomeStaticLayerContent.java

extends: LayerContent.Entry

Поля (9)

МодификаторыТипИмя
public static final ArrayCodec<BiomeStaticLayerContent.StaticEntry> ARRAY_CODEC
public static final BuilderCodec<BiomeStaticLayerContent.StaticEntry> CODEC
protected static final IntRange DEFAULT_MAX
protected static final IntRange DEFAULT_MIN
protected static final BiomeStaticLayerContent.StaticEntry[] EMPTY_ARRAY
protected IntRange maxY
protected NoiseMask maxYNoise
protected IntRange minY
protected NoiseMask minYNoise

Методы (1)

МодификаторыВозвратСигнатура
public LayerContainer.StaticLayerEntry buildpublic LayerContainer.StaticLayerEntry build(SeedString<SeedStringResource> var1)

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.worldgen.modifier.content.layer;

class="kw">import com.hypixel.hytale.builtin.worldgen.modifier.content.Codecs;
class="kw">import com.hypixel.hytale.builtin.worldgen.modifier.content.Content;
class="kw">import com.hypixel.hytale.builtin.worldgen.modifier.content.common.NoiseMask;
class="kw">import com.hypixel.hytale.builtin.worldgen.modifier.event.ModifyEvent;
class="kw">import com.hypixel.hytale.builtin.worldgen.modifier.event.ModifyEvents;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.builder.BuilderCodec;
class="kw">import com.hypixel.hytale.codec.codecs.array.ArrayCodec;
class="kw">import com.hypixel.hytale.math.range.IntRange;
class="kw">import com.hypixel.hytale.procedurallib.json.SeedString;
class="kw">import com.hypixel.hytale.procedurallib.supplier.DoubleRange;
class="kw">import com.hypixel.hytale.procedurallib.supplier.DoubleRangeNoiseSupplier;
class="kw">import com.hypixel.hytale.server.worldgen.SeedStringResource;
class="kw">import com.hypixel.hytale.server.worldgen.container.LayerContainer;
class="kw">import javax.annotation.Nonnull;

class="kw">public class BiomeStaticLayerContent class="kw">extends LayerContent {
   class="kw">public class="kw">static class="kw">final String ID = "BiomeStaticLayer";
   class="kw">public class="kw">static class="kw">final BuilderCodec<BiomeStaticLayerContent> CODEC = BuilderCodec.builder(
         BiomeStaticLayerContent.class, BiomeStaticLayerContent::new, LayerContent.CODEC
      )
      .documentation("Define a layer of material that generates between a class="kw">static height range")
      .<BiomeStaticLayerContent.StaticEntry[]>append(
         new KeyedCodec<>("Entries", BiomeStaticLayerContent.StaticEntry.ARRAY_CODEC), (var0, var1) -> var0.entries = var1, var0 -> var0.entries
      )
      .documentation("The entries contained within the layer")
      .add()
      .build();
   class="kw">protected BiomeStaticLayerContent.StaticEntry[] entries = BiomeStaticLayerContent.StaticEntry.EMPTY_ARRAY;

   class="kw">public BiomeStaticLayerContent() {
   }

   @Override
   class="kw">public Content.Type type() {
      class="kw">return Content.Type.BIOME_STATIC_LAYER;
   }

   @Override
   class="kw">public <T> void applyTo(ModifyEvent<T> var1) class="kw">throws Exception {
      if (this.entries.length != 0) {
         if (var1 class="kw">instanceof ModifyEvents.BiomeStaticLayers var2) {
            var2.entries().add(new LayerContainer.StaticLayer(this.buildEntries(var1.seed()), this.noiseMask.build(var1.seed()), 0));
         }
      }
   }

   class="kw">protected LayerContainer.StaticLayerEntry[] buildEntries(@Nonnull SeedString<SeedStringResource> var1) {
      LayerContainer.StaticLayerEntry[] var2 = new LayerContainer.StaticLayerEntry[this.entries.length];

      for (int var3 = 0; var3 < this.entries.length; var3++) {
         var2[var3] = this.entries[var3].build(var1);
      }

      class="kw">return var2;
   }

   class="kw">public class="kw">static class StaticEntry class="kw">extends LayerContent.Entry {
      class="kw">public class="kw">static class="kw">final BuilderCodec<BiomeStaticLayerContent.StaticEntry> CODEC = BuilderCodec.builder(
            BiomeStaticLayerContent.StaticEntry.class, BiomeStaticLayerContent.StaticEntry::new, LayerContent.Entry.CODEC
         )
         .documentation("Define an entry that generates within the class="kw">static layer")
         .<IntRange>append(new KeyedCodec<>("MinY", Codecs.INT_RANGE), (var0, var1) -> var0.minY = var1, var0 -> var0.minY)
         .documentation("The range for the minimum y-height of the layer")
         .add()
         .<NoiseMask>append(new KeyedCodec<>("MinYNoise", NoiseMask.CODEC), (var0, var1) -> var0.minYNoise = var1, var0 -> var0.minYNoise)
         .documentation("The noise for modulating the minimum height of the layer")
         .add()
         .<IntRange>append(new KeyedCodec<>("MaxY", Codecs.INT_RANGE), (var0, var1) -> var0.maxY = var1, var0 -> var0.maxY)
         .documentation("The range for the maximum y-height of the layer")
         .add()
         .<NoiseMask>append(new KeyedCodec<>("MaxYNoise", NoiseMask.CODEC), (var0, var1) -> var0.maxYNoise = var1, var0 -> var0.maxYNoise)
         .documentation("The noise for modulating the maximum height of the layer")
         .add()
         .build();
      class="kw">public class="kw">static class="kw">final ArrayCodec<BiomeStaticLayerContent.StaticEntry> ARRAY_CODEC = new ArrayCodec<>(CODEC, BiomeStaticLayerContent.StaticEntry[]::new);
      class="kw">protected class="kw">static class="kw">final BiomeStaticLayerContent.StaticEntry[] EMPTY_ARRAY = new BiomeStaticLayerContent.StaticEntry[0];
      class="kw">protected class="kw">static class="kw">final IntRange DEFAULT_MIN = new IntRange(0, 0);
      class="kw">protected class="kw">static class="kw">final IntRange DEFAULT_MAX = new IntRange(319, 319);
      class="kw">protected IntRange minY = DEFAULT_MIN;
      class="kw">protected NoiseMask minYNoise = NoiseMask.ZERO;
      class="kw">protected IntRange maxY = DEFAULT_MAX;
      class="kw">protected NoiseMask maxYNoise = NoiseMask.ZERO;

      class="kw">public StaticEntry() {
      }

      class="kw">public LayerContainer.StaticLayerEntry build(SeedString<SeedStringResource> var1) {
         class="kw">return new LayerContainer.StaticLayerEntry(
            NoiseBlockEntry.buildArray(var1, this.blocks),
            this.entryNoiseMask.build(var1),
            new DoubleRangeNoiseSupplier(new DoubleRange.Normal(this.minY.getInclusiveMin(), this.minY.getInclusiveMax()), this.minYNoise.buildNoise(var1)),
            new DoubleRangeNoiseSupplier(new DoubleRange.Normal(this.maxY.getInclusiveMin(), this.maxY.getInclusiveMax()), this.maxYNoise.buildNoise(var1))
         );
      }
   }
}