当前位置: 首页>>代码示例>>Java>>正文


Java IModel.bake方法代码示例

本文整理汇总了Java中net.minecraftforge.client.model.IModel.bake方法的典型用法代码示例。如果您正苦于以下问题:Java IModel.bake方法的具体用法?Java IModel.bake怎么用?Java IModel.bake使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.client.model.IModel的用法示例。


在下文中一共展示了IModel.bake方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bake

import net.minecraftforge.client.model.IModel; //导入方法依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    try
    {
        IModel sub = ModelLoaderRegistry.getModel(handle);
        IBakedModel baked = sub.bake(state, format, bakedTextureGetter);

        return new BakedModelCH(baked, ModelRegistry.getInstance().bake(state, format, bakedTextureGetter));
    } catch (Exception e)
    {
        e.printStackTrace();
    }

    return ModelLoaderRegistry.getMissingModel().bake(state, format, bakedTextureGetter);
}
 
开发者ID:cubex2,项目名称:chesttransporter,代码行数:17,代码来源:ModelCT.java

示例2: handleItemState

import net.minecraftforge.client.model.IModel; //导入方法依赖的package包/类
@Override
@Nonnull
public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack,
		@Nullable World world, @Nullable EntityLivingBase entity) {

	if (stack.getItem() != ModItems.sword) {
		return originalModel;
	}

	BakedSwordModel model = (BakedSwordModel) originalModel;

	String key = IBladeTool.getBladeMat(stack).getName() + "|"
			+ ICrossguardTool.getCrossguardMat(stack).getName() + "|"
			+ IHandleTool.getHandleMat(stack).getName() + "|"
			+ IAdornedTool.getAdornmentMat(stack).getName();

	if (!model.cache.containsKey(key)) {
		ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
		builder.put("blade", IBladeTool.getBladeMat(stack).getName());
		builder.put("crossguard", ICrossguardTool.getCrossguardMat(stack).getName());
		builder.put("handle", IHandleTool.getHandleMat(stack).getName());
		if (IAdornedTool.getAdornmentMat(stack) != ModMaterials.ADORNMENT_NULL) {
			builder.put("adornment", IAdornedTool.getAdornmentMat(stack).getName());
		}
		IModel parent = model.parent.retexture(builder.build());
		Function<ResourceLocation, TextureAtlasSprite> textureGetter;
		textureGetter = new Function<ResourceLocation, TextureAtlasSprite>() {
			public TextureAtlasSprite apply(ResourceLocation location) {
				return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString());
			}
		};
		IBakedModel bakedModel = parent.bake(new SimpleModelState(model.transforms), model.format,
				textureGetter);
		model.cache.put(key, bakedModel);
		return bakedModel;
	}

	return model.cache.get(key);
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:40,代码来源:SwordModel.java

示例3: getBakedCluster

