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


Java ItemRenderer类代码示例

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


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

示例1: renderItemFP

import net.minecraft.client.renderer.ItemRenderer; //导入依赖的package包/类
public static void renderItemFP(ItemRenderer itemRenderer, float par1, boolean renderTranslucent)
{
    GlStateManager.depthMask(true);

    if (renderTranslucent)
    {
        GlStateManager.depthFunc(519);
        GL11.glPushMatrix();
        IntBuffer intbuffer = Shaders.activeDrawBuffers;
        Shaders.setDrawBuffers(Shaders.drawBuffersNone);
        Shaders.renderItemKeepDepthMask = true;
        itemRenderer.renderItemInFirstPerson(par1);
        Shaders.renderItemKeepDepthMask = false;
        Shaders.setDrawBuffers(intbuffer);
        GL11.glPopMatrix();
    }

    GlStateManager.depthFunc(515);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    itemRenderer.renderItemInFirstPerson(par1);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:ShadersRender.java

示例2: setItemRendererEquippProgress

import net.minecraft.client.renderer.ItemRenderer; //导入依赖的package包/类
public static void setItemRendererEquippProgress(float From0To1, boolean isSmooth)
{
	ItemRenderer IR = Minecraft.getMinecraft().entityRenderer.itemRenderer;
	if (IR != null) try
	{
		if (!isSmooth)
		{
			if (prevEquippedProgress == null) prevEquippedProgress = ItemRenderer.class.getDeclaredField(
					"prevEquippedProgress");
			prevEquippedProgress.setAccessible(true);
			prevEquippedProgress.setFloat(IR, From0To1);
		}
		if (equippedProgress == null) equippedProgress = ItemRenderer.class.getDeclaredField("equippedProgress");
		equippedProgress.setAccessible(true);
		equippedProgress.setFloat(IR, From0To1);
	}
	catch (Exception e)
	{
		e.printStackTrace();
	}
}
 
开发者ID:BubbleTrouble14,项目名称:ARKCraft,代码行数:22,代码来源:Utils.java

示例3: renderItemIn2D

import net.minecraft.client.renderer.ItemRenderer; //导入依赖的package包/类
private static void renderItemIn2D(Tessellator tess, float minU, float minV, float maxU, float maxV, int scaleX, int scaleY, float negZLevel, boolean isGlowing) {
	if( isGlowing ) {
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_LIGHT0);
        GL11.glDisable(GL11.GL_LIGHT1);
        GL11.glDisable(GL11.GL_COLOR_MATERIAL);

		float prevLGTX = OpenGlHelper.lastBrightnessX;
		float prevLGTY = OpenGlHelper.lastBrightnessY;
		char bright = 0x000F0;
		int brightX = bright % 65536;
		int brightY = bright / 65536;

		OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightX / 1.0F, brightY / 1.0F);
        ItemRenderer.renderItemIn2D(tess, minU, minV, maxU, maxV, scaleX, scaleY, negZLevel);
		OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLGTX, prevLGTY);

        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_LIGHT0);
        GL11.glEnable(GL11.GL_LIGHT1);
        GL11.glEnable(GL11.GL_COLOR_MATERIAL);
	} else {
		ItemRenderer.renderItemIn2D(tess, minU, minV, maxU, maxV, scaleX, scaleY, negZLevel);
	}
}
 
开发者ID:DracoAnimus,项目名称:Coding,代码行数:26,代码来源:ItemRenderHelper.java

示例4: getRenderBlocks

import net.minecraft.client.renderer.ItemRenderer; //导入依赖的package包/类
private RenderBlocks getRenderBlocks()
{
       RenderBlocks renderBlocksInstance;
       try
       {
        Field field = ItemRenderer.class.getDeclaredFields()[ 4 ];
        field.setAccessible( true );
        renderBlocksInstance = ( RenderBlocks ) field.get( RenderManager.instance.itemRenderer );
       }
       catch ( Exception exception )
       {
       	exception.printStackTrace();
       	return null;
       }
       
       return renderBlocksInstance;
}
 
开发者ID:spacechase0,项目名称:ComponentEquipment,代码行数:18,代码来源:PersistiumInfuserTileEntityRenderer.java

示例5: renderItem

