Java Code Examples for net.minecraftforge.client.model.ModelLoaderRegistry#getModelOrLogError()

The following examples show how to use net.minecraftforge.client.model.ModelLoaderRegistry#getModelOrLogError() . 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: VariantModel.java    From OpenModsLib with MIT License 6 votes vote down vote up
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
	final Map<ResourceLocation, IBakedModel> bakedSubModels = Maps.newHashMap();

	for (ResourceLocation subModel : modelData.getAllModels()) {
		IModel model = ModelLoaderRegistry.getModelOrLogError(subModel, "Couldn't load sub-model dependency: " + subModel);
		bakedSubModels.put(subModel, model.bake(new ModelStateComposition(state, model.getDefaultState()), format, bakedTextureGetter));
	}

	final IModel baseModel;
	if (base.isPresent()) {
		ResourceLocation baseLocation = base.get();
		baseModel = ModelLoaderRegistry.getModelOrLogError(baseLocation, "Couldn't load base-model dependency: " + baseLocation);
	} else {
		baseModel = ModelLoaderRegistry.getMissingModel();
	}

	final IBakedModel bakedBaseModel = baseModel.bake(new ModelStateComposition(state, baseModel.getDefaultState()), format, bakedTextureGetter);

	return new BakedModel(bakedBaseModel, modelData, bakedSubModels, PerspectiveMapWrapper.getTransforms(state));
}
 
Example 2
Source File: EvalModelBase.java    From OpenModsLib with MIT License 5 votes vote down vote up
protected IModel loadBaseModel(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
	if (baseModel.isPresent()) {
		return ModelLoaderRegistry.getModelOrLogError(baseModel.get(), "Couldn't load eval model dependency: " + baseModel.get());
	} else {
		return ModelLoaderRegistry.getMissingModel();
	}
}
 
Example 3
Source File: TexturedItemOverrides.java    From OpenModsLib with MIT License 5 votes vote down vote up
private IModel getOverrideModel(Optional<ResourceLocation> overrideLocation) {
	if (overrideLocation.isPresent()) {
		final ResourceLocation location = overrideLocation.get();
		return ModelLoaderRegistry.getModelOrLogError(location, "Couldn't load model: " + location);
	} else {
		return texturedModel;
	}
}
 
Example 4
Source File: TexturedItemModel.java    From OpenModsLib with MIT License 5 votes vote down vote up
private static IModel getModel(Optional<ResourceLocation> model) {
	if (model.isPresent()) {
		ResourceLocation location = model.get();
		return ModelLoaderRegistry.getModelOrLogError(location, "Couldn't load base-model dependency: " + location);
	} else {
		return ModelLoaderRegistry.getMissingModel();
	}
}
 
Example 5
Source File: ModelWithDependencies.java    From OpenModsLib with MIT License 5 votes vote down vote up
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
	final IModel model;
	if (base.isPresent()) {
		model = ModelLoaderRegistry.getModelOrLogError(base.get(), "Couldn't load MultiLayerModel dependency: " + base.get());
	} else {
		model = ModelLoaderRegistry.getMissingModel();
	}

	return model.bake(state, format, bakedTextureGetter);
}
 
Example 6
Source File: MultiLayerModel.java    From OpenModsLib with MIT License 4 votes vote down vote up
private static IBakedModel bakeModel(ResourceLocation model, IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
	IModel baseModel = ModelLoaderRegistry.getModelOrLogError(model, "Couldn't load MultiLayerModel dependency: " + model);
	return baseModel.bake(new ModelStateComposition(state, baseModel.getDefaultState()), format, bakedTextureGetter);
}
 
Example 7
Source File: ItemStateModel.java    From OpenModsLib with MIT License 4 votes vote down vote up
private static IModel getModel(ResourceLocation model) {
	return ModelLoaderRegistry.getModelOrLogError(model, "Couldn't load model dependency: " + model);
}
 
Example 8
Source File: PerspectiveAwareModel.java    From OpenModsLib with MIT License 4 votes vote down vote up
private static IBakedModel bakeModel(ResourceLocation model, IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
	IModel baseModel = ModelLoaderRegistry.getModelOrLogError(model, "Couldn't load MultiLayerModel dependency: " + model);
	return baseModel.bake(new ModelStateComposition(state, baseModel.getDefaultState()), format, bakedTextureGetter);
}