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


Java MinecraftForgeClient.getItemRenderer方法代码示例

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


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

示例1: registerRenderers

import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
public void registerRenderers()
{
    RenderingRegistry.registerEntityRenderingHandler(EntityIlluminatedArrow.class, new RenderIlluminatedArrow());

    if (Loader.isModLoaded("Thaumcraft"))
    {
        ItemStack stack = GameRegistry.findItemStack("Thaumcraft", "WandCasting", 1);
        IItemRenderer wandRenderer = MinecraftForgeClient.getItemRenderer(stack, ItemRenderType.EQUIPPED_FIRST_PERSON);
        RenderWandHandler render = new RenderWandHandler(wandRenderer);
        MinecraftForgeClient.registerItemRenderer(stack.getItem(), render);
        FMLCommonHandler.instance().bus().register(render);
    }
    
    IlluminatedBows.renderIdIllumination = RenderingRegistry.getNextAvailableRenderId();
    RenderingRegistry.registerBlockHandler(new RenderIllumination());
}
 
开发者ID:MikeLydeamore,项目名称:IlluminatedBows,代码行数:17,代码来源:ClientProxy.java

示例2: renderEquippedItems

import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
protected void renderEquippedItems(EntityChiselSnowman snowman, float size){
    super.renderEquippedItems(snowman, size);
    ItemStack itemStack = snowman.getEquipmentInSlot(2);

    if(itemStack.getItem() instanceof ItemBlock){
        GL11.glPushMatrix();
        this.snowMan.head.postRender(0.0625F);

        IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemStack, EQUIPPED);
        boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemStack, BLOCK_3D));

        if(is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemStack.getItem()).getRenderType())){
            float f1 = 0.625F;
            GL11.glTranslatef(0.0F, -0.34375F, 0.0F);
            GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
            GL11.glScalef(f1, -f1, f1);
        }
        this.renderManager.itemRenderer.renderItem(snowman, itemStack, 0);
        GL11.glPopMatrix();
    }
}
 
开发者ID:Chisel-2,项目名称:Chisel-2,代码行数:22,代码来源:RenderChiselSnowman.java

示例3: renderEquippedItems

import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
protected void renderEquippedItems(EntitySnowman p_77029_1_, float p_77029_2_)
{
    super.renderEquippedItems(p_77029_1_, p_77029_2_);
    ItemStack itemstack = new ItemStack(Blocks.pumpkin, 1);

    if (itemstack.getItem() instanceof ItemBlock)
    {
        GL11.glPushMatrix();
        this.snowmanModel.head.postRender(0.0625F);

        IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED);
        boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D));

        if (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemstack.getItem()).getRenderType()))
        {
            float f1 = 0.625F;
            GL11.glTranslatef(0.0F, -0.34375F, 0.0F);
            GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
            GL11.glScalef(f1, -f1, f1);
        }

        this.renderManager.itemRenderer.renderItem(p_77029_1_, itemstack, 0);
        GL11.glPopMatrix();
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:26,代码来源:RenderSnowMan.java

示例4: renderSnowmanPumpkin

import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
/**
 * Renders this snowman's pumpkin.
 */
protected void renderSnowmanPumpkin(EntitySnowman par1EntitySnowman, float par2)
{
    super.renderEquippedItems(par1EntitySnowman, par2);
    ItemStack itemstack = new ItemStack(Block.pumpkin, 1);

    if (itemstack != null && itemstack.getItem() instanceof ItemBlock)
    {
        GL11.glPushMatrix();
        this.snowmanModel.head.postRender(0.0625F);

        IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED);
        boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D));

        if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
        {
            float f1 = 0.625F;
            GL11.glTranslatef(0.0F, -0.34375F, 0.0F);
            GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
            GL11.glScalef(f1, -f1, f1);
        }

        this.renderManager.itemRenderer.renderItem(par1EntitySnowman, itemstack, 0);
        GL11.glPopMatrix();
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:29,代码来源:RenderSnowMan.java

示例5: renderSnowmanPumpkin

import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
/**
 * Renders this snowman's pumpkin.
 */
protected void renderSnowmanPumpkin(EntityIceGolem par1EntityIceGolem, float par2)
{
    super.renderEquippedItems(par1EntityIceGolem, par2);
    ItemStack itemstack = new ItemStack(WinterWarMain.frozenPumpkin, 1);

    if (itemstack != null && itemstack.getItem() instanceof ItemBlock)
    {
        GL11.glPushMatrix();
        this.iceGolemModel.head.postRender(0.0625F);

        IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED);
        boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D));

        if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
        {
            float f1 = 0.625F;
            GL11.glTranslatef(0.0F, -0.34375F, 0.0F);
            GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
            GL11.glScalef(f1, -f1, f1);
        }

        this.renderManager.itemRenderer.renderItem(par1EntityIceGolem, itemstack, 0);
        GL11.glPopMatrix();
    }
}
 
