當前位置: 首頁>>代碼示例>>Java>>正文


Java ModelLoaderRegistry.getMissingModel方法代碼示例

本文整理匯總了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();
	}
}
 
開發者ID:hea3ven,項目名稱:CommonUtils,代碼行數:17,代碼來源:ModelBakerBase.java

示例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);
}
 
開發者ID:TheCBProject,項目名稱:CodeChickenLib,代碼行數:18,代碼來源:CCFinalMultiVariant.java

示例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;
}
 
開發者ID:maruohon,項目名稱:enderutilities,代碼行數:27,代碼來源:ModelCamouflageBlock.java

示例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));
}
 
開發者ID:OpenMods,項目名稱:OpenModsLib,代碼行數:22,代碼來源:VariantModel.java

示例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));
}
 
開發者ID:OpenMods,項目名稱:OpenModsLib,代碼行數:21,代碼來源:MultiLayerModel.java

示例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);
}
 
開發者ID:OpenMods,項目名稱:OpenModsLib,代碼行數:23,代碼來源:ItemStateModel.java

示例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));
}
 
開發者ID:OpenMods,項目名稱:OpenModsLib,代碼行數:20,代碼來源:PerspectiveAwareModel.java

示例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;
}
 
開發者ID:TheCBProject,項目名稱:CodeChickenLib,代碼行數:12,代碼來源:CCFinalVariant.java

示例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);
}
 
開發者ID:tom5454,項目名稱:Toms-Mod,代碼行數:16,代碼來源:TomsModUtils.java

示例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);
}
 
開發者ID:tom5454,項目名稱:Toms-Mod,代碼行數:16,代碼來源:TomsModUtils.java

示例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;
}
 
開發者ID:BubbleTrouble14,項目名稱:ARKCraft,代碼行數:8,代碼來源:ARKCustomModelLoader.java

示例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);
    }
}
 
開發者ID:purpleposeidon,項目名稱:Factorization,代碼行數:31,代碼來源:FzModel.java

示例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();
}
 
開發者ID:maruohon,項目名稱:enderutilities,代碼行數:36,代碼來源:ModelCamouflageBlock.java

示例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;
}
 
開發者ID:Aroma1997,項目名稱:BetterChests,代碼行數:12,代碼來源:ModelPortableBarrel.java

示例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();
	}
}
 
開發者ID:OpenMods,項目名稱:OpenBlocks,代碼行數:8,代碼來源:DevNullModel.java


注:本文中的net.minecraftforge.client.model.ModelLoaderRegistry.getMissingModel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。