當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。