WorldEventsConfig class

Пакет: com.hypixel.hytale.builtin.adventure.worldevents

Файл: com/hypixel/hytale/builtin/adventure/worldevents/WorldEventsConfig.java

Поля (1)

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

Методы (1)

МодификаторыВозвратСигнатура
public int exclusionRadiusint exclusionRadius()

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.adventure.worldevents;

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.codec.validation.Validators;
class="kw">import javax.annotation.Nonnull;

class="kw">public class WorldEventsConfig {
   class="kw">public class="kw">static class="kw">final String ID = "WorldEvents";
   class="kw">public class="kw">static class="kw">final BuilderCodec<WorldEventsConfig> CODEC = BuilderCodec.builder(WorldEventsConfig.class, WorldEventsConfig::new)
      .append(new KeyedCodec<>("ExclusionRadius", Codec.INTEGER), (var0, var1) -> var0.exclusionRadius = var1, var0 -> var0.exclusionRadius)
      .documentation("The minimum distance that a world-event location must be from other world-event locations. Set to 0 to disable proximity filtering.")
      .addValidator(Validators.greaterThanOrEqual(0))
      .add()
      .<WorldEventRecord[]>append(new KeyedCodec<>("Events", WorldEventRecord.ARRAY_CODEC), (var0, var1) -> var0.events = var1, var0 -> var0.events)
      .documentation("List of world events to run when the world loads.")
      .addValidator(WorldEventRecord.ARRAY_VALIDATOR)
      .add()
      .<WorldEventRecord[]>append(
         new KeyedCodec<>("GlobalEvents", WorldEventRecord.ARRAY_CODEC), (var0, var1) -> var0.globalEvents = var1, var0 -> var0.globalEvents
      )
      .documentation("List of global world events to run when triggered by an action in-game such as an interaction.")
      .addValidator(WorldEventRecord.ARRAY_VALIDATOR)
      .add()
      .build();
   class="kw">public class="kw">static class="kw">final int DEFAULT_EXCLUSION_RADIUS = 512;
   class="kw">protected int exclusionRadius = 512;
   @Nonnull
   class="kw">protected WorldEventRecord[] events = WorldEventRecord.EMPTY_ARRAY;
   @Nonnull
   class="kw">protected WorldEventRecord[] globalEvents = WorldEventRecord.EMPTY_ARRAY;

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

   class="kw">public int exclusionRadius() {
      class="kw">return this.exclusionRadius;
   }

   @Nonnull
   class="kw">public WorldEventRecord[] events() {
      class="kw">return this.events;
   }

   @Nonnull
   class="kw">public WorldEventRecord[] globalEvents() {
      class="kw">return this.globalEvents;
   }
}