import net.minecraft.client.renderer.ItemRenderer; //导入依赖的package包/类
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

	// ====================== Render item texture ======================
	FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(item);
	int color = fluidStack.getFluid().getColor();

	IIcon fluidIcon = item.getIconIndex();
	IIcon bucketIcon = Items.bucket.getIconIndex(new ItemStack(Items.bucket));
	if(type == ItemRenderType.INVENTORY) {
		GL11.glEnable(GL11.GL_ALPHA_TEST);
		RenderItem.getInstance().renderIcon(0, 0, bucketIcon, 16, 16);

		GL11.glColor3ub((byte)((color >>> 16) & 0xFF), (byte)((color >>> 8) & 0xFF), (byte)(color & 0xFF));

		RenderItem.getInstance().renderIcon(0, 0, fluidIcon, 16, 16);
		GL11.glColor3f(1f, 1f, 1f);
	}
	else {
		
		ItemRenderer.renderItemIn2D(Tessellator.instance, ((IIcon)bucketIcon).getMinU(), ((IIcon)bucketIcon).getMinV(), ((IIcon)bucketIcon).getMaxU(), ((IIcon)bucketIcon).getMaxV(), ((IIcon)bucketIcon).getIconWidth(), ((IIcon)bucketIcon).getIconHeight(), 0.1f);
		GL11.glColor3ub((byte)((color >>> 16) & 0xFF), (byte)((color >>> 8) & 0xFF), (byte)(color & 0xFF));
		ItemRenderer.renderItemIn2D(Tessellator.instance, ((IIcon)fluidIcon).getMinU(), ((IIcon)fluidIcon).getMinV(), ((IIcon)fluidIcon).getMaxU(), ((IIcon)fluidIcon).getMaxV(), ((IIcon)fluidIcon).getIconWidth(), ((IIcon)fluidIcon).getIconHeight(), 0.1f);
		GL11.glColor3f(1f, 1f, 1f);
	}
}
 
开发者ID:zmaster587,项目名称:AdvancedRocketry,代码行数:27,代码来源:RendererBucket.java

示例6: renderItem

import net.minecraft.client.renderer.ItemRenderer; //导入依赖的package包/类
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

	IIcon icon = item.getIconIndex();

	GL11.glPushMatrix();
	if(type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
		GL11.glTranslatef(1.3f, .3f, 0);
		GL11.glRotated(210, 0, 0, 1);
		GL11.glRotated(180, 1, 0, 0);
		
		ItemRenderer.renderItemIn2D(Tessellator.instance, ((IIcon)icon).getMinU(), ((IIcon)icon).getMinV(), ((IIcon)icon).getMaxU(), ((IIcon)icon).getMaxV(), ((IIcon)icon).getIconWidth(), ((IIcon)icon).getIconHeight(), 0.1f);
	}
	else if(type == ItemRenderType.EQUIPPED) {
		GL11.glTranslatef(0.7f, 1.3f, 0);
		GL11.glRotated(-70, 0, 0, 1);
		GL11.glRotated(180, 1, 0, 0);
		ItemRenderer.renderItemIn2D(Tessellator.instance, ((IIcon)icon).getMinU(), ((IIcon)icon).getMinV(), ((IIcon)icon).getMaxU(), ((IIcon)icon).getMaxV(), ((IIcon)icon).getIconWidth(), ((IIcon)icon).getIconHeight(), 0.1f);
	
	}
		GL11.glPopMatrix();
}
 
开发者ID:zmaster587,项目名称:AdvancedRocketry,代码行数:23,代码来源:RendererLaserGun.java

示例7: renderCore

import net.minecraft.client.renderer.ItemRenderer; //导入依赖的package包/类
public static void renderCore(EntityGolemBase golem, AdditionalGolemCore core) {
    GL11.glPushMatrix();

    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
    GL11.glTranslatef(0.0875F, -0.96F, 0.15F + (golem.getGolemDecoration().contains("P") ? 0.03F : 0.0F));
    GL11.glScaled(0.175D, 0.175D, 0.175D);
    GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);

    ItemStack coreItem = core.getItem();
    IIcon icon = coreItem.getItem().getIcon(coreItem, 0);
    float f1 = icon.getMaxU();
    float f2 = icon.getMinV();
    float f3 = icon.getMinU();
    float f4 = icon.getMaxV();
    Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
    ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f3, f4, icon.getIconWidth(), icon.getIconHeight(), 0.2F);

    GL11.glPopMatrix();
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:20,代码来源:RenderGolemHelper.java

