Class CCGuiTextures

java.lang.Object
codechicken.lib.gui.modular.sprite.CCGuiTextures

public class CCGuiTextures extends Object
Gui texture handler implementation. This sets up a custom atlas that will be populated with all textures in "modid:textures/gui/" To use your own textures you can just create a carbon copy of this class with that uses your own modid.

Created by brandon3055 on 21/10/2023

  • Constructor Details

    • CCGuiTextures

      public CCGuiTextures()
  • Method Details

    • getAtlasHolder

      public static ModAtlasHolder getAtlasHolder()
      The returned AtlasLoader needs to be registered as a resource reload listener using the appropriate NeoForge / Fabric event.
    • get

      public static Material get(String texture)
      Returns a cached Material for the specified gui texture. Warning: Do not use this if you intend to use the material with multiple render types. The material will cache the first render type it is used with. Instead use getUncached(String)
      Parameters:
      texture - The texture path relative to "modid:gui/"
    • get

      public static Material get(Supplier<String> texture)
    • getter

      public static Supplier<Material> getter(Supplier<String> texture)
    • getUncached

      public static Material getUncached(String texture)
      Use this to retrieve a new uncached material for the specified gui texture. Feel free to hold onto the returned material. Storing it somewhere is more efficient than recreating it every render frame.
      Parameters:
      texture - The texture path relative to "modid:gui/"
      Returns:
      A new Material for the specified gui texture.