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


Java RenderItem类代码示例

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


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

示例1: renderItemInWorld

import net.minecraft.client.renderer.RenderItem; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public static void renderItemInWorld(ItemStack stack){
    if(!stack.isEmpty()){
        Minecraft mc = Minecraft.getMinecraft();
        RenderItem renderer = mc.getRenderItem();
        TextureManager manager = mc.getTextureManager();

        IBakedModel model = renderer.getItemModelWithOverrides(stack, null, null);

        manager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        manager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
        GlStateManager.enableRescaleNormal();
        GlStateManager.enableBlend();
        GlStateManager.pushMatrix();
        model = ForgeHooksClient.handleCameraTransforms(model, ItemCameraTransforms.TransformType.FIXED, false);
        renderer.renderItem(stack, model);
        GlStateManager.cullFace(GlStateManager.CullFace.BACK);
        GlStateManager.popMatrix();
        GlStateManager.disableRescaleNormal();
        GlStateManager.disableBlend();
        manager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        manager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
    }
}
 
开发者ID:canitzp,项目名称:Metalworks,代码行数:25,代码来源:Util.java

示例2: renderAffinity

import net.minecraft.client.renderer.RenderItem; //导入依赖的package包/类
private void renderAffinity(ItemStack affinity) {
	RenderItem itemRenderer = minecraft.getRenderItem();
	if (affinity != null) {
		double local = (period * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
		float hoverHeight = (float) ((0.4 * (Math.sin(local))) / 8);

		GlStateManager.translate(0.5F, 1.2F + hoverHeight, 0.5F);
		EntityItem entityItem = new EntityItem(getWorld(), 0, 0, 0, affinity);
		entityItem.getEntityItem().stackSize = 1;
		entityItem.hoverStart = 0.0F;
		GlStateManager.pushMatrix();
		GlStateManager.disableLighting();
		float rotation = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
		GlStateManager.rotate(rotation, 0.0F, 1.0F, 0.0F);
		GlStateManager.scale(0.5F, 0.5F, 0.5F);
		GlStateManager.pushAttrib();
		RenderHelper.enableStandardItemLighting();
		itemRenderer.renderItem(entityItem.getEntityItem(), ItemCameraTransforms.TransformType.FIXED);
		RenderHelper.disableStandardItemLighting();
		GlStateManager.popAttrib();
		GlStateManager.enableLighting();
		GlStateManager.popMatrix();
		GlStateManager.translate(0.0F, -hoverHeight, 0.0F);
	}
}
 
开发者ID:yolp900,项目名称:ItsJustaCharm1.10.2Dead,代码行数:26,代码来源:TESRConstructionTable.java

示例3: drawDisabledSlot

import net.minecraft.client.renderer.RenderItem; //导入依赖的package包/类
/**
 * Draws a slot that is disabled...
 *
 * @param x          slot x
 * @param y          slot y
 * @param renderItem Item Render
 */
public static void drawDisabledSlot(int x, int y, RenderItem renderItem) {
    new GuiUtils().zLevel = 100.f;
    renderItem.zLevel = 100.0f;

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int colorOverlay = new Color(139, 139, 139, 200).hashCode();
    GlStateManager.disableLighting();
    GlStateManager.disableDepth();
    GlStateManager.colorMask(true, true, true, false);
    renderItem.renderItemAndEffectIntoGUI(new ItemStack(Blocks.AIR), x, y);
    new GuiUtils().drawGradientRect(x, y, x + 16, y + 16, colorOverlay, colorOverlay);
    GlStateManager.colorMask(true, true, true, true);
    GlStateManager.enableLighting();
    GlStateManager.enableDepth();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    new GuiUtils().zLevel = 0.0f;
    renderItem.zLevel = 0.0f;
}
 
开发者ID:TheDragonTeam,项目名称:TheDragonLib,代码行数:27,代码来源:GuiUtils.java

示例4: renderSaiLeft

import net.minecraft.client.renderer.RenderItem; //导入依赖的package包/类
private void renderSaiLeft(int id) {
    RenderItem renderer = Minecraft.getMinecraft().getRenderItem();

    GlStateManager.pushMatrix();

    GlStateManager.translate(0, 0, -0.1);
    GlStateManager.translate(0, 0.625, 0);
    GlStateManager.rotate(180, 1, 0, 0);
    GlStateManager.translate(0.275, 0, 0);
    GlStateManager.rotate(-90, 0, 1, 0);
    GlStateManager.scale(0.5, 0.5, 1);

    renderer.renderItem(this.itemsToRender[id], ItemCameraTransforms.TransformType.NONE);

    GlStateManager.popMatrix();
}
 
开发者ID:InfinityRaider,项目名称:NinjaGear,代码行数:17,代码来源:RenderNinjaGadget.java

示例5: renderSaiRight

import net.minecraft.client.renderer.RenderItem; //导入依赖的package包/类
private void renderSaiRight(int id) {
    RenderItem renderer = Minecraft.getMinecraft().getRenderItem();

    GlStateManager.pushMatrix();

    GlStateManager.translate(0, 0, -0.1);
    GlStateManager.translate(0, 0.625, 0);
    GlStateManager.rotate(180, 1, 0, 0);
    GlStateManager.translate(-0.275, 0, 0);
    GlStateManager.rotate(-90, 0, 1, 0);
    GlStateManager.scale(0.5, 0.5, 1);

    renderer.renderItem(this.itemsToRender[id], ItemCameraTransforms.TransformType.NONE);

    GlStateManager.popMatrix();
}
 
开发者ID:InfinityRaider,项目名称:NinjaGear,代码行数:17,代码来源:RenderNinjaGadget.java

示例6: renderRopeCoil

import net.minecraft.client.renderer.RenderItem; //导入依赖的package包/类
private void renderRopeCoil(int id) {
    RenderItem renderer = Minecraft.getMinecraft().getRenderItem();

    GlStateManager.pushMatrix();

    GlStateManager.translate(0, 0, -0.15);
    GlStateManager.translate(0, 1.25, 0);
    GlStateManager.rotate(180, 1, 0, 0);
    GlStateManager.translate(0.3, 0, 0);
    GlStateManager.rotate(-90, 0, 1, 0);
    GlStateManager.rotate(-90, 0, 0, 1);
    GlStateManager.scale(0.8, 0.8, 1);

    renderer.renderItem(this.itemsToRender[id], ItemCameraTransforms.TransformType.NONE);

    GlStateManager.popMatrix();
}
 
开发者ID:InfinityRaider,项目名称:NinjaGear,代码行数:18,代码来源:RenderNinjaGadget.java

示例7: sanitizeEntityRenderers

import net.minecraft.client.renderer.RenderItem; //导入依赖的package包/类
@SideOnly (Side.CLIENT)
public static void sanitizeEntityRenderers(RenderManager renderManager) {
    if (!hasSanitized) {
        try {
            for (Render<? extends Entity> render : renderManager.entityRenderMap.values()) {
                if (render != null) {
                    for (Field field : render.getClass().getDeclaredFields()) {
                        if (field.getType().equals(RenderItem.class)) {
                            field.setAccessible(true);
                            field.set(render, CCRenderItem.getOverridenRenderItem());
                        }
                    }
                }
            }
        } catch (Exception e) {
            throw new RuntimeException("Unable to reflect an EntityRenderer!", e);
        }
        hasSanitized = true;
    }
}
 
开发者ID:TheCBProject,项目名称:CodeChickenLib,代码行数:21,代码来源:ProxyClient.java

示例8: renderTileEntityAt

import net.minecraft.client.renderer.RenderItem; //导入依赖的package包/类
@Override
public void renderTileEntityAt(TileMetal te, double x, double y, double z, float partialTicks, int destroyStage)
{
    RenderItem renderer = Minecraft.getMinecraft().getRenderItem();

    GlStateManager.pushMatrix();
    GlStateManager.translate(x+0.5D,y+0.05D,z+0.5D);
    EntityItem stack = new EntityItem(getWorld(),0,0,0,te.blankStack);
    stack.getEntityItem().stackSize = 1;
    stack.hoverStart = 0.0F;

    GlStateManager.disableLighting();
    GlStateManager.rotate(-90,1,0,0);
    GlStateManager.scale(0.5D,0.5D,0.5D);
    GlStateManager.pushAttrib();
    RenderHelper.disableStandardItemLighting();
    renderer.renderItem(stack.getEntityItem(), ItemCameraTransforms.TransformType.FIXED);
    RenderHelper.enableStandardItemLighting();
    GlStateManager.popAttrib();
    GlStateManager.enableLighting();
    GlStateManager.popMatrix();
}
 
开发者ID:Fancysaurus,项目名称:DFArtifacts,代码行数:23,代码来源:RenderTileMetal.java

示例9: init

import net.minecraft.client.renderer.RenderItem; //导入依赖的package包/类
public static void init() {
    RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
    for (Map.Entry<String, Block> ent : renderMap.entrySet()) {
        renderItem.getItemModelMesher().register(Item.getItemFromBlock(ent.getValue()), 0, new ModelResourceLocation(Reference.MODID + ":" + ent.getKey(), "inventory"));
    }
    //TODO Convert to Lambda
    for (Map.Entry<Material, Block> entry : oreBlockMap.entrySet()) {
        Minecraft.getMinecraft().getItemColors().registerItemColorHandler(new IItemColor() {
            @Override
            public int getColorFromItemstack(ItemStack stack, int tintIndex) {
                return entry.getKey().getColour().getRGB();
            }

        }, entry.getValue());
    }
}
 
开发者ID:The-Acronym-Coders,项目名称:T.E.C.H,代码行数:17,代码来源:BaseBlocks.java

示例10: drawItemStack

import net.minecraft.client.renderer.RenderItem; //导入依赖的package包/类
/**
 * Draws an ItemStack
 *
 * @param itemStack itemstack to draw
 * @param x         startX
 * @param y         startY
 */
public void drawItemStack(ItemStack itemStack, int x, int y) {
    int[][] savedGLState = OpenGLHelper.saveGLState(new int[]{GL11.GL_ALPHA_TEST, GL11.GL_LIGHTING});
    RenderItem renderItem = mc.getRenderItem();

    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    RenderHelper.enableGUIStandardItemLighting();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    renderItem.renderItemIntoGUI(itemStack, x, y);
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();

    OpenGLHelper.restoreGLState(savedGLState);
}
 
开发者ID:The-Acronym-Coders,项目名称:T.E.C.H,代码行数:25,代码来源:GuiHelper.java

示例11: drawDisabledSlot

import net.minecraft.client.renderer.RenderItem; //导入依赖的package包/类
/**
 * Draws a slot that is disabled...
 *
 * @param x          slot x
 * @param y          slot y
 * @param renderItem Item Render
 */
public void drawDisabledSlot(int x, int y, RenderItem renderItem) {
    this.zLevel = 100.f;
    renderItem.zLevel = 100.0f;

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int colorOverlay = new Color(139, 139, 139, 200).hashCode();
    GlStateManager.disableLighting();
    GlStateManager.disableDepth();
    GlStateManager.colorMask(true, true, true, false);
    renderItem.renderItemAndEffectIntoGUI(new ItemStack(Blocks.BARRIER), x, y);
    this.drawGradientRect(x, y, x + 16, y + 16, colorOverlay, colorOverlay);
    GlStateManager.colorMask(true, true, true, true);
    GlStateManager.enableLighting();
    GlStateManager.enableDepth();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    this.zLevel = 0.0f;
    renderItem.zLevel = 0.0f;
}
 
开发者ID:The-Acronym-Coders,项目名称:T.E.C.H,代码行数:27,代码来源:GuiHelper.java

示例12: renderItemOnBlock

import net.minecraft.client.renderer.RenderItem; //导入依赖的package包/类
private void renderItemOnBlock(World world, ItemStack itemStack)
{
    RenderItem itemRenderer = minecraft.getRenderItem();
    if (itemStack != null && !(itemStack.getItem() instanceof ItemBlock))
    {
        GlStateManager.translate(0.0F, -0.98F, 0.0F);
        EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, 0.0D, itemStack);
        entityitem.getEntityItem().stackSize = 1;
        entityitem.hoverStart = 0.0F;

        GlStateManager.pushMatrix();
        GlStateManager.disableLighting();

        GlStateManager.rotate(180, 0.0F, 1.0F, 1.0F);
        GlStateManager.scale(0.75F, 0.75F, 0.75F);
        GlStateManager.pushAttrib();
        RenderHelper.enableStandardItemLighting();
        itemRenderer.renderItem(entityitem.getEntityItem(), ItemCameraTransforms.TransformType.FIXED);
        RenderHelper.disableStandardItemLighting();
        GlStateManager.popAttrib();

        GlStateManager.enableLighting();
        GlStateManager.popMatrix();
    }
}
 