开发者ID:DrSideburns,项目名称:Modjam-3-Winter-Warfare-Mod,代码行数:29,代码来源:RenderIceGolem.java

示例6: renderItemUniform

import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
/**
 * Renders items and blocks in the world at 0,0,0 with transformations that size them appropriately
 * @param spin The spin angle of the item around the y axis in degrees
 */
public static void renderItemUniform(ItemStack item, double spin)
{
    IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, ENTITY);
    boolean is3D = customRenderer != null && customRenderer.shouldUseRenderHelper(ENTITY, item, BLOCK_3D);

    boolean larger = false;
    if (item.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item.getItem()).getRenderType()))
    {
        int renderType = Block.getBlockFromItem(item.getItem()).getRenderType();
        larger = !(renderType == 1 || renderType == 19 || renderType == 12 || renderType == 2);
    }
    else if(is3D)
    {
        larger = true;
    }
    
    double d = 2;
    double d1 = 1/d;
    if(larger)
        GL11.glScaled(d, d, d);

    GL11.glColor4f(1, 1, 1, 1);
    
    entityItem.setEntityItemStack(item);
    uniformRenderItem.doRender(entityItem, 0, larger ? 0.09 : 0.06, 0, 0, (float)(spin*9/Math.PI));
    
    if(larger)
        GL11.glScaled(d1, d1, d1);
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:34,代码来源:RenderUtils.java

示例7: renderItemUniform

import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
/**
 * Renders item and blocks in the world at 0,0,0 with transformations that size them appropriately
 *
 * @param spin The spin angle of the item around the y axis in degrees
 */
public static void renderItemUniform(ItemStack item, double spin)
{
    IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, ENTITY);
    boolean is3D = customRenderer != null && customRenderer.shouldUseRenderHelper(ENTITY, item, BLOCK_3D);

    boolean larger = false;
    if (item.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item.getItem()).getRenderType()))
    {
        int renderType = Block.getBlockFromItem(item.getItem()).getRenderType();
        larger = !(renderType == 1 || renderType == 19 || renderType == 12 || renderType == 2);
    } else if (is3D)
    {
        larger = true;
    }

    double d = 2;
    double d1 = 1 / d;
    if (larger)
    {
        GL11.glScaled(d, d, d);
    }

    GL11.glColor4f(1, 1, 1, 1);

    entityItem.setEntityItemStack(item);
    uniformRenderItem.doRender(entityItem, 0, larger ? 0.09 : 0.06, 0, 0, (float) (spin * 9 / Math.PI));

    if (larger)
    {
        GL11.glScaled(d1, d1, d1);
    }
}
 
开发者ID:Darkona,项目名称:AdventureBackpack2,代码行数:38,代码来源:RenderUtils.java

示例8: renderTileEntityAt

import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float tickTime)
{
    ToolTE te = (ToolTE) tileentity;
    ItemStack is = te.getStack();
    if (is == null) return;

    IItemRenderer renderer = MinecraftForgeClient.getItemRenderer(is, IItemRenderer.ItemRenderType.EQUIPPED);
    if (renderer != null && renderer.handleRenderType(is, IItemRenderer.ItemRenderType.EQUIPPED))
    {
        doSpecialRender(renderer, is, x, y, z, te.getBlockMetadata());
    }
    else
    {
        doRenderPass(0, te.getBlockMetadata(), is, x, y, z);

        if (is.getItem().requiresMultipleRenderPasses())
        {
            for (int i = 1; i < is.getItem().getRenderPasses(is.getItemDamage()); i++)
            {
                doRenderPass(i, te.getBlockMetadata(), is, x, y, z);
            }
        }
    }

    if (ToolClassFinder.isSword(is))
    {
        if (te.sign1Facing != -1) renderSign(x, y, z, tickTime, te.sign1Facing, te.sign1Text, te.getBlockMetadata());
        if (te.sign2Facing != -1) renderSign(x, y, z, tickTime, te.sign2Facing, te.sign2Text, te.getBlockMetadata());
    }
}
 
开发者ID:DoubleDoorDevelopment,项目名称:PlaceableTools,代码行数:32,代码来源:ToolRenderer.java

示例9: renderItem

