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


Java IBakedModel类代码示例

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


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

示例1: bake

import net.minecraft.client.renderer.block.model.IBakedModel; //导入依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    ImmutableMap.Builder<String, TextureAtlasSprite> builder = ImmutableMap.builder();
    builder.put(ModelLoader.White.LOCATION.toString(), ModelLoader.White.INSTANCE);
    TextureAtlasSprite missing = bakedTextureGetter.apply(new ResourceLocation("missingno"));
    for (Map.Entry<String, Material> e : matLib.materials.entrySet())
    {
        if (e.getValue().getTexture().getTextureLocation().getResourcePath().startsWith("#"))
        {
            FMLLog.log.fatal("OBJLoader: Unresolved texture '{}' for obj model '{}'", e.getValue().getTexture().getTextureLocation().getResourcePath(), modelLocation);
            builder.put(e.getKey(), missing);
        }
        else
        {
            builder.put(e.getKey(), bakedTextureGetter.apply(e.getValue().getTexture().getTextureLocation()));
        }
    }
    builder.put("missingno", missing);
    return new TintedOBJBakedModel(this, state, format, builder.build());
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:22,代码来源:TintedOBJModel.java

示例2: onModelBaking

import net.minecraft.client.renderer.block.model.IBakedModel; //导入依赖的package包/类
@SubscribeEvent
public void onModelBaking(ModelBakeEvent event) {
    // set up camo models for camouflagable blocks
    for (Block block : Blockss.blocks) {
        if (block instanceof BlockPneumaticCraftCamo) {
            Map<IBlockState,ModelResourceLocation> map
                    = event.getModelManager().getBlockModelShapes().getBlockStateMapper().getVariants(block);
            for (Map.Entry<IBlockState,ModelResourceLocation> entry : map.entrySet()) {
                Object object = event.getModelRegistry().getObject(entry.getValue());
                if (object != null) {
                    IBakedModel existing = (IBakedModel) object;
                    CamoModel customModel = new CamoModel(existing);
                    event.getModelRegistry().putObject(entry.getValue(), customModel);
                }
            }
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:19,代码来源:ClientEventHandler.java

示例3: getBakedModel

import net.minecraft.client.renderer.block.model.IBakedModel; //导入依赖的package包/类
public IBakedModel getBakedModel()
{
    if (this==ModDust.getDustFromID(this.getDustID()))
    {
        if (this.bakedModel==null)
        {
            this.bakedModel = DustModelHandler.getBakedModel(getModelLocation());
        }
        return this.bakedModel;
    }
    else
    {
        return ModDust.getDustFromID(this.getDustID()).getBakedModel();

    }


}
 
开发者ID:Drazuam,项目名称:RunicArcana,代码行数:19,代码来源:DefaultDustSymbol.java

示例4: renderItem

import net.minecraft.client.renderer.block.model.IBakedModel; //导入依赖的package包/类
public void renderItem(ItemStack stack, IBakedModel model)
{
    if (stack != null)
    {
        GlStateManager.pushMatrix();
        GlStateManager.translate(-0.5F, -0.5F, -0.5F);

        if (model.isBuiltInRenderer())
        {
            GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
            GlStateManager.enableRescaleNormal();
            TileEntityItemStackRenderer.instance.renderByItem(stack);
        }
        else
        {
            this.renderModel(model, stack);

            if (stack.hasEffect())
            {
                this.renderEffect(model);
            }
        }

        GlStateManager.popMatrix();
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:27,代码来源:RenderItem.java

示例5: handleItemState

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

	Spell spell = ItemSpellPage.getSpell(stack);

	if (spell == null || spell.equals(Spell.EMPTY_SPELL)) {
		return originalModel;
	}
	
	String name = spell.getRegistryName().toString();
	
	if (!cache.containsKey(name)) {
		ModelSpellPage model = (ModelSpellPage) originalModel;
		TextureAtlasSprite fontSprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(font2.toString());
		
		BakedModelSpellPage bakedBakedModel = rebake(model, spell);
		cache.put(name, bakedBakedModel);

		return bakedBakedModel;
	}
	return cache.get(name);
}
 
开发者ID:the-realest-stu,项目名称:Infernum,代码行数:25,代码来源:ModelSpellPage.java

示例6: renderModel

import net.minecraft.client.renderer.block.model.IBakedModel; //导入依赖的package包/类
public boolean renderModel(IBlockAccess worldIn, IBakedModel modelIn, IBlockState stateIn, BlockPos posIn, VertexBuffer buffer, boolean checkSides, long rand)
{
    boolean flag = Minecraft.isAmbientOcclusionEnabled() && stateIn.getLightValue() == 0 && modelIn.isAmbientOcclusion();

    try
    {
        return flag ? this.renderModelSmooth(worldIn, modelIn, stateIn, posIn, buffer, checkSides, rand) : this.renderModelFlat(worldIn, modelIn, stateIn, posIn, buffer, checkSides, rand);
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tesselating block model");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Block model being tesselated");
        CrashReportCategory.addBlockInfo(crashreportcategory, posIn, stateIn);
        crashreportcategory.addCrashSection("Using AO", Boolean.valueOf(flag));
        throw new ReportedException(crashreport);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:BlockModelRenderer.java

示例7: handleItemState

import net.minecraft.client.renderer.block.model.IBakedModel; //导入依赖的package包/类
@Override
@Nonnull
public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack,
		@Nullable World world, @Nullable EntityLivingBase entity) {
	
	String name = stack.getDisplayName();
	
	if (!cache.containsKey(name)) {
		ModelKnowledgeBook model = (ModelKnowledgeBook) originalModel;
		TextureAtlasSprite fontSprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(font2.toString());
		
		BakedModelKnowledgeBook bakedBakedModel = rebake(model, name);
		cache.put(name, bakedBakedModel);

		return bakedBakedModel;
	}
	return cache.get(name);
}
 
开发者ID:the-realest-stu,项目名称:Infernum,代码行数:19,代码来源:ModelKnowledgeBook.java

示例8: renderItemModelIntoGUI

import net.minecraft.client.renderer.block.model.IBakedModel; //导入依赖的package包/类
protected void renderItemModelIntoGUI(ItemStack stack, int x, int y, IBakedModel bakedmodel)
{
    GlStateManager.pushMatrix();
    this.textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    this.textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
    GlStateManager.enableRescaleNormal();
    GlStateManager.enableAlpha();
    GlStateManager.alphaFunc(516, 0.1F);
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    this.setupGuiTransform(x, y, bakedmodel.isGui3d());
    bakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(bakedmodel, ItemCameraTransforms.TransformType.GUI, false);
    this.renderItem(stack, bakedmodel);
    GlStateManager.disableAlpha();
    GlStateManager.disableRescaleNormal();
    GlStateManager.disableLighting();
    GlStateManager.popMatrix();
    this.textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    this.textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:22,代码来源:RenderItem.java

示例9: getQuads

import net.minecraft.client.renderer.block.model.IBakedModel; //导入依赖的package包/类
@Override
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand)
{
    IBakedModel model;
    BlockRenderLayer layer = MinecraftForgeClient.getRenderLayer();
    if(layer == null)
    {
        return quads.get(Optional.fromNullable(side));
    }
    else if(!models.containsKey(Optional.of(layer)))
    {
        model = missing;
    }
    else
    {
        model = models.get(Optional.of(layer));
    }
    // assumes that child model will handle this state properly. FIXME?
    return model.getQuads(state, side, rand);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:MultiLayerModel.java

示例10: renderItemModel

import net.minecraft.client.renderer.block.model.IBakedModel; //导入依赖的package包/类
protected void renderItemModel(ItemStack stack, IBakedModel bakedmodel, ItemCameraTransforms.TransformType transform, boolean leftHanded)
{
    if (stack.getItem() != null)
    {
        this.textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        this.textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        GlStateManager.enableRescaleNormal();
        GlStateManager.alphaFunc(516, 0.1F);
        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
        GlStateManager.pushMatrix();
        // TODO: check if negative scale is a thing
        bakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(bakedmodel, transform, leftHanded);

        this.renderItem(stack, bakedmodel);
        GlStateManager.cullFace(GlStateManager.CullFace.BACK);
        GlStateManager.popMatrix();
        GlStateManager.disableRescaleNormal();
        GlStateManager.disableBlend();
        this.textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        this.textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:25,代码来源:RenderItem.java

示例11: getCustomItemModel

import net.minecraft.client.renderer.block.model.IBakedModel; //导入依赖的package包/类
public static IBakedModel getCustomItemModel(ItemStack p_getCustomItemModel_0_, IBakedModel p_getCustomItemModel_1_, ResourceLocation p_getCustomItemModel_2_)
{
    if (p_getCustomItemModel_1_.isGui3d())
    {
        return p_getCustomItemModel_1_;
    }
    else if (itemProperties == null)
    {
        return p_getCustomItemModel_1_;
    }
    else
    {
        CustomItemProperties customitemproperties = getCustomItemProperties(p_getCustomItemModel_0_, 1);
        return customitemproperties == null ? p_getCustomItemModel_1_ : customitemproperties.getModel(p_getCustomItemModel_2_);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:17,代码来源:CustomItems.java

示例12: dbgModel

import net.minecraft.client.renderer.block.model.IBakedModel; //导入依赖的package包/类
public static void dbgModel(IBakedModel p_dbgModel_0_)
{
    if (p_dbgModel_0_ != null)
    {
        Config.dbg("Model: " + p_dbgModel_0_ + ", ao: " + p_dbgModel_0_.isAmbientOcclusion() + ", gui3d: " + p_dbgModel_0_.isGui3d() + ", builtIn: " + p_dbgModel_0_.isBuiltInRenderer() + ", particle: " + p_dbgModel_0_.getParticleTexture());
        EnumFacing[] aenumfacing = EnumFacing.VALUES;

        for (int i = 0; i < aenumfacing.length; ++i)
        {
            EnumFacing enumfacing = aenumfacing[i];
            List list = p_dbgModel_0_.getQuads((IBlockState)null, enumfacing, 0L);
            dbgQuads(enumfacing.getName(), list, "  ");
        }

        List list1 = p_dbgModel_0_.getQuads((IBlockState)null, (EnumFacing)null, 0L);
        dbgQuads("General", list1, "  ");
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:19,代码来源:ModelUtils.java

示例13: bake

import net.minecraft.client.renderer.block.model.IBakedModel; //导入依赖的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

示例14: getItemModel

import net.minecraft.client.renderer.block.model.IBakedModel; //导入依赖的package包/类
public IBakedModel getItemModel(ItemStack stack)
{
    Item item = stack.getItem();
    IBakedModel ibakedmodel = this.getItemModel(item, this.getMetadata(stack));

    if (ibakedmodel == null)
    {
        ItemMeshDefinition itemmeshdefinition = (ItemMeshDefinition)this.shapers.get(item);

        if (itemmeshdefinition != null)
        {
            ibakedmodel = this.modelManager.getModel(itemmeshdefinition.getModelLocation(stack));
        }
    }

    if (ibakedmodel == null)
    {
        ibakedmodel = this.modelManager.getMissingModel();
    }

    return ibakedmodel;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:23,代码来源:ItemModelMesher.java

示例15: getItemModelWithOverrides

import net.minecraft.client.renderer.block.model.IBakedModel; //导入依赖的package包/类
public IBakedModel getItemModelWithOverrides(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entitylivingbaseIn)
{
    IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(stack);
    Item item = stack.getItem();

    if (Config.isCustomItems() && item != null && item.hasCustomProperties())
    {
        this.modelLocation = ibakedmodel.getOverrides().applyOverride(stack, worldIn, entitylivingbaseIn);
    }

    if (Reflector.ForgeItemOverrideList_handleItemState.exists())
    {
        return (IBakedModel)Reflector.call(ibakedmodel.getOverrides(), Reflector.ForgeItemOverrideList_handleItemState, new Object[] {ibakedmodel, stack, worldIn, entitylivingbaseIn});
    }
    else if (item != null && item.hasCustomProperties())
    {
        ResourceLocation resourcelocation = ibakedmodel.getOverrides().applyOverride(stack, worldIn, entitylivingbaseIn);
        return resourcelocation == null ? ibakedmodel : this.itemModelMesher.getModelManager().getModel(new ModelResourceLocation(resourcelocation, "inventory"));
    }
    else
    {
        return ibakedmodel;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:RenderItem.java


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