BiomePrefabContent class

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

Файл: com/hypixel/hytale/builtin/worldgen/modifier/content/prefab/BiomePrefabContent.java

extends: PrefabContent

Поля (1)

МодификаторыТипИмя
final String ID

Методы (3)

МодификаторыВозвратСигнатура
protected PrefabPatternGenerator buildPatternPrefabPatternGenerator buildPattern(@Nonnull SeedString<SeedStringResource> var1)
if if(this.prefabs.length != 0)
if if(var1 instanceof ModifyEvents.BiomePrefabs var2)

Исходный код

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

class="kw">import com.hypixel.hytale.builtin.worldgen.modifier.content.common.BlockMask;
class="kw">import com.hypixel.hytale.builtin.worldgen.modifier.content.common.HeightMask;
class="kw">import com.hypixel.hytale.builtin.worldgen.modifier.content.common.PointGrid;
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.Codec;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.builder.BuilderCodec;
class="kw">import com.hypixel.hytale.procedurallib.json.SeedString;
class="kw">import com.hypixel.hytale.server.core.asset.type.environment.config.Environment;
class="kw">import com.hypixel.hytale.server.worldgen.SeedStringResource;
class="kw">import com.hypixel.hytale.server.worldgen.container.PrefabContainer;
class="kw">import com.hypixel.hytale.server.worldgen.prefab.PrefabBaseCheck;
class="kw">import com.hypixel.hytale.server.worldgen.prefab.PrefabCategory;
class="kw">import com.hypixel.hytale.server.worldgen.prefab.PrefabPatternGenerator;
class="kw">import javax.annotation.Nonnull;

class="kw">public class BiomePrefabContent class="kw">extends PrefabContent {
   class="kw">public class="kw">static class="kw">final String ID = "BiomePrefab";
   class="kw">public class="kw">static class="kw">final BuilderCodec<BiomePrefabContent> CODEC = BuilderCodec.builder(BiomePrefabContent.class, BiomePrefabContent::new, PrefabContent.CODEC)
      .documentation("Define a set of one or more prefabs that should be generated in the target biome(s)")
      .<PointGrid>append(new KeyedCodec<>("PointGrid", PointGrid.CODEC), (var0, var1) -> var0.grid = var1, var0 -> var0.grid)
      .documentation("The point grid for the prefab")
      .add()
      .<Boolean>append(new KeyedCodec<>("FitHeightmap", Codec.BOOLEAN), (var0, var1) -> var0.fitHeightmap = var1, var0 -> var0.fitHeightmap)
      .documentation("Whether the prefab should fit to the heightmap")
      .add()
      .<Boolean>append(new KeyedCodec<>("Submerge", Codec.BOOLEAN), (var0, var1) -> var0.submerge = var1, var0 -> var0.submerge)
      .documentation("Whether the prefab should be submerged if placed underwater")
      .add()
      .<PrefabBaseCheck[]>append(new KeyedCodec<>("BaseChecks", PrefabBaseCheck.ARRAY_CODEC), (var0, var1) -> var0.baseChecks = var1, var0 -> var0.baseChecks)
      .documentation("List of prefab base-check rules")
      .add()
      .<BlockMask>append(new KeyedCodec<>("ParentMask", BlockMask.CODEC), (var0, var1) -> var0.parentMask = var1, var0 -> var0.parentMask)
      .documentation("Define which blocks the prefab can be placed on")
      .add()
      .afterDecode(PrefabContent::rebuild)
      .build();
   class="kw">protected class="kw">static class="kw">final int DEFAULT_MAX_SIZE = 24;
   class="kw">protected class="kw">static class="kw">final int DEFAULT_EXCLUSION_RADIUS = 0;
   class="kw">protected class="kw">static class="kw">final boolean DEFAULT_DEEP_SEARCH = false;
   class="kw">protected class="kw">static class="kw">final boolean DEFAULT_ON_FLUID = false;
   class="kw">protected boolean fitHeightmap = false;
   class="kw">protected boolean submerge = false;
   class="kw">protected PointGrid grid = PointGrid.DEFAULT;
   class="kw">protected BlockMask parentMask = BlockMask.REPLACE_SOLID;
   class="kw">protected PrefabBaseCheck[] baseChecks = PrefabBaseCheck.EMPTY_ARRAY;

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

   @Override
   class="kw">public <T> void applyTo(ModifyEvent<T> var1) class="kw">throws Exception {
      if (this.prefabs.length != 0) {
         if (var1 class="kw">instanceof ModifyEvents.BiomePrefabs var2) {
            var2.entries()
               .add(
                  new PrefabContainer.PrefabContainerEntry(
                     this.buildPrefabs(var1.seed()), this.buildPattern(var1.seed()), Environment.getAssetMap().getIndex(this.environment.getId())
                  )
               );
         }
      }
   }

   class="kw">protected PrefabPatternGenerator buildPattern(@Nonnull SeedString<SeedStringResource> var1) {
      class="kw">return new PrefabPatternGenerator(
         var1.hashCode(),
         PrefabCategory.NONE,
         this.grid.build(var1),
         this.heightMask.getCondition(),
         HeightMask.DEFAULT_HEIGHT_THRESHOLD,
         this.blockMask.getBlockMask(),
         this.noiseMask.build(var1),
         this.parentMask.getCondition(),
         this.rotations,
         this.offset,
         this.fitHeightmap,
         false,
         false,
         this.submerge,
         24,
         0,
         this.baseChecks
      );
   }
}