import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
@Override
public void renderItem(ItemRenderType renderType, ItemStack itemStack, Object... data) {
    render(renderType, itemStack);

    ItemStack wrenchStack = ModItems.toolBox.getCurrentWrench(itemStack);
    if(wrenchStack != null) {
        IItemRenderer itemRenderer = MinecraftForgeClient.getItemRenderer(wrenchStack, renderType);
        if(itemRenderer != null) {
            itemRenderer.renderItem(renderType, wrenchStack, data);
        } else {
            render(renderType, wrenchStack);
        }
    }
}
 
开发者ID:Dynious,项目名称:RefinedRelocation,代码行数:15,代码来源:ItemRendererToolBox.java

示例10: renderItem

import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
private void renderItem(TileEntityWeaponRack tile, ItemStack itemstack, Icon icon, int slot, int layer) 
{
	GL11.glPushMatrix();
       TextureManager texturemanager = this.mc.getTextureManager();
       GL11.glScalef(0.85F, 0.85F, 0.85F);
       
       IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, ItemRenderType.EQUIPPED);
       if (isCustom(itemstack) && customRenderer != null)
       {
   		texturemanager.bindTexture(texturemanager.getResourceLocation(itemstack.getItemSpriteNumber()));
   		renderEquippedItem(ItemRenderType.EQUIPPED, customRenderer, new RenderBlocks(), itemstack);
       }
       else
       {
           if (icon == null)
           {
               GL11.glPopMatrix();
               return;
           }

           texturemanager.bindTexture(texturemanager.getResourceLocation(itemstack.getItemSpriteNumber()));
           Tessellator tessellator = Tessellator.instance;
           float f = icon.getMinU();
           float f1 = icon.getMaxU();
           float f2 = icon.getMinV();
           float f3 = icon.getMaxV();
           float f4 = 0.0F;
           float f5 = 0.3F;
           GL11.glEnable(GL12.GL_RESCALE_NORMAL);
           GL11.glTranslatef(-f4, -f5, 0.0F);
           GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);
           ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);

           if (itemstack.hasEffect(layer))
           {
               GL11.glDepthFunc(GL11.GL_EQUAL);
               GL11.glDisable(GL11.GL_LIGHTING);
               texturemanager.bindTexture(TextureHelperMF.ITEM_GLINT);
               GL11.glEnable(GL11.GL_BLEND);
               GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
               float f7 = 0.76F;
               GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F);
               GL11.glMatrixMode(GL11.GL_TEXTURE);
               GL11.glPushMatrix();
               float f8 = 0.125F;
               GL11.glScalef(f8, f8, f8);
               float f9 = (float)(Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
               GL11.glTranslatef(f9, 0.0F, 0.0F);
               GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
               ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
               GL11.glPopMatrix();
               GL11.glPushMatrix();
               GL11.glScalef(f8, f8, f8);
               f9 = (float)(Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
               GL11.glTranslatef(-f9, 0.0F, 0.0F);
               GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
               ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
               GL11.glPopMatrix();
               GL11.glMatrixMode(GL11.GL_MODELVIEW);
               GL11.glDisable(GL11.GL_BLEND);
               GL11.glEnable(GL11.GL_LIGHTING);
               GL11.glDepthFunc(GL11.GL_LEQUAL);
           }

           GL11.glDisable(GL12.GL_RESCALE_NORMAL);
       }

       GL11.glPopMatrix();
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:70,代码来源:TileEntityWeaponRackRenderer.java

示例11: renderFlatItem

