Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.45 KB | None | 0 0
  1. package melonslise.hextest.client.model;
  2.  
  3. import melonslise.hextest.HexTestCore;
  4. import net.minecraft.client.renderer.block.model.ModelBlockDefinition;
  5. import net.minecraft.client.renderer.block.model.ModelResourceLocation;
  6. import net.minecraft.client.renderer.block.model.VariantList;
  7. import net.minecraft.client.resources.IResourceManager;
  8. import net.minecraft.util.ResourceLocation;
  9. import net.minecraftforge.client.model.ICustomModelLoader;
  10. import net.minecraftforge.client.model.IModel;
  11. import net.minecraftforge.fml.relauncher.ReflectionHelper;
  12.  
  13. public class ModelLoaderConnected implements ICustomModelLoader
  14. {
  15.     public static final String PATH = "models/block/connected/";
  16.  
  17.     private static final ICustomModelLoader VANILLA_LOADER;
  18.     static
  19.     {
  20.         try
  21.         {
  22.             Class cls = Class.forName("net.minecraftforge.client.model.ModelLoader$VanillaLoader");
  23.             VANILLA_LOADER = (ICustomModelLoader) ReflectionHelper.getPrivateValue(cls, null, "INSTANCE");
  24.         }
  25.         catch (ClassNotFoundException e)
  26.         {
  27.             throw new RuntimeException(e);
  28.         }
  29.     }
  30.  
  31.     @Override
  32.     public boolean accepts(ResourceLocation location)
  33.     {
  34.         return location.getResourceDomain().equals(HexTestCore.ID) && location.getResourcePath().startsWith(PATH);
  35.     }
  36.  
  37.     @Override
  38.     public IModel loadModel(ResourceLocation location) throws Exception
  39.     {
  40.         return new ModelConnected(VANILLA_LOADER.loadModel(location));
  41.     }
  42.  
  43.     @Override
  44.     public void onResourceManagerReload(IResourceManager manager) {}
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement