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


Java IModel类代码示例

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


IModel类属于net.minecraftforge.client.model包,在下文中一共展示了IModel类的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: getModelClipNode

import net.minecraftforge.client.model.IModel; //导入依赖的package包/类
/**
 * Retrieves the clip from the model.
 */
@SideOnly(Side.CLIENT)
public static IClip getModelClipNode(ResourceLocation modelLocation, String clipName)
{
    IModel model = ModelLoaderRegistry.getModelOrMissing(modelLocation);
    if(model instanceof IAnimatedModel)
    {
        Optional<? extends IClip> clip = ((IAnimatedModel)model).getClip(clipName);
        if(clip.isPresent())
        {
            return new ModelClip(clip.get(), modelLocation, clipName);
        }
        FMLLog.getLogger().error("Unable to find clip " + clipName + " in the model " + modelLocation);
    }
    // FIXME: missing clip?
    return new ModelClip(IdentityClip.INSTANCE, modelLocation, clipName);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:Clips.java

示例4: 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

示例5: 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

示例6: onModelBake

import net.minecraftforge.client.model.IModel; //导入依赖的package包/类
@SubscribeEvent
public void onModelBake(ModelBakeEvent event)
{
    try
    {
        IModel model = ModelLoaderRegistry.getModel(MODEL_grave);
        if (model instanceof IRetexturableModel)
        {
            IRetexturableModel graveModel = (IRetexturableModel) model;
            IBakedModel standard = event.getModelRegistry().getObject(locGrave);
            IBakedModel finalModel = new GoodGraveModel(standard, graveModel);
            event.getModelRegistry().putObject(locGrave, finalModel);
        }
    } catch (Exception e)
    {
        e.printStackTrace();
    }
}
 
开发者ID:M4thG33k,项目名称:TombManyGraves,代码行数:19,代码来源:TombManyGravesClientEvents.java

示例7: 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

示例8: getModel

import net.minecraftforge.client.model.IModel; //导入依赖的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

示例9: process

import net.minecraftforge.client.model.IModel; //导入依赖的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

示例10: getTextures

import net.minecraftforge.client.model.IModel; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public Collection<ResourceLocation> getTextures() {
	normalModels.clear();
	Set<ResourceLocation> textures = Sets.newHashSet();
	for (Entry<ResourceLocation, Integer> e : item.LOCATION_TO_META.entrySet()) {
		ResourceLocation loc = e.getKey();
		if (item.OVERRIDES.containsKey(e.getKey())) {
			ResourceLocation[][] o = item.OVERRIDES.get(e.getKey());
			textures.addAll(Arrays.asList(o[1]));
			loc = o[0][0];
		}
		if (!normalModels.containsKey(loc)) {
			normalModels.put(loc, getModel(loc));
		}
		IModel model = normalModels.get(loc);
		textures.addAll(model.getTextures().stream().filter(l -> !l.getResourcePath().startsWith("texture")).collect(Collectors.toSet()));
	}
	return textures;
}
 
开发者ID:tom5454,项目名称:Toms-Mod,代码行数:21,代码来源:ModelledItemModel.java

示例11: bake

import net.minecraftforge.client.model.IModel; //导入依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
	CustomModelLoader.log.info("Baking " + nameN + " Model...");
	IBlockState s = block.getDefaultState();
	TerminalBakedModel.Builder builder = new Builder(bakedTextureGetter.apply(new ResourceLocation(hasFront ? imgLoc + "Front" : "tomsmodstorage:blocks/terminalFront")), block);
	ResourceLocation base = new ResourceLocation("tomsmodstorage:block/" + block.getUnlocalizedName().substring(8, block.getUnlocalizedName().length() - 6) + "_base");
	ResourceLocation front = new ResourceLocation("tomsmodstorage:block/terminalFront");
	ResourceLocation terminalItemTransformsL = new ResourceLocation("tomsmodstorage:block/terminalitemtransforms");
	IModel modelFront = getModel(front);
	IModel terminalItemTransforms = getModel(terminalItemTransformsL);
	TextureInjector injectorFront = new TextureInjector(bakedTextureGetter, hasFront ? imgLoc + "Front" : "tomsmodstorage:blocks/terminalFront");
	TextureInjector injectorFrontP = new TextureInjector(bakedTextureGetter, hasFront ? imgLoc + "FrontP" : "tomsmodstorage:blocks/terminalFrontP");
	TextureInjector injectorFrontOn = new TextureInjector(bakedTextureGetter, hasFront ? imgLoc + "FrontOn" : "tomsmodstorage:blocks/terminalFrontOn");
	builder.setItemCameraTransformsModel(terminalItemTransforms.bake(state, format, bakedTextureGetter));
	// load(null, builder, modelBase, modelFront, bakedTextureGetter,
	// injectorFront, injectorFrontOn, format, s);
	for (int ss = 0;ss < block.getStates();ss++) {
		for (int i = 0;i < TileEntityBasicTerminal.TerminalState.VALUES.length;i++) {
			TileEntityBasicTerminal.TerminalState termState = TileEntityBasicTerminal.TerminalState.VALUES[i];
			load(termState, builder, base, modelFront, bakedTextureGetter, injectorFront, injectorFrontP, injectorFrontOn, format, s, ss);
		}
	}
	TerminalBakedModel model = builder.makeModel();
	CustomModelLoader.log.info(nameN + " Model Baking Complete.");
	return model;
}
 
开发者ID:tom5454,项目名称:Toms-Mod,代码行数:27,代码来源:TerminalBlockModel.java

示例12: getConnectedSide

import net.minecraftforge.client.model.IModel; //导入依赖的package包/类
@Override
public IModel getConnectedSide(boolean isTop,
        boolean isBottom, boolean isDouble) {
    
    if (!isDouble) {
    
        return isBottom ? isTop ? this.singleSideLone :
                this.singleSideBottom : isTop ?
                this.singleSideTop : this.singleSideMiddle;
        
    } else {
        
        return isBottom ? isTop ? this.doubleSideLone :
                this.doubleSideBottom : isTop ?
                this.doubleSideTop : this.doubleSideMiddle;
    }
}
 
开发者ID:JayAvery,项目名称:geomastery,代码行数:18,代码来源:RenderWallComplex.java

示例13: getPostModel

import net.minecraftforge.client.model.IModel; //导入依赖的package包/类
/** @return Model for this wall's post with given properties. */
protected IModel getPostModel(boolean isTop, boolean isBottom,
        boolean isDouble) {
    
    if (!isDouble) {
    
        return isBottom ? isTop ? this.singlePostLone :
                this.singlePostBottom : isTop ?
                this.singlePostTop : this.singlePostMiddle;
        
    } else {
        
        return isBottom ? isTop ? this.doublePostLone :
                this.doublePostBottom : isTop ?
                this.doublePostTop : this.doublePostMiddle;
    }
}
 
开发者ID:JayAvery,项目名称:geomastery,代码行数:18,代码来源:RenderWallComplex.java

示例14: 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

示例15: 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


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