import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
public static void renderFlatItem(ItemStack itemstack, World world) {
    if (itemstack == null || world == null) return;

    int br = 16 << 20 | 16 << 4;
    int x = br % 65536;
    int y = br / 65536;
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, x * 0.8F, y * 0.8F);

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable( GL12.GL_RESCALE_NORMAL );
    Tessellator.instance.setColorOpaque_F(1.0f, 1.0f, 1.0f);

    if (itemstack != null) {
        EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, 0.0D, itemstack);
        entityitem.getEntityItem().stackSize = 1;

        entityitem.hoverStart = 0;
        entityitem.age = 0;
        entityitem.rotationYaw = 0;

        GL11.glPushMatrix();
        GL11.glTranslatef(0, -0.04F, 0);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

        if (itemstack.isItemEnchanted() || itemstack.getItem().requiresMultipleRenderPasses()) {
            GL11.glTranslatef(0.0f, -0.05f, -0.25f);
            GL11.glScalef(1.0f / 1.5f, 1.0f / 1.5f, 1.0f / 1.5f);
            GL11.glScalef(1.0f, -1.0f, 0.005f);

            Block block = Block.getBlockFromItem(itemstack.getItem());
            if ((itemstack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(block.getRenderType()))) {
                GL11.glRotatef(25.0f, 1.0f, 0.0f, 0.0f);
                GL11.glRotatef(15.0f, 0.0f, 1.0f, 0.0f);
                GL11.glRotatef(30.0f, 0.0f, 1.0f, 0.0f);
            }

            IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, IItemRenderer.ItemRenderType.ENTITY);
            if (customRenderer != null && !(itemstack.getItem() instanceof ItemBlock)) {
                if (customRenderer.shouldUseRenderHelper(IItemRenderer.ItemRenderType.ENTITY, itemstack, IItemRenderer.ItemRendererHelper.BLOCK_3D)) {
                    GL11.glTranslatef(0, -0.04F, 0);
                    GL11.glScalef(0.7f, 0.7f, 0.7f);
                    GL11.glRotatef(35, 1, 0, 0);
                    GL11.glRotatef(45, 0, 1, 0);
                    GL11.glRotatef(-90, 0, 1, 0);
                }
            } else if (itemstack.getItem() instanceof ItemBlock) {
                GL11.glTranslatef(0, -0.04F, 0);
                GL11.glScalef(1.1f, 1.1f, 1.1f);
                GL11.glRotatef(-90, 0, 1, 0);
            } else {
                GL11.glTranslatef(0, -0.14F, 0);
                GL11.glScalef(0.8f, 0.8f, 0.8f);
            }

            RenderItem.renderInFrame = true;
            RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
            RenderItem.renderInFrame = false;
        } else {
            GL11.glScalef(1.0f / 42.0f, 1.0f / 42.0f, 1.0f / 42.0f);
            GL11.glTranslated(-8.0, -10.2, -10.4);
            GL11.glScalef(1.0f, 1.0f, 0.005f);

            RenderItem.renderInFrame = false;
            FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
            if (!ForgeHooksClient.renderInventoryItem(renderBlocks, Minecraft.getMinecraft().renderEngine, itemstack, true, 0, (float) 0, (float) 0)) {
                renderItem.renderItemIntoGUI(fr, Minecraft.getMinecraft().renderEngine, itemstack, 0, 0, false);
            }
        }

        GL11.glPopMatrix();
    }
}
 
开发者ID:dmillerw,项目名称:AutomationMod,代码行数:75,代码来源:ItemRenderHelper.java

示例12: renderSpecials

import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
/**
 * Method for adding special render rules
 */
protected void renderSpecials(EntityStatuePlayer player, float par2) {
	float f1 = 1.0F;
	GL11.glColor3f(f1, f1, f1);
	super.renderEquippedItems(player, par2);
	super.renderArrowsStuckInEntity(player, par2);
	ItemStack stack = player.inventory.armorItemInSlot(3);

	if (stack != null) {
		GL11.glPushMatrix();
		modelBipedMain.bipedHead.postRender(0.0625F);
		float f2;

		if (stack != null && stack.getItem() instanceof ItemBlock) {
			IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(stack, EQUIPPED);
			boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, stack, BLOCK_3D));

			if (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(stack.getItem()).getRenderType())) {
				f2 = 0.625F;
				GL11.glTranslatef(0.0F, -0.25F, 0.0F);
				GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
				GL11.glScalef(f2, -f2, -f2);
			}

			renderManager.itemRenderer.renderItem(player, stack, 0);
		} else if (stack.getItem().equals(Items.skull)) {
			f2 = 1.0625F;
			GL11.glScalef(f2, -f2, -f2);
			GameProfile s = null;
			
			if (stack.hasTagCompound() && stack.getTagCompound().hasKey("Owner")) {
				s = NBTUtil.func_152459_a(stack.getTagCompound().getCompoundTag("Owner"));
			}
			
			TileEntitySkullRenderer.field_147536_b.func_152674_a(-0.5F, 0.0F, -0.5F, 1, 180.0F, stack.getItemDamage(), s);
		}

		GL11.glPopMatrix();
	}
	
	renderItemInRightArm(player);
	renderItemInLeftArm(player);
}
 
开发者ID:asiekierka,项目名称:Statues,代码行数:46,代码来源:RenderPlayerStatue.java

示例13: getRendererForTool

import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
private IItemRenderer getRendererForTool(ItemStack itemstack, ItemRenderType type) {
    return MinecraftForgeClient.getItemRenderer(itemstack,
                                                type);
}
 
开发者ID:SlimeVoid,项目名称:TheMinersFriend,代码行数:5,代码来源:ItemRendererToolBelt.java


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