示例8: renderDoor

import net.minecraft.client.renderer.ItemRenderer; //导入依赖的package包/类
private void renderDoor(TileEntityFurnaceMF tile, int x, int y, int w, int h, int tw, int th) {
	Minecraft mc = Minecraft.getMinecraft();
	
	float f = 0.01F / (float)tw;
    float f1 = 0.01F / (float)th;
    
	float x1 = (float)x / (float)tw + f;
	float x2 = (float)(x + w) / tw - f;
	float y1 = (float)y / th + f1;
	float y2 = (float)(y + h) / th - f1;
    
    Tessellator image = Tessellator.instance;
    float xPos = 0.5F;
    float yPos = 0.0F;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glTranslatef(-xPos, -yPos, pixel(0.5F));
    float var13 = 1F;
    GL11.glScalef(var13, var13, var13);
    GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
    GL11.glTranslatef(-1F, -1F, 0.0F);
    ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, tw, th, 0.0625F);
    

}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:25,代码来源:TileEntityFurnaceRendererMF.java

示例9: renderDoorHeater

import net.minecraft.client.renderer.ItemRenderer; //导入依赖的package包/类
private void renderDoorHeater(TileEntityFurnaceMF tile, int x, int y, int w, int h, int tw, int th) {
	Minecraft mc = Minecraft.getMinecraft();
	
	float f = 0.01F / (float)tw;
    float f1 = 0.01F / (float)th;
    
	float x1 = (float)x / (float)tw + f;
	float x2 = (float)(x + w) / tw - f;
	float y1 = (float)y / th + f1;
	float y2 = (float)(y + h) / th - f1;
    
    Tessellator image = Tessellator.instance;
    float xPos = 0.5F;
    float yPos = 1.0F;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glTranslatef(-xPos, -yPos, pixel(0.5F));
    float var13 = 1F;
    GL11.glScalef(var13, var13, var13);
    GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
    GL11.glTranslatef(-1F, -1F, 0.0F);
    ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, tw, th, 0.0625F);
    

}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:25,代码来源:TileEntityFurnaceRendererMF.java

示例10: renderRack

import net.minecraft.client.renderer.ItemRenderer; //导入依赖的package包/类
private void renderRack(TileEntityOven tile, int x, int y, int w, int h,
		int tw, int th) {
	Minecraft mc = Minecraft.getMinecraft();

	float f = 0.01F / (float) tw;
	float f1 = 0.01F / (float) th;

	float x1 = (float) x / (float) tw + f;
	float x2 = (float) (x + w) / tw - f;
	float y1 = (float) y / th + f1;
	float y2 = (float) (y + h) / th - f1;

	Tessellator image = Tessellator.instance;
	float xPos = 0.5F;
	float yPos = 0.0F;
	GL11.glEnable(GL12.GL_RESCALE_NORMAL);
	GL11.glTranslatef(-xPos, -yPos, pixel(0.5F));
	float var13 = 1F;
	GL11.glScalef(var13, var13, var13);
	GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
	GL11.glTranslatef(-1F, -1F, 0.0F);
	ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, tw, th, 0.0625F);

}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:25,代码来源:TileEntityOvenRenderer.java

示例11: renderHatch

import net.minecraft.client.renderer.ItemRenderer; //导入依赖的package包/类
private void renderHatch(TileEntityOven tile, int x, int y, int w,
		int h, int tw, int th) {
	Minecraft mc = Minecraft.getMinecraft();

	float f = 0.01F / (float) tw;
	float f1 = 0.01F / (float) th;

	float x1 = (float) x / (float) tw + f;
	float x2 = (float) (x + w) / tw - f;
	float y1 = (float) y / th + f1;
	float y2 = (float) (y + h) / th - f1;

	Tessellator image = Tessellator.instance;
	float xPos = 0.5F;
	float yPos = 1.0F;
	GL11.glEnable(GL12.GL_RESCALE_NORMAL);
	GL11.glTranslatef(-xPos, -yPos, pixel(0.5F));
	float var13 = 1F;
	GL11.glScalef(var13, var13, var13);
	GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
	GL11.glTranslatef(-1F, -1F, 0.0F);
	ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, tw, th, 0.0625F);

}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:25,代码来源:TileEntityOvenRenderer.java