开发者ID:Aviv871,项目名称:TombCraft,代码行数:26,代码来源:RenderRelicLab.java

示例13: renderObject

import net.minecraft.client.renderer.RenderItem; //导入依赖的package包/类
public static boolean renderObject(Minecraft mc, RenderItem itemRender, int x, int y, Object itm, boolean highlight, float lvl) {
        itemRender.zLevel = lvl;

        if (itm==null) {
            return renderItemStack(mc, itemRender, null, x, y, "", highlight);
        }
        if (itm instanceof Item) {
            return renderItemStack(mc, itemRender, new ItemStack((Item) itm, 1), x, y, "", highlight);
        }
        if (itm instanceof Block) {
            return renderItemStack(mc, itemRender, new ItemStack((Block) itm, 1), x, y, "", highlight);
        }
        if (itm instanceof ItemStack) {
            return renderItemStackWithCount(mc, itemRender, (ItemStack) itm, x, y, highlight);
        }
//        if (itm instanceof IIcon) {
//            return renderIcon(mc, itemRender, (IIcon) itm, x, y, highlight);
//        }
        return renderItemStack(mc, itemRender, null, x, y, "", highlight);
    }
 
开发者ID:McJty,项目名称:AquaMunda,代码行数:21,代码来源:RenderHelper.java

