Fork class

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

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

Поля (8)

МодификаторыТипИмя
final BuilderCodec<Fork> CODEC
public static final BuilderCodec<Fork.Config> CODEC
public static final Fork.Config[] EMPTY_ARRAY
protected EventAction[] actions
protected EventCondition.Config[] conditions
protected String next
Fork var2
StageAsset var4

Методы (5)

МодификаторыВозвратСигнатура
public Configpublic Config()
public Fork buildpublic Fork build(@Nonnull StageId var1)
for for(int var3 = 0; var3 < this.conditions.length; var3++)
if if(this.next != null)
if if(var4 != null)

Исходный код

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

class="kw">import com.hypixel.hytale.builtin.adventure.worldevents.action.EventAction;
class="kw">import com.hypixel.hytale.builtin.adventure.worldevents.condition.EventCondition;
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 javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;

class="kw">public class Fork {
   class="kw">public class="kw">static class="kw">final BuilderCodec<Fork> CODEC = BuilderCodec.builder(Fork.class, Fork::new)
      .append(new KeyedCodec<>("Conditions", EventCondition.ARRAY_CODEC), (var0, var1) -> var0.conditions = var1, var0 -> var0.conditions)
      .add()
      .build();
   class="kw">public class="kw">static class="kw">final ArrayCodec<Fork> ARRAY_CODEC = new ArrayCodec<>(CODEC, Fork[]::new);
   class="kw">public class="kw">static class="kw">final Fork[] EMPTY_ARRAY = new Fork[0];
   @Nonnull
   class="kw">protected EventCondition[] conditions = EventCondition.EMPTY_ARRAY;
   @Nonnull
   class="kw">protected EventAction[] actions = EventAction.EMPTY_ARRAY;
   @Nullable
   class="kw">protected Stage next = null;

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

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

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

   @Nullable
   class="kw">public Stage next() {
      class="kw">return this.next;
   }

   class="kw">public class="kw">static class Config {
      class="kw">public class="kw">static class="kw">final BuilderCodec<Fork.Config> CODEC = BuilderCodec.builder(Fork.Config.class, Fork.Config::new)
         .append(new KeyedCodec<>("Conditions", EventCondition.Config.ARRAY_CODEC), (var0, var1) -> var0.conditions = var1, var0 -> var0.conditions)
         .documentation("List of conditions that must be met for the fork to complete.")
         .add()
         .<EventAction[]>append(new KeyedCodec<>("Actions", EventAction.ARRAY_CODEC), (var0, var1) -> var0.actions = var1, var0 -> var0.actions)
         .documentation("List of actions that will be run once the fork has completed.")
         .add()
         .<String>append(new KeyedCodec<>("Next", StageAsset.REF_CODEC), (var0, var1) -> var0.next = var1, var0 -> var0.next)
         .documentation("The next stage to run once this fork has completed.")
         .add()
         .build();
      class="kw">public class="kw">static class="kw">final Fork.Config[] EMPTY_ARRAY = new Fork.Config[0];
      @Nonnull
      class="kw">protected EventCondition.Config[] conditions = EventCondition.Config.EMPTY_ARRAY;
      @Nonnull
      class="kw">protected EventAction[] actions = EventAction.EMPTY_ARRAY;
      @Nullable
      class="kw">protected String next = null;

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

      @Nonnull
      class="kw">public Fork build(@Nonnull StageId var1) {
         Fork var2 = new Fork();
         var2.actions = this.actions;
         var2.conditions = new EventCondition[this.conditions.length];

         for (int var3 = 0; var3 < this.conditions.length; var3++) {
            var2.conditions[var3] = this.conditions[var3].create();
         }

         if (this.next != null) {
            StageAsset var4 = StageAsset.ASSET_MAP.getAsset(this.next);
            if (var4 != null) {
               var2.next = var4.build(var1);
            }
         }

         class="kw">return var2;
      }

      class="kw">static {
         StageAsset.FORK_REF_CODEC.set(CODEC);
      }
   }
}