Class BuilderManager

java.lang.Object
com.hypixel.hytale.server.npc.asset.builder.BuilderManager

public class BuilderManager extends Object
Created with IntelliJ IDEA. User: Jon Date: 6/13/2017 Time: 9:31 PM
  • Field Details

  • Constructor Details

    • BuilderManager

      public BuilderManager()
  • Method Details

    • registerFactory

      public <T> void registerFactory(@Nonnull BuilderFactory<T> factory)
    • addCategory

      public void addCategory(String name, Class<?> clazz)
    • registerAssetPath

      public void registerAssetPath(@Nonnull String path, @Nonnull String label)
      Registers an additional asset directory (relative to the pack root) to scan for top-level builder files, in addition to the default NPC roles directory. The label names the directory in the per-directory load summary. Files in it declare their category via the "Class" key. Must be called before assets load (e.g. from a plugin's setup()).
    • addBuilderReloadListener

      public void addBuilderReloadListener(@Nonnull Consumer<BuilderInfo> listener)
      Registers a listener invoked when any builder is hot-reloaded (after the built-in Role-reload handling). Used by other categories to rebuild their live entities against the reloaded builder.
    • getCategoryName

      public String getCategoryName(@Nonnull Class<?> factoryClass)
    • getIndex

      public int getIndex(@Nullable String name)
    • setAutoReload

      public void setAutoReload(boolean autoReload)
    • lookupName

      @Nullable public String lookupName(int index)
    • getOrCreateIndex

      public int getOrCreateIndex(String name)
    • tryGetBuilderInfo

      @Nullable public BuilderInfo tryGetBuilderInfo(int builderIndex)
    • unloadBuilders

      public void unloadBuilders(AssetPack pack)
    • loadBuilders

      public boolean loadBuilders(@Nonnull AssetPack pack, boolean includeTests)
    • assetEditorLoadFile

      public void assetEditorLoadFile(@Nonnull Path fileName)
    • assetEditorRemoveFile

      public void assetEditorRemoveFile(@Nonnull Path filePath)
    • loadFile

      public int loadFile(@Nonnull Path fileName, boolean reloading, @Nonnull List<String> errors)
    • loadFile

      public int loadFile(@Nonnull Path fileName, @Nonnull List<String> errors, @Nullable it.unimi.dsi.fastutil.objects.Object2IntMap<String> typeCounter, boolean includeTests, boolean reloading)
    • validateBuilder

      public boolean validateBuilder(@Nonnull BuilderInfo builderInfo)
    • getFactory

      @Nonnull public <T> BuilderFactory<T> getFactory(@Nonnull Class<?> clazz)
    • getCachedBuilderInfo

      @Nonnull public BuilderInfo getCachedBuilderInfo(int index, @Nonnull Class<?> classType)
    • tryGetCachedValidBuilder

      @Nullable public <T> Builder<T> tryGetCachedValidBuilder(int index, @Nonnull Class<?> classType)
    • getCachedBuilder

      public <T> Builder<T> getCachedBuilder(int index, @Nonnull Class<?> classType)
    • isEmpty

      public boolean isEmpty()
    • getAllBuilders

      @Nonnull public it.unimi.dsi.fastutil.ints.Int2ObjectMap<BuilderInfo> getAllBuilders()
    • collectMatchingBuilders

      public <T extends Collection<?>> T collectMatchingBuilders(T collection, @Nonnull Predicate<BuilderInfo> filter, @Nonnull BiConsumer<BuilderInfo, T> consumer)
    • getNameToIndexMap

      @Nonnull public it.unimi.dsi.fastutil.objects.Object2IntMap<String> getNameToIndexMap()
      Fetches an unmodifiable version of the role name to index map. Note that this can include filler keywords (such as $player and $self) which do not map to valid builders Will always return empty if the first load has not been completed
      Returns:
      an unmodifiable version of the role name to index map
    • findMatchingBuilder

      @Nullable public <T> BuilderInfo findMatchingBuilder(@Nonnull BiPredicate<BuilderInfo, T> filter, T t)
    • getBuilderInfo

      @Nullable public BuilderInfo getBuilderInfo(Builder<?> builder)
    • getTemplateNames

      public List<String> getTemplateNames()
    • forceValidation

      public void forceValidation(int builderIndex)
    • checkIfDeprecated

      public void checkIfDeprecated(@Nonnull Builder<?> builder, @Nonnull BuilderFactory<?> builderFactory, @Nonnull com.google.gson.JsonElement element, String fileName, String context)
    • generateSchema

      @Nonnull public Schema generateSchema(@Nonnull SchemaContext context)
    • generateSchema

      @Nonnull public Schema generateSchema(@Nonnull SchemaContext context, @Nonnull Class<?> rootCategory)
    • generateDescriptors

      @Nonnull public List<BuilderDescriptor> generateDescriptors()
    • saveDescriptors

      public static void saveDescriptors(List<BuilderDescriptor> builderDescriptors, @Nonnull Path fileName)
    • tryGetCachedValidRole

      @Nullable public Builder<Role> tryGetCachedValidRole(int builderIndex)
    • validateAllLoadedBuilders

      public void validateAllLoadedBuilders(@Nonnull it.unimi.dsi.fastutil.ints.Int2ObjectMap<BuilderInfo> loadedBuilders, boolean validateDependents, @Nonnull List<String> errors)
    • onAllBuildersLoaded

      public void onAllBuildersLoaded(@Nonnull it.unimi.dsi.fastutil.ints.Int2ObjectMap<BuilderInfo> loadedBuilders)
    • onBuilderReloaded

      public static void onBuilderReloaded(@Nonnull BuilderInfo builderInfo)
    • getPlayerGroupID

      public static int getPlayerGroupID()
    • getSelfGroupID

      public static int getSelfGroupID()