import net.minecraftforge.client.model.IModel; //导入方法依赖的package包/类
public static IBakedModel getBakedCluster(){
	if(bakedCluster == null){
		IModel model;
		try {
			model = OBJLoader.INSTANCE.loadModel(CrystalMod.resourceL("models/block/obj/cluster.obj"));
			Function<ResourceLocation, TextureAtlasSprite> textureGetter;
	        textureGetter = new Function<ResourceLocation, TextureAtlasSprite>()
	        {
	            @Override
				public TextureAtlasSprite apply(ResourceLocation location)
	            {
	                return RenderUtil.getSprite(location);
	            }
	        };
	
	        bakedCluster = model.bake(new SimpleModelState(DynamicBaseModel.DEFAULT_PERSPECTIVE_TRANSFORMS), DefaultVertexFormats.BLOCK, textureGetter);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	return bakedCluster;
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:23,代码来源:RenderTileCrystalCluster.java

示例4: getActualModel

import net.minecraftforge.client.model.IModel; //导入方法依赖的package包/类
protected  IBakedModel getActualModel(String texture)
{
    IBakedModel bakedModel = standard;

    if (texture!=null)
    {
        if (cache.containsKey(texture))
        {
            bakedModel = cache.get(texture);
        }
        else if (retexturableModel != null)
        {
            ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
            builder.put("bottom", texture);
            builder.put("top", texture);
            builder.put("side", texture);
            IModel retexturedModel = retexturableModel.retexture(builder.build());
            bakedModel = retexturedModel.bake(TRSRTransformation.identity(), Attributes.DEFAULT_BAKED_FORMAT, ModelLoader.defaultTextureGetter());
            cache.put(texture, bakedModel);
        }
    }

    return bakedModel;
}
 
开发者ID:M4thG33k,项目名称:TombManyGraves,代码行数:25,代码来源:GoodGraveModel.java

示例5: bake

import net.minecraftforge.client.model.IModel; //导入方法依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format,
                        Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    try
    {
        IModel model = ModelLoaderRegistry.getModel(sourceModel);
        if (model instanceof QBarOBJModel)
        {
            model = ((QBarOBJModel) model).retexture(replacedTextures);

            return model.bake(state, format, bakedTextureGetter);
        }
    } catch (Exception e)
    {
        throw new RuntimeException(e);
    }
    return null;
}
 
开发者ID:OPMCorp,项目名称:Qbar,代码行数:20,代码来源:RetexturedOBJModel.java

示例6: bake

import net.minecraftforge.client.model.IModel; //导入方法依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format,
		Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
	ARKCraft.logger.info("Baking Cable Model");
	ResourceLocation noc = new ResourceLocation("arkcraft:block/cable_noc");
	ResourceLocation center = new ResourceLocation("arkcraft:block/cable_base");
	ResourceLocation connection = new ResourceLocation("arkcraft:block/cable_c");
	ResourceLocation vertical = new ResourceLocation("arkcraft:block/cable_v");
	ResourceLocation centerP = new ResourceLocation("arkcraft:block/cable_base_powered");
	ResourceLocation connectionP = new ResourceLocation("arkcraft:block/cable_c_powered");
	ResourceLocation verticalP = new ResourceLocation("arkcraft:block/cable_v_powered");
	IBakedModel[] connections = new IBakedModel[4];
	IBakedModel[] connectionsP = new IBakedModel[4];
	IModel modelConnection = getModel(connection);
	IModel modelConnectionP = getModel(connectionP);
	for(EnumFacing f : EnumFacing.HORIZONTALS){
		connections[f.ordinal() - 2] = modelConnection.bake(new TRSRTransformation(getMatrix(f)), format, bakedTextureGetter);
		connectionsP[f.ordinal() - 2] = modelConnectionP.bake(new TRSRTransformation(getMatrix(f)), format, bakedTextureGetter);
	}
	return new BakedCableModel(getModel(noc).bake(state, format, bakedTextureGetter),
			new IBakedModel[]{getModel(center).bake(state, format, bakedTextureGetter), getModel(centerP).bake(state, format, bakedTextureGetter)},
			new IBakedModel[][]{connections, connectionsP},
			new IBakedModel[]{getModel(vertical).bake(state, format, bakedTextureGetter), getModel(verticalP).bake(state, format, bakedTextureGetter)});
}
 
开发者ID:BubbleTrouble14,项目名称:ARKCraft,代码行数:25,代码来源:ModelCable.java

示例7: bakeModels

import net.minecraftforge.client.model.IModel; //导入方法依赖的package包/类
@SubscribeEvent
public void bakeModels(TextureStitchEvent.Post event) {
    final TextureMap map = event.map;
    Function<ResourceLocation,TextureAtlasSprite> lookup = new Function<ResourceLocation, TextureAtlasSprite>() {
        @Nullable
        @Override
        public TextureAtlasSprite apply(@Nullable ResourceLocation input) {
            if (input == null) return map.getAtlasSprite(null);
            return map.getAtlasSprite(input.toString());
        }
    };
    for (FzModel fzm : instances) {
        IModel rawModel = raws.get(fzm);
        if (rawModel == null) {
            fzm.model = null;
            continue;
        }
        fzm.model = rawModel.bake(fzm.trsrt, fzm.getFormat(), lookup);
    }
    raws.clear();
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:22,代码来源:FzModel.java

示例8: loadModel

import net.minecraftforge.client.model.IModel; //导入方法依赖的package包/类
private static IBakedModel loadModel(ModelHandle handle)
{
    IBakedModel model = loadedModels.get(handle.getKey());
    if (model != null)
        return model;

    try
    {
        IModel mod = ModelLoaderRegistry.getModel(handle.getModel());
        if (handle.getTextureReplacements().size() > 0)
        {
            mod = mod.retexture(ImmutableMap.copyOf(handle.getTextureReplacements()));
        }
        if (handle.uvLocked())
        {
            mod = mod.uvlock(true);
        }
        IModelState state = handle.getState();
        if (state == null) state = mod.getDefaultState();
        model = mod.bake(state, handle.getVertexFormat(), ModelLoader.defaultTextureGetter());
        loadedModels.put(handle.getKey(), model);
        return model;
    }
    catch (Exception e)
    {
        throw new ReportedException(new CrashReport("Error loading custom model " + handle.getModel(), e));
    }
}
 
开发者ID:BenjaminSutter,项目名称:genera,代码行数:29,代码来源:ModelHandle.java

示例9: getModel

import net.minecraftforge.client.model.IModel; //导入方法依赖的package包/类
public static IBakedModel getModel(ResourceLocation resourceLocation) 
{
	IBakedModel bakedModel;
	IModel model;
	try {
        model = ModelLoaderRegistry.getModel(resourceLocation);
	} catch (Exception e) {
         throw new RuntimeException(e);
	}
	bakedModel = model.bake(TRSRTransformation.identity(), DefaultVertexFormats.BLOCK,
			location -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString()));
    return bakedModel;
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:14,代码来源:HarshenClientUtils.java

示例10: getBakedModel

import net.minecraftforge.client.model.IModel; //导入方法依赖的package包/类
public static IBakedModel getBakedModel(String modelLocation){

        IModel model;
        try {
            model = ModelLoaderRegistry.getModel(new ResourceLocation(RunicArcana.MOD_ID, modelLocation));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        IBakedModel bakedModel = model.bake(TRSRTransformation.identity(), DefaultVertexFormats.BLOCK, DustModelHandler::textureGetter);

        return bakedModel;
    }
 
开发者ID:Drazuam,项目名称:RunicArcana,代码行数:14,代码来源:DustModelHandler.java

示例11: bake

import net.minecraftforge.client.model.IModel; //导入方法依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format,
		Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
	IBakedModel[] connections = new IBakedModel[6];
	IBakedModel[] endings = new IBakedModel[6];
	IBakedModel[] nodeSides = new IBakedModel[6];
	//IBakedModel node = null;

	// d u n s w e
	ModelRotation[] rotations = new ModelRotation[] { ModelRotation.X90_Y0, ModelRotation.X270_Y0,
			ModelRotation.X0_Y0, ModelRotation.X0_Y180, ModelRotation.X0_Y270, ModelRotation.X0_Y90 };

	try {
		IModel nodeSideModel = ModelLoaderRegistry.getModel(new ResourceLocation(Etheric.MODID, "block/pipe_node_side"));
		IModel connectionModel = ModelLoaderRegistry
				.getModel(new ResourceLocation(Etheric.MODID, "block/pipe_connection"));
		IModel endingModel = ModelLoaderRegistry.getModel(new ResourceLocation(Etheric.MODID, "block/pipe_end"));

		//node = nodeModel.bake(new TRSRTransformation(ModelRotation.X0_Y0), DefaultVertexFormats.BLOCK,
		//		ModelLoader.defaultTextureGetter());
		for (int i = 0; i < connections.length; i++) {
			connections[i] = connectionModel.bake(new TRSRTransformation(rotations[i]), DefaultVertexFormats.BLOCK,
					ModelLoader.defaultTextureGetter());
			endings[i] = endingModel.bake(new TRSRTransformation(rotations[i]), DefaultVertexFormats.BLOCK,
					ModelLoader.defaultTextureGetter());
			nodeSides[i] = nodeSideModel.bake(new TRSRTransformation(rotations[i]), DefaultVertexFormats.BLOCK,
					ModelLoader.defaultTextureGetter());
		}
	} catch (Exception e) {
		Etheric.logger.warn(e.getMessage());
	}

	if (connections[0] == null) {
		return ModelLoaderRegistry.getMissingModel().bake(state, format, bakedTextureGetter);
	}
	return new BakedPipeModel(nodeSides, connections, endings);
}
 
开发者ID:the-realest-stu,项目名称:Etheric,代码行数:38,代码来源:PipeModel.java

示例12: handleItemState

import net.minecraftforge.client.model.IModel; //导入方法依赖的package包/类
@Override
@Nonnull
public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack,
		@Nullable World world, @Nullable EntityLivingBase entity) {

	if (stack.getItem() != ModItems.mace) {
		return originalModel;
	}

	BakedMaceModel model = (BakedMaceModel) originalModel;

	String key = IHeadTool.getHeadMat(stack).getName() + "|"
			+ IHaftTool.getHaftMat(stack).getName() + "|"
			+ IHandleTool.getHandleMat(stack).getName() + "|"
			+ IAdornedTool.getAdornmentMat(stack).getName();

	if (!model.cache.containsKey(key)) {
		ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
		builder.put("head", IHeadTool.getHeadMat(stack).getName());
		builder.put("haft", IHaftTool.getHaftMat(stack).getName());
		builder.put("handle", IHandleTool.getHandleMat(stack).getName());
		if (IAdornedTool.getAdornmentMat(stack) != ModMaterials.ADORNMENT_NULL) {
			builder.put("adornment", IAdornedTool.getAdornmentMat(stack).getName());
		}
		IModel parent = model.parent.retexture(builder.build());
		Function<ResourceLocation, TextureAtlasSprite> textureGetter;
		textureGetter = new Function<ResourceLocation, TextureAtlasSprite>() {
			public TextureAtlasSprite apply(ResourceLocation location) {
				return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString());
			}
		};
		IBakedModel bakedModel = parent.bake(new SimpleModelState(model.transforms), model.format,
				textureGetter);
		model.cache.put(key, bakedModel);
		return bakedModel;
	}

	return model.cache.get(key);
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:40,代码来源:MaceModel.java

示例13: handleItemState

import net.minecraftforge.client.model.IModel; //导入方法依赖的package包/类
@Override
@Nonnull
public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack,
		@Nullable World world, @Nullable EntityLivingBase entity) {

	if (stack.getItem() != ModItems.dagger) {
		return originalModel;
	}

	BakedDaggerModel model = (BakedDaggerModel) originalModel;

	String key = IBladeTool.getBladeMat(stack).getName() + "|"
			+ IHandleTool.getHandleMat(stack).getName() + "|"
			+ IAdornedTool.getAdornmentMat(stack).getName();

	if (!model.cache.containsKey(key)) {
		ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
		builder.put("blade", IBladeTool.getBladeMat(stack).getName());
		builder.put("handle", IHandleTool.getHandleMat(stack).getName());
		if (IAdornedTool.getAdornmentMat(stack) != ModMaterials.ADORNMENT_NULL) {
			builder.put("adornment", IAdornedTool.getAdornmentMat(stack).getName());
		}
		IModel parent = model.parent.retexture(builder.build());
		Function<ResourceLocation, TextureAtlasSprite> textureGetter;
		textureGetter = new Function<ResourceLocation, TextureAtlasSprite>() {
			public TextureAtlasSprite apply(ResourceLocation location) {
				return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString());
			}
		};
		IBakedModel bakedModel = parent.bake(new SimpleModelState(model.transforms), model.format,
				textureGetter);
		model.cache.put(key, bakedModel);
		return bakedModel;
	}

	return model.cache.get(key);
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:38,代码来源:DaggerModel.java

