net.minecraftforge.client.model.ICustomModelLoader Java Examples
The following examples show how to use
net.minecraftforge.client.model.ICustomModelLoader.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DynamicModelProvider.java From VanillaFix with MIT License | 4 votes |
public DynamicModelProvider(Set<ICustomModelLoader> loaders) { this.loaders = loaders; }
Example #2
Source File: MixinModelManager.java From VanillaFix with MIT License | 4 votes |
/** * @reason Don't set up the ModelLoader. Instead, set up the caching DynamicModelProvider * and DynamicBakedModelProviders, which will act as the model registry. */ @Overwrite public void onResourceManagerReload(IResourceManager resourceManager) { // Generate information about model locations, such as the blockstate location to block map // and the item variant to model location map. ModelLocationInformation.init(modelProvider.getBlockStateMapper()); // Get custom loaders Set<ICustomModelLoader> loaders; try { Field loadersField = ModelLoaderRegistry.class.getDeclaredField("loaders"); loadersField.setAccessible(true); // noinspection unchecked loaders = (Set<ICustomModelLoader>) loadersField.get(null); } catch (ReflectiveOperationException e) { throw new RuntimeException(e); } // Create the dynamic model and bake model providers DynamicModelProvider dynamicModelProvider = new DynamicModelProvider(loaders); DynamicModelProvider.instance = dynamicModelProvider; DynamicBakedModelProvider dynamicBakedModelProvider = new DynamicBakedModelProvider(dynamicModelProvider); DynamicBakedModelProvider.instance = dynamicBakedModelProvider; modelRegistry = dynamicBakedModelProvider; // Create the texture map ((DynamicTextureMap) texMap).init(); // Get the default model, returned by getModel when the model provider returns null defaultModel = modelRegistry.getObject(new ModelResourceLocation("builtin/missing", "missing")); // Register the universal bucket item if (FluidRegistry.isUniversalBucketEnabled()) { ModelLoader.setBucketModelDefinition(ForgeModContainer.getInstance().universalBucket); } // Post the event, but just log an error if a listener throws an exception. The ModelLoader is // null, but very few mods use it. Custom support will be needed for those that do. EventUtil.postEventAllowingErrors(new ModelBakeEvent((ModelManager) (Object) this, modelRegistry, null)); // Make the model provider load blockstate to model information. See MixinBlockModelShapes modelProvider.reloadModels(); }