use of net.minecraftforge.client.model.ModelLoader in project AgriCraft by AgriCraft.
the class ModelAndTextureHandler method onModelLoadEvent.
// Used to add the models used in seed rendering
@SubscribeEvent
@SuppressWarnings("unused")
public void onModelLoadEvent(ModelRegistryEvent event) {
// Jsons
AgriCore.getPlants().getAllElements().stream().map(AgriPlant::getSeedModel).map(this::toResourceLocation).forEach(ModelLoader::addSpecialModel);
// no plant instance
ModelLoader.addSpecialModel(NoPlant.getInstance().getSeedModel());
// seed bag models
ModelLoader.addSpecialModel(new ResourceLocation(AgriCraft.instance.getModId(), "item/agri_seed_bag_empty"));
ModelLoader.addSpecialModel(new ResourceLocation(AgriCraft.instance.getModId(), "item/agri_seed_bag_partial"));
ModelLoader.addSpecialModel(new ResourceLocation(AgriCraft.instance.getModId(), "item/agri_seed_bag_full"));
// channel valve hand Wheel
ModelLoader.addSpecialModel(TileEntityIrrigationChannelRenderer.MODEL_HANDWHEEL);
}
use of net.minecraftforge.client.model.ModelLoader in project AgriCraft by AgriCraft.
the class AgriPlantQuadGenerator method fetchQuads.
@SuppressWarnings("deprecation")
public List<BakedQuad> fetchQuads(@Nonnull ResourceLocation location) {
ModelLoader loader = ModelLoader.instance();
if (loader == null) {
return ImmutableList.of();
}
IBakedModel model = loader.getBakedModel(location, ModelRotation.X0_Y0, this::getSprite);
return model == null ? ImmutableList.of() : model.getQuads(null, null, this.getRandom());
}
use of net.minecraftforge.client.model.ModelLoader in project BiomesOPlenty by Glitchfiend.
the class LeavesModelEventHandler method onModelBake.
@SubscribeEvent
public void onModelBake(ModelBakeEvent event) throws Exception {
ModelLoader loader = event.getModelLoader();
IRegistry<ModelResourceLocation, IBakedModel> registry = event.getModelRegistry();
IBakedModel originalBakedModel = registry.getObject(LEAVES_LOC);
// Load and bake the fast flowering leaves model
IModel fastModel = ModelLoaderRegistry.getModel(new ResourceLocation("biomesoplenty:block/flowering_leaves_fast"));
IBakedModel bakedFastModel = fastModel.bake(fastModel.getDefaultState(), DefaultVertexFormats.BLOCK, ModelLoader.defaultTextureGetter());
registry.putObject(LEAVES_LOC, new ModelLeaves(originalBakedModel, bakedFastModel));
}
Aggregations