示例14: handleItemState

import net.minecraftforge.client.model.IModel; //导入方法依赖的package包/类
@Override
@Nonnull
public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack,
		@Nullable World world, @Nullable EntityLivingBase entity) {

	if (stack.getItem() != ModItems.hoe) {
		return originalModel;
	}

	BakedHoeModel model = (BakedHoeModel) originalModel;

	String key = IHeadTool.getHeadMat(stack).getName() + "|"
			+ IHaftTool.getHaftMat(stack).getName() + "|"
			+ IHandleTool.getHandleMat(stack).getName() + "|"
			+ IAdornedTool.getAdornmentMat(stack).getName();

	if (!model.cache.containsKey(key)) {
		ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
		builder.put("head", IHeadTool.getHeadMat(stack).getName());
		builder.put("haft", IHaftTool.getHaftMat(stack).getName());
		builder.put("handle", IHandleTool.getHandleMat(stack).getName());
		if (IAdornedTool.getAdornmentMat(stack) != ModMaterials.ADORNMENT_NULL) {
			builder.put("adornment", IAdornedTool.getAdornmentMat(stack).getName());
		}
		IModel parent = model.parent.retexture(builder.build());
		Function<ResourceLocation, TextureAtlasSprite> textureGetter;
		textureGetter = new Function<ResourceLocation, TextureAtlasSprite>() {
			public TextureAtlasSprite apply(ResourceLocation location) {
				return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString());
			}
		};
		IBakedModel bakedModel = parent.bake(new SimpleModelState(model.transforms), model.format,
				textureGetter);
		model.cache.put(key, bakedModel);
		return bakedModel;
	}

	return model.cache.get(key);
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:40,代码来源:HoeModel.java

