ModifyEvent interface

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

Файл: com/hypixel/hytale/builtin/worldgen/modifier/event/ModifyEvent.java

extends: IEvent<Content.Type>

Поля (2)

МодификаторыТипИмя
private int id
private final SeedString<K> seed

Методы (4)

МодификаторыВозвратСигнатура
public SeedGeneratorpublic SeedGenerator(@Nonnull SeedString<K> var1)
abstract T loadT load(@Nonnull String var1)
public SeedString<K> nextpublic SeedString<K> next()
abstract SeedString<SeedStringResource> seedSeedString<SeedStringResource> seed()

Исходный код

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

class="kw">import com.hypixel.hytale.builtin.worldgen.modifier.content.Content;
class="kw">import com.hypixel.hytale.event.IEvent;
class="kw">import com.hypixel.hytale.procedurallib.json.SeedString;
class="kw">import com.hypixel.hytale.server.core.HytaleServer;
class="kw">import com.hypixel.hytale.server.worldgen.SeedStringResource;
class="kw">import com.hypixel.hytale.server.worldgen.loader.context.FileContext;
class="kw">import java.util.List;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;

class="kw">public class="kw">interface ModifyEvent<T> class="kw">extends IEvent<Content.Type> {
   SeedString<SeedStringResource> seed();

   @Nonnull
   Content.Type type();

   @Nonnull
   FileContext<?> file();

   @Nonnull
   List<T> entries();

   @Nonnull
   ModifyEvent.ContentLoader<T> loader();

   class="kw">static <E class="kw">extends ModifyEvent<?>> void dispatch(@Nonnull Class<E> var0, @Nonnull E var1) class="kw">throws Error {
      try {
         HytaleServer.get().getEventBus().dispatchFor(var0, var1.type()).dispatch(var1);
      } catch (Throwable var3) {
         throw new Error(String.format("Failed to invoke ModifyEvent %s for file %s", var1.type(), var1.file().getContentPath()), var3);
      }
   }

   @FunctionalInterface
   class="kw">interface ContentLoader<T> {
      @Nullable
      T load(@Nonnull String var1) class="kw">throws Exception;
   }

   class SeedGenerator<K class="kw">extends SeedStringResource> {
      class="kw">private class="kw">final SeedString<K> seed;
      class="kw">private int id = 0;

      class="kw">public SeedGenerator(@Nonnull SeedString<K> var1) {
         this.seed = var1;
      }

      class="kw">public SeedString<K> next() {
         class="kw">return this.seed.append("-modified-" + this.id++);
      }
   }
}