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