本文整理匯總了Java中net.minecraftforge.client.model.ModelLoaderRegistry.getMissingModel方法的典型用法代碼示例。如果您正苦於以下問題:Java ModelLoaderRegistry.getMissingModel方法的具體用法?Java ModelLoaderRegistry.getMissingModel怎麽用?Java ModelLoaderRegistry.getMissingModel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraftforge.client.model.ModelLoaderRegistry
的用法示例。
在下文中一共展示了ModelLoaderRegistry.getMissingModel方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getModel
import net.minecraftforge.client.model.ModelLoaderRegistry; //導入方法依賴的package包/類
protected IModel getModel(ResourceLocation modelLoc, ResourceLocation fallback) {
try {
return ModelLoaderRegistry.getModel(modelLoc);
} catch (Exception e) {
if (fallback != null) {
try {
return ModelLoaderRegistry.getModel(fallback);
} catch (Exception e2) {
logger.warn("Could not find model {} or fallback {}", modelLoc, fallback);
return ModelLoaderRegistry.getMissingModel();
}
}
logger.warn("Could not find model {}", modelLoc);
return ModelLoaderRegistry.getMissingModel();
}
}
示例2: process
import net.minecraftforge.client.model.ModelLoaderRegistry; //導入方法依賴的package包/類
@Override
public IModel process(IModel base) {
boolean hasBase = base != ModelLoaderRegistry.getMissingModel();
if (hasBase) {
base = baseVariant.process(base);
}
List<IModel> subModels = new LinkedList<>();
for (Variant variant : finalVariants) {
if (!variant.getModelLocation().equals(new ResourceLocation("builtin/missing"))) {
IModel subModel = ModelLoaderRegistry.getModelOrLogError(variant.getModelLocation(), "Unable to load subModel's Model: " + variant.getModelLocation());
subModels.add(variant.process(new StateOverrideIModel(subModel, variant.getState())));
}
}
return new CCMultiModel(hasBase ? base : null, baseProperties, subModels);
}
示例3: ModelCamouflageBlockBase
import net.minecraftforge.client.model.ModelLoaderRegistry; //導入方法依賴的package包/類
protected ModelCamouflageBlockBase(ResourceLocation baseModelLocation, @Nullable ResourceLocation overlayModelLocation)
{
this.baseModelLocation = baseModelLocation;
this.overlayModelLocation = overlayModelLocation;
this.textures = ImmutableMap.of();
IModel baseModel = ModelLoaderRegistry.getMissingModel();
IModel overlayModel = null;
try
{
baseModel = ModelLoaderRegistry.getModel(this.baseModelLocation);
if (this.overlayModelLocation != null)
{
overlayModel = ModelLoaderRegistry.getModel(this.overlayModelLocation);
}
}
catch (Exception e)
{
EnderUtilities.logger.warn("Failed to load a model for a camouflage block", e);
}
this.baseModel = baseModel;
this.overlayModel = overlayModel;
}
示例4: bake
import net.minecraftforge.client.model.ModelLoaderRegistry; //導入方法依賴的package包/類
@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));
}
示例5: bake
import net.minecraftforge.client.model.ModelLoaderRegistry; //導入方法依賴的package包/類
@Override
public IBakedModel bake(final IModelState state, final VertexFormat format, final Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
final Map<BlockRenderLayer, IBakedModel> bakedModels = Maps.transformValues(models, location -> bakeModel(location, state, format, bakedTextureGetter));
IModel missing = ModelLoaderRegistry.getMissingModel();
IBakedModel bakedMissing = missing.bake(missing.getDefaultState(), format, bakedTextureGetter);
final IBakedModel bakedBase;
if (base.isPresent()) {
bakedBase = bakeModel(base.get(), state, format, bakedTextureGetter);
} else {
bakedBase = bakedMissing;
}
return new MultiLayerBakedModel(
bakedModels,
bakedBase,
bakedMissing,
PerspectiveMapWrapper.getTransforms(state));
}
示例6: bake
import net.minecraftforge.client.model.ModelLoaderRegistry; //導入方法依賴的package包/類
@Override
public IBakedModel bake(IModelState state, final VertexFormat format, final Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
final IModel defaultModel;
if (this.defaultModel.isPresent()) {
defaultModel = getModel(this.defaultModel.get());
} else if (!this.stateModels.isEmpty()) {
final ResourceLocation first = this.stateModels.values().iterator().next();
defaultModel = getModel(first);
} else {
defaultModel = ModelLoaderRegistry.getMissingModel();
}
final IBakedModel bakedDefaultModel = defaultModel.bake(defaultModel.getDefaultState(), format, bakedTextureGetter);
final Map<State, IBakedModel> bakedStateModels = Maps.transformValues(stateModels, input -> {
final IModel model = getModel(input);
return model.bake(model.getDefaultState(), format, bakedTextureGetter);
});
return new ItemStateOverrideList(bakedStateModels).wrapModel(bakedDefaultModel);
}
示例7: bake
import net.minecraftforge.client.model.ModelLoaderRegistry; //導入方法依賴的package包/類
@Override
public IBakedModel bake(final IModelState state, final VertexFormat format, final Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
final Map<TransformType, IBakedModel> bakedModels = Maps.transformValues(models, location -> bakeModel(location, state, format, bakedTextureGetter));
IModel missing = ModelLoaderRegistry.getMissingModel();
IBakedModel bakedMissing = missing.bake(missing.getDefaultState(), format, bakedTextureGetter);
final IBakedModel bakedBase;
if (base.isPresent()) {
bakedBase = bakeModel(base.get(), state, format, bakedTextureGetter);
} else {
bakedBase = bakedMissing;
}
return new PerspectiveAwareBakedModel(
bakedModels,
bakedBase,
PerspectiveMapWrapper.getTransforms(state));
}
示例8: process
import net.minecraftforge.client.model.ModelLoaderRegistry; //導入方法依賴的package包/類
@Override
public IModel process(IModel base) {
boolean hasBase = base != ModelLoaderRegistry.getMissingModel();
if (hasBase) {
base = base.retexture(textures).smoothLighting(smooth).gui3d(gui3d).uvlock(isUvLock()).process(customData);
}
return base;
}
示例9: getModelOBJ
import net.minecraftforge.client.model.ModelLoaderRegistry; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
public static IModel getModelOBJ(ResourceLocation loc) {
if (!EventHandlerClient.models.containsKey(loc)) {
IModel model = null;
try {
model = OBJLoader.INSTANCE.loadModel(loc);
} catch (Exception e) {
e.printStackTrace();
}
if (model == null)
model = ModelLoaderRegistry.getMissingModel();
EventHandlerClient.models.put(loc, model);
}
return EventHandlerClient.models.get(loc);
}
示例10: getModelJSON
import net.minecraftforge.client.model.ModelLoaderRegistry; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
public static IModel getModelJSON(ResourceLocation loc) {
if (!EventHandlerClient.models.containsKey(loc)) {
IModel model = null;
try {
model = ModelLoaderRegistry.getModel(loc);
} catch (Exception e) {
e.printStackTrace();
}
if (model == null)
model = ModelLoaderRegistry.getMissingModel();
EventHandlerClient.models.put(loc, model);
}
return EventHandlerClient.models.get(loc);
}
示例11: loadModel
import net.minecraftforge.client.model.ModelLoaderRegistry; //導入方法依賴的package包/類
@Override
public IModel loadModel(ResourceLocation modelLocation) throws Exception {
IModel model = modelMap.get(modelLocation);
if(model == null)model = modelMap.get(new ResourceLocation(modelLocation.getResourceDomain(), modelLocation.getResourcePath()));
if(model == null)model = ModelLoaderRegistry.getMissingModel();
return model;
}
示例12: loadModels
import net.minecraftforge.client.model.ModelLoaderRegistry; //導入方法依賴的package包/類
@SubscribeEvent
public void loadModels(TextureStitchEvent.Pre event) {
raws.clear();
//event.modelBakery.reg
Minecraft mc = Minecraft.getMinecraft();
IResourceManager irm = mc.getResourceManager();
HashSet<ResourceLocation> textures = new HashSet<ResourceLocation>();
for (FzModel fzm : instances) {
fzm.model = null;
ResourceLocation location = fzm.getLocation(irm);
IModel rawModel = null;
try {
if (location != null) {
rawModel = ModelLoaderRegistry.getModel(location);
}
} catch (IOException e) {
e.printStackTrace();
}
if (rawModel == null) {
rawModel = ModelLoaderRegistry.getMissingModel();
}
raws.put(fzm, rawModel);
Collection<ResourceLocation> modelTextures = rawModel.getTextures();
textures.addAll(modelTextures);
}
for (ResourceLocation texture : textures) {
event.map.registerSprite(texture);
}
}
示例13: loadModel
import net.minecraftforge.client.model.ModelLoaderRegistry; //導入方法依賴的package包/類
@Override
public IModel loadModel(ResourceLocation modelLocation) throws Exception
{
if (modelLocation.equals(LOC_ELEVATOR_NORMAL))
{
return new ModelElevator(EnderUtilitiesBlocks.ELEVATOR.getDefaultState(), "_full");
}
else if (modelLocation.equals(LOC_ELEVATOR_SLAB_TOP))
{
return new ModelElevator(EnderUtilitiesBlocks.ELEVATOR_SLAB.getDefaultState(), "_slab_top");
}
else if (modelLocation.equals(LOC_ELEVATOR_SLAB_BOTTOM))
{
return new ModelElevator(EnderUtilitiesBlocks.ELEVATOR_SLAB.getDefaultState(), "_slab_bottom");
}
else if (modelLocation.equals(LOC_ELEVATOR_LAYER_TOP))
{
return new ModelElevator(EnderUtilitiesBlocks.ELEVATOR_LAYER.getDefaultState(), "_layer_top");
}
else if (modelLocation.equals(LOC_ELEVATOR_LAYER_BOTTOM))
{
return new ModelElevator(EnderUtilitiesBlocks.ELEVATOR_LAYER.getDefaultState(), "_layer_bottom");
}
else if (modelLocation.equals(LOC_PORTAL_FRAME))
{
return new ModelCamouflageBlockBase(new ResourceLocation("minecraft:block/cube_all"), null);
}
else if (modelLocation.equals(LOC_DRAW_BRIDGE_N) || modelLocation.equals(LOC_DRAW_BRIDGE_A))
{
ResourceLocation baseModelLocation = new ResourceLocation(Reference.MOD_ID, "block/orientable_directional_individual");
return new ModelCamouflageBlockBase(baseModelLocation, null);
}
return ModelLoaderRegistry.getMissingModel();
}
示例14: bake
import net.minecraftforge.client.model.ModelLoaderRegistry; //導入方法依賴的package包/類
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
try {
parentModel = ModelLoaderRegistry.getModel(PARENT_RL);
} catch (Exception e) {
e.printStackTrace();
parentModel = ModelLoaderRegistry.getMissingModel();
}
parent = parentModel.bake(state, format, bakedTextureGetter);
return this;
}
示例15: getModel
import net.minecraftforge.client.model.ModelLoaderRegistry; //導入方法依賴的package包/類
private static IModel getModel(Optional<ResourceLocation> location) {
if (location.isPresent()) {
return ModelLoaderRegistry.getModelOrLogError(location.get(), "Couldn't load dependency: " + location.get());
} else {
return ModelLoaderRegistry.getMissingModel();
}
}