示例12: renderWheel

import net.minecraft.client.renderer.ItemRenderer; //导入依赖的package包/类
private void renderWheel(TileEntityTripHammer tile, int x, int y, int w, int h, int tw, int th) {
	Minecraft mc = Minecraft.getMinecraft();
	
	float f = 0.01F / (float)tw;
       float f1 = 0.01F / (float)th;
       
	float x1 = (float)x / (float)tw + f;
	float x2 = (float)(x + w) / tw - f;
	float y1 = (float)y / th + f1;
	float y2 = (float)(y + h) / th - f1;
       
       Tessellator image = Tessellator.instance;
       float xPos = 0.5F;
       float yPos = 0.5F;
       GL11.glEnable(GL12.GL_RESCALE_NORMAL);
       GL11.glTranslatef(-xPos, -yPos, pixel(0.5F));
       float var13 = 1F;
       GL11.glScalef(var13, var13, var13);
       GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
       GL11.glTranslatef(-1F, -1F, 0.0F);
       ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, tw, th, 0.0625F);

}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:24,代码来源:TileEntityTripHammerRenderer.java

示例13: renderWheel

import net.minecraft.client.renderer.ItemRenderer; //导入依赖的package包/类
private void renderWheel(TileEntitySpinningWheel tile, int x, int y, int w, int h, int tw, int th) {
	Minecraft mc = Minecraft.getMinecraft();
	
	float f = 0.01F / (float)tw;
       float f1 = 0.01F / (float)th;
       
	float x1 = (float)x / (float)tw + f;
	float x2 = (float)(x + w) / tw - f;
	float y1 = (float)y / th + f1;
	float y2 = (float)(y + h) / th - f1;
       
       Tessellator image = Tessellator.instance;
       float xPos = 0.5F;
       float yPos = 0.5F;
       GL11.glEnable(GL12.GL_RESCALE_NORMAL);
       GL11.glTranslatef(-xPos, -yPos, pixel(0.5F));
       float var13 = 1F;
       GL11.glScalef(var13, var13, var13);
       GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
       GL11.glTranslatef(-1F, -1F, 0.0F);
       ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, tw, th, 0.0625F);

}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:24,代码来源:TileEntitySpinningWheelRenderer.java

示例14: render3D

import net.minecraft.client.renderer.ItemRenderer; //导入依赖的package包/类
public void render3D(ItemStack item) {
    glPushMatrix();
    IIcon icon = item.getItem().getIcon(item, 0);
    if (icon == null)
        return;
    Tessellator tess = Tessellator.instance;
    float uv1 = icon.getMinU();
    float uv2 = icon.getMaxU();
    float uv3 = icon.getMinV();
    float uv4 = icon.getMaxV();
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glColor4f(1f, 1f, 1f, 0.5f);
    ItemRenderer.renderItemIn2D(tess, uv2, uv3, uv1, uv4, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
    glColor4f(1f, 1f, 1f, 1f);
    glDisable(GL_BLEND);
    glPopMatrix();
}
 
开发者ID:Lomeli12,项目名称:MagicalRings,代码行数:19,代码来源:RenderGhostSword.java

示例15: renderExtras

import net.minecraft.client.renderer.ItemRenderer; //导入依赖的package包/类
@Override
public void renderExtras(EntityPlayer player, boolean post) {
	if (!post) {
		GL11.glPushMatrix();
		Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
		if (player.isSneaking()) {
			GL11.glRotatef(28.64789F, 1.0F, 0.0F, 0.0F);
		}
		boolean armor = player.getCurrentArmor(1) != null;
		GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
		GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
		GL11.glTranslatef(-0.25F, -0.85F, armor ? 0.2F : 0.28F);
		GL11.glScalef(0.5F, 0.5F, 0.5F);
		GL11.glColor3f(1.0F, 1.0F, 1.0F);
		int light = 0xF000F0;
		int lightmapX = light % 0x10000;
		int lightmapY = light / 0x10000;
		OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);

		IIcon icon = toRender.getIconIndex();
		ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 1.0F / 16.0F);
		GL11.glPopMatrix();
	}
}
 
开发者ID:Chisel-2,项目名称:Chisel-2,代码行数:25,代码来源:PlayerSpecials.java


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