示例15: handleItemState

import net.minecraftforge.client.model.IModel; //导入方法依赖的package包/类
@Override
@Nonnull
public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack,
		@Nullable World world, @Nullable EntityLivingBase entity) {

	if (stack.getItem() != ModItems.pickaxe) {
		return originalModel;
	}

	BakedPickaxeModel model = (BakedPickaxeModel) originalModel;

	String key = IHeadTool.getHeadMat(stack).getName() + "|"
			+ IHaftTool.getHaftMat(stack).getName() + "|"
			+ IHandleTool.getHandleMat(stack).getName() + "|"
			+ IAdornedTool.getAdornmentMat(stack).getName();

	if (!model.cache.containsKey(key)) {
		ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
		builder.put("head", IHeadTool.getHeadMat(stack).getName());
		builder.put("haft", IHaftTool.getHaftMat(stack).getName());
		builder.put("handle", IHandleTool.getHandleMat(stack).getName());
		if (IAdornedTool.getAdornmentMat(stack) != ModMaterials.ADORNMENT_NULL) {
			builder.put("adornment", IAdornedTool.getAdornmentMat(stack).getName());
		}
		IModel parent = model.parent.retexture(builder.build());
		Function<ResourceLocation, TextureAtlasSprite> textureGetter;
		textureGetter = new Function<ResourceLocation, TextureAtlasSprite>() {
			public TextureAtlasSprite apply(ResourceLocation location) {
				return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString());
			}
		};
		IBakedModel bakedModel = parent.bake(new SimpleModelState(model.transforms), model.format,
				textureGetter);
		model.cache.put(key, bakedModel);
		return bakedModel;
	}

	return model.cache.get(key);
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:40,代码来源:PickaxeModel.java


注:本文中的net.minecraftforge.client.model.IModel.bake方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。