示例14: render

import net.minecraft.client.renderer.RenderItem; //导入依赖的package包/类
@SuppressWarnings("unused")
private void render(Object block) {
  if (block instanceof Block && block instanceof ICustomBlock) {
    if (Sponge.getPlatform().getExecutionType().isClient()) {
      RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();

      renderItem.getItemModelMesher().register(
          Item.getItemFromBlock((Block) block),
          0,
          new ModelResourceLocation(
              "skree:" + ((ICustomBlock) block).__getID(),
              "inventory"
          )
      );

    }
  } else {
    throw new IllegalArgumentException("Invalid custom item!");
  }
}
 
开发者ID:Skelril,项目名称:Skree,代码行数:21,代码来源:CustomBlockSystem.java

示例15: drawItem

import net.minecraft.client.renderer.RenderItem; //导入依赖的package包/类
@Override
protected void drawItem(TexturePallette item, Minecraft mc, RenderItem itemRender, double left, double top, float partialTicks, boolean isHighlighted)
{

    int size = this.actualItemPixels();
    
    // if texture is translucent provide a background
    if(this.renderAlpha) GuiUtil.drawRect(left, top, left + size, top + size, this.baseColor);

    Rotation rotation = item.rotation.rotationType() == TextureRotationType.RANDOM 
            ? Rotation.values()[(int) ((CommonProxy.currentTimeMillis() >> 11) & 3)]
            : item.rotation.rotation;
            
    TextureAtlasSprite tex = mc.getTextureMapBlocks().getAtlasSprite(item.getSampleTextureName());
    GuiUtil.drawTexturedRectWithColor(left, top, this.zLevel, tex, size, size, this.borderColor, item.textureScale, rotation, renderAlpha);
}
 
开发者ID:grondag,项目名称:Hard-Science,代码行数:17,代码来源:TexturePicker.java


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