Class CustomTextureService

java.lang.Object
io.github.thebusybiscuit.slimefun4.core.services.CustomTextureService

public class CustomTextureService extends Object
This Service is responsible for applying custom model data to any SlimefunItemStack if a Server Owner configured Slimefun to use those. We simply use ItemMeta.setCustomModelData(Integer) for this.
Author:
TheBusyBiscuit
  • Constructor Details

    • CustomTextureService

      public CustomTextureService(@Nonnull io.github.bakedlibs.dough.config.Config config)
      This creates a new CustomTextureService for the provided Config
      Parameters:
      config - The Config to read custom model data from
  • Method Details

    • register

      public void register(@Nonnull Collection<SlimefunItem> items, boolean save)
      This method registers the given SlimefunItems to this CustomTextureService. If saving is enabled, it will save them to the Config file.
      Parameters:
      items - The SlimefunItems to register
      save - Whether to save this file
    • getVersion

      @Nullable public String getVersion()
    • isActive

      public boolean isActive()
      This returns true if any custom model data was configured. If every item id has no configured custom model data, it will return false.
      Returns:
      Whether any custom model data was configured
    • getModelData

      public int getModelData(@Nonnull String id)
      This returns the configured custom model data for a given id.
      Parameters:
      id - The id to get the data for
      Returns:
      The configured custom model data
    • setTexture

      public void setTexture(@Nonnull ItemStack item, @Nonnull String id)
      This method sets the custom model data for this ItemStack to the value configured for the provided item id.
      Parameters:
      item - The ItemStack to set the custom model data for
      id - The id for which to get the configured model data
    • setTexture

      public void setTexture(@Nonnull ItemMeta im, @Nonnull String id)
      This method sets the custom model data for this ItemMeta to the value configured for the provided item id.
      Parameters:
      im - The ItemMeta to set the custom model data for
      id - The id for which to get the configured model data