Class ObjLoader

java.lang.Object
net.neoforged.neoforge.client.model.obj.ObjLoader
All Implemented Interfaces:
net.minecraft.server.packs.resources.PreparableReloadListener, net.minecraft.server.packs.resources.ResourceManagerReloadListener, UnbakedModelLoader<ObjModel>

public class ObjLoader extends Object implements UnbakedModelLoader<ObjModel>, net.minecraft.server.packs.resources.ResourceManagerReloadListener
A loader for OBJ models.

Allows the user to enable automatic face culling, toggle quad shading, flip UVs, render emissively and specify a material library override.

  • Field Details

    • INSTANCE

      public static ObjLoader INSTANCE
    • geometryCache

      private final Map<ObjGeometry.Settings,ObjGeometry> geometryCache
    • materialCache

      private final Map<net.minecraft.resources.ResourceLocation,ObjMaterialLibrary> materialCache
    • manager

      private final net.minecraft.server.packs.resources.ResourceManager manager
  • Constructor Details

    • ObjLoader

      public ObjLoader()
  • Method Details

    • onResourceManagerReload

      public void onResourceManagerReload(net.minecraft.server.packs.resources.ResourceManager resourceManager)
      Specified by:
      onResourceManagerReload in interface net.minecraft.server.packs.resources.ResourceManagerReloadListener
    • read

      public ObjModel read(com.google.gson.JsonObject jsonObject, com.google.gson.JsonDeserializationContext jsonDeserializationContext) throws com.google.gson.JsonParseException
      Description copied from interface: UnbakedModelLoader
      Reads an unbaked model from the passed JSON object.

      The JsonDeserializationContext argument can be used to deserialize types that the system already understands. For example, deserializationContext.deserialize(<sub object>, Transformation.class) to parse a transformation, or deserializationContext.deserialize(<sub object>, UnbakedModel.class) to parse a nested model. The set of supported types can be found in the declaration of BlockModel.GSON.

      Specified by:
      read in interface UnbakedModelLoader<ObjModel>
      Throws:
      com.google.gson.JsonParseException
    • loadGeometry

      public ObjGeometry loadGeometry(ObjGeometry.Settings settings)
    • loadMaterialLibrary

      public ObjMaterialLibrary loadMaterialLibrary(net.minecraft.resources.ResourceLocation materialLocation)