當前位置: 首頁>>代碼示例>>Java>>正文


Java RenderItem.renderInFrame方法代碼示例

本文整理匯總了Java中net.minecraft.client.renderer.entity.RenderItem.renderInFrame方法的典型用法代碼示例。如果您正苦於以下問題:Java RenderItem.renderInFrame方法的具體用法?Java RenderItem.renderInFrame怎麽用?Java RenderItem.renderInFrame使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.client.renderer.entity.RenderItem的用法示例。


在下文中一共展示了RenderItem.renderInFrame方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: renderTileEntityAt

import net.minecraft.client.renderer.entity.RenderItem; //導入方法依賴的package包/類
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f1) {

          model.renderDoomShrine(x, y, z);
          
  		TileDoomShrine tileEntity = (TileDoomShrine)te;
  		int slot = 0;
  		if(tileEntity.getStackInSlot(slot)!= null){
  		if((entItem == null) || entItem.getEntityItem().getItem() != tileEntity.getStackInSlot(slot).getItem())
  		
  		entItem = new EntityItem(tileEntity.getWorldObj(), x, y, z, tileEntity.getStackInSlot(slot));
  		
  		GL11.glPushMatrix();
  			this.entItem.hoverStart = 0.0F;
  			RenderItem.renderInFrame = true;
  			GL11.glTranslatef((float)x + 0.5F, (float)y + 1.08F, (float)z + 0.5F);
  			GL11.glRotatef(0, 90, 1, 1);
  			RenderManager.instance.renderEntityWithPosYaw(this.entItem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
  			RenderItem.renderInFrame = false;
  		GL11.glPopMatrix();
  		}
	
}
 
開發者ID:MoreThanHidden,項目名稱:DoomShrine,代碼行數:24,代碼來源:RenderDoomShrine.java

示例2: renderTileBox

import net.minecraft.client.renderer.entity.RenderItem; //導入方法依賴的package包/類
private void renderTileBox(TileEntityPrehistoryBox tile, double x, double y, double z) {
	translations = new double[][]{new double[]{0.4D, 0.15D, 0.4D}, new double[]{0.65D, 0.15D, 0.4D}, new double[]{0.4D, 0.15D, 0.65D}, new double[]{0.65D, 0.15D, 0.65D}};
	for(int i = 0; i < tile.stacks.length; i++) {
		if(tile.stacks[i] != null) {
			entityItem[i].setEntityItemStack(tile.stacks[i]);
			GL11.glPushMatrix();
			GL11.glEnable(GL12.GL_RESCALE_NORMAL);
			
			GL11.glTranslated(x, y, z);	
			
			GL11.glTranslated(translations[i][0], translations[i][1], translations[i][2]);
			GL11.glRotatef(0F, 0.0F, 0.0F, 0.0F);
	
			GL11.glScalef(0.5F, 0.5F, 0.5F);
			
			RenderItem.renderInFrame = true;
			RenderManager.instance.renderEntityWithPosYaw(entityItem[i], 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
			RenderItem.renderInFrame = false;
	
			GL11.glDisable(GL12.GL_RESCALE_NORMAL);
			GL11.glPopMatrix();
		}
	}
}
 
開發者ID:AgeCraft,項目名稱:AgeCraft-Old,代碼行數:25,代碼來源:TileEntityRendererPrehistoryBox.java

示例3: renderTileEntityAt

import net.minecraft.client.renderer.entity.RenderItem; //導入方法依賴的package包/類
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f1) {
	
	TileEntityLaunchPad tileEntityLP = (TileEntityLaunchPad)tileEntity;
	
	GL11.glPushMatrix();
	
	if (tileEntityLP.missile != null) {
		
		ItemStack stack = new ItemStack(tileEntityLP.missile.getItem(), 1, 0);
		EntityItem entItem = new EntityItem(Minecraft.getMinecraft().theWorld, 0D, 0D, 0D, stack);	
		
		entItem.hoverStart = 0;
		
		GL11.glPushMatrix();						
		RenderItem.renderInFrame = true;
		GL11.glTranslatef((float)x + 0.5F, (float)y + 0.44F, (float)z + 0.5F);
		GL11.glScalef(1.5F, 1.5F, 1.5F);
		GL11.glRotatef(45, 0, 1, 0);
		RenderManager.instance.renderEntityWithPosYaw(entItem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
		RenderItem.renderInFrame = false;
		GL11.glPopMatrix();	
	}
	
	GL11.glTranslated(x + 0.5D, y, z + 0.5D);
	GL11.glScaled(0.85D, 0.85D, 0.85D);
	
	GL11.glRotatef(-90 * tileEntity.getBlockMetadata(), 0, 1, 0);
	
	Minecraft.getMinecraft().renderEngine.bindTexture(texture);
	model.renderAll();	
	
	GL11.glPopMatrix();
}
 
開發者ID:TeamMonumental,項目名稱:FissionWarfare,代碼行數:35,代碼來源:RenderLaunchPad.java

示例4: renderTileEntityAt

import net.minecraft.client.renderer.entity.RenderItem; //導入方法依賴的package包/類
@Override
public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float f) {
	
	TileEntityMissileLauncher tileEntity = (TileEntityMissileLauncher)entity;
	
	GL11.glPushMatrix();
	
	if (tileEntity.getStackInSlot(0) != null) {
		
		ItemStack stack = new ItemStack(tileEntity.slots[0].getItem(), 1, 0);
		EntityItem entItem = new EntityItem(Minecraft.getMinecraft().theWorld, 0D, 0D, 0D, stack);	
		
		GL11.glPushMatrix();						
		RenderItem.renderInFrame = true;
		GL11.glTranslatef((float)x + 0.5F, (float)y + 0.25F, (float)z + 0.5F);
		GL11.glScalef(1.5F, 1.5F, 1.5F);
		GL11.glRotatef(45, 0, 1, 0);
		RenderManager.instance.renderEntityWithPosYaw(entItem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
		RenderItem.renderInFrame = false;
		GL11.glPopMatrix();	
	}		
	
	GL11.glTranslatef((float)x + 0.5F, (float)y + 1.50F, (float)z + 0.5F);
	GL11.glRotatef(180, 1, 0, 0);
	
	Minecraft.getMinecraft().renderEngine.bindTexture(texture);
	model.render(null, 0, 0, 0, 0, 0, 0.0625F);		
	GL11.glPopMatrix();
}
 
開發者ID:TeamMonumental,項目名稱:FusionWarfare,代碼行數:30,代碼來源:RenderMissileLauncher.java

示例5: renderItemStack

import net.minecraft.client.renderer.entity.RenderItem; //導入方法依賴的package包/類
public static void renderItemStack(ItemStack stack)
{
    if (stack != null)
    {
        push();

        EntityItem item = new EntityItem(getClientWorld(), 0D, 0D, 0D, stack);
        item.hoverStart = 0F;
        RenderItem.renderInFrame = false;
        translate(0, -(7 * ITEM_PIXEL) - 0.0060F, -0.006F);
        RenderManager.instance.renderEntityWithPosYaw(item, 0D, 0D, 0D, 0F, 0F);

        pop();
    }
}
 
開發者ID:MrSpring,項目名稱:TheKitchenMod,代碼行數:16,代碼來源:ClientUtils.java

示例6: doRenderItem

import net.minecraft.client.renderer.entity.RenderItem; //導入方法依賴的package包/類
public void doRenderItem(ItemStack stack, float x, float y, float z, int f) {
    if(stack == null) {
        return;
    }
    dummy.setEntityItemStack(stack);
    float renderScale = 4.0f;
    GL11.glPushMatrix();
    GL11.glTranslatef(x, y + .75f, z);
    GL11.glRotatef(180, 1f, 0f, 0f);
    GL11.glRotatef(f % 360L, 0f, 1f, 0f);
    RenderItem.renderInFrame = true;
    GL11.glScalef(renderScale, renderScale, renderScale);
    potato.doRender(dummy, 0, 0, 0, 0, 0);
    GL11.glPopMatrix();
}
 
開發者ID:HotelCalifornia,項目名稱:BiotechMod,代碼行數:16,代碼來源:EnergyContainerTESR.java

示例7: renderItem

import net.minecraft.client.renderer.entity.RenderItem; //導入方法依賴的package包/類
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
	boolean lit = item.getItem() == Item.getItemFromBlock(Blocks.lit_pumpkin);
	TextureManager textureManager = Minecraft.getMinecraft().renderEngine;
	GL11.glPushMatrix();
	if (type == ItemRenderType.ENTITY) {
		EntityItem entityItem = (EntityItem) data[1];
		float heightOscillation = 0;
		float rotation = 0;
		if (!RenderItem.renderInFrame) {
			heightOscillation = MathHelper.sin((entityItem.age + ClientProxy.mcTimer.renderPartialTicks) / 10 + entityItem.hoverStart) * 0.4f - 0.1f;
			rotation = ((entityItem.age + ClientProxy.mcTimer.renderPartialTicks) / 20 + entityItem.hoverStart) * (180 / (float) Math.PI);
		}
		GL11.glRotatef(rotation, 0, 1, 0);
		GL11.glTranslatef(-0.5f, heightOscillation, -0.5f);
	} else {
		GL11.glEnable(GL11.GL_CULL_FACE);
	}
	if (item.hasTagCompound()) {
		NBTTagCompound tagCompound = item.getTagCompound();
		if (tagCompound.hasKey("block", 10)) {
			NBTTagList tagList = tagCompound.getCompoundTag("block").getTagList("faces", 10);
			for (int i = 0; i < tagList.tagCount(); i++) {
				NBTTagCompound faceCompound = tagList.getCompoundTagAt(i);
				ResourceLocation resourceLocation = getTexture(lit, faceCompound);
				textureManager.bindTexture(resourceLocation);
				model.renderSide(i);
			}
		}
	}
	GL11.glPopMatrix();
	if (type != ItemRenderType.ENTITY) {
		GL11.glDisable(GL11.GL_CULL_FACE);
	}
}
 
開發者ID:pau101,項目名稱:Pumpkin-Carvier,代碼行數:36,代碼來源:ItemRendererPumpkin.java

示例8: renderTileCampfire

import net.minecraft.client.renderer.entity.RenderItem; //導入方法依賴的package包/類
private void renderTileCampfire(TileEntityPrehistoryCampfire tile, double x, double y, double z, float f) {
	GL11.glPushMatrix();
	GL11.glTranslated(x, y, z);
	GL11.glTranslatef(0.5F, -0.5F, 0.5F);
	bindTexture(PrehistoryAgeClient.campfire[0]);
	if(tile.currentLogIndex > 0) {
		bindTexture(PrehistoryAgeClient.campfire[tile.currentLogIndex]);
	}		
	GL11.glPushMatrix();
	model.renderModel(0.0625F, Math.min(tile.logCount, 8));
	GL11.glPopMatrix();
	GL11.glPopMatrix();

	if(tile.isBurning() && tile.spitStack != null) {
		entityItem.setEntityItemStack(tile.spitStack);
		GL11.glPushMatrix();
		GL11.glTranslated(x, y, z);	
		
		if(tile.frameDirection == 1) {
			GL11.glTranslated(0.425D, 0.75D, 0.5D);
			GL11.glRotatef(-45F, 0.0F, 0.0F, 1.0F);
		} else {
			GL11.glTranslated(0.5D, 0.75D, 0.425D);
			GL11.glRotatef(45F, 1.0F, 0.0F, 0.0F);
		}
		GL11.glRotatef(90 + (tile.frameDirection * 90), 0.0F, 1.0F, 0.0F);			

		RenderItem.renderInFrame = true;
		RenderManager.instance.renderEntityWithPosYaw(entityItem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
		RenderItem.renderInFrame = false;

		GL11.glPopMatrix();
	}
}
 
開發者ID:AgeCraft,項目名稱:AgeCraft-Old,代碼行數:35,代碼來源:TileEntityRendererPrehistoryCampfire.java

示例9: renderTileEntityAt

import net.minecraft.client.renderer.entity.RenderItem; //導入方法依賴的package包/類
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
	final TileEntitySelector selector = (TileEntitySelector)tileEntity;
	final Orientation orientation = selector.getOrientation();

	GL11.glPushMatrix();
	GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
	TransformProvider.instance.multMatrix(orientation);
	GL11.glTranslated(-0.5, 0.501, -0.5); // 0.001 offset for 2d items in fast mode

	final int gridSize = selector.getGridSize();

	renderer.setRenderManager(RenderManager.instance);

	for (ItemSlot slot : selector.getSlots(gridSize)) {
		ItemStack stack = selector.getSlot(slot.slot);
		if (stack != null) {
			EntityItem display = selector.getDisplayEntity();

			GL11.glPushMatrix();
			GL11.glTranslated(slot.x, 0, slot.y + 0.03); // 0.03, since items are rendered off-center
			GL11.glRotated(-90, 1, 0, 0);
			final double scale = slot.size * 5;
			GL11.glScaled(scale, scale, scale);
			display.setEntityItemStack(stack);
			RenderItem.renderInFrame = true;
			renderer.doRender(display, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
			GL11.glPopMatrix();
		}
	}

	RenderItem.renderInFrame = false;

	GL11.glPopMatrix();
}
 
開發者ID:OpenMods,項目名稱:OpenPeripheral-Addons,代碼行數:36,代碼來源:TileEntitySelectorRenderer.java

示例10: renderItem

import net.minecraft.client.renderer.entity.RenderItem; //導入方法依賴的package包/類
@Override
public void renderItem(final @Nullable ItemRenderType type, final @Nullable ItemStack item, final @Nullable Object... data) {
	OpenGL.glPushMatrix();
	if (type==ItemRenderType.ENTITY&&CurrentMode.instance.isState(CurrentMode.State.SEE)) {
		OpenGL.glPushMatrix();
		WRenderer.startTexture();
		OpenGL.glColor4f(1f, 1f, 1f, Config.getConfig().renderSeeOpacity.get().floatValue());
		OpenGL.glTranslatef(-.5f, -.25f, 0.0625f/2f);
		renderSign();
		OpenGL.glPopMatrix();
	}
	OpenGL.glPushAttrib();
	OpenGL.glDisable(GL_CULL_FACE);
	final Entry entry = ItemEntryId.fromItemStack(item).entry();
	final AttrReaders attr = entry.getMeta();
	final Content content = entry.getContent();
	// Size
	final SizeData size01 = content!=null ? content.image.getSize() : SizeData.DefaultSize;
	final SizeData size = attr.sizes.getMovie().get().aspectSize(size01);
	final GuiImage gui = entry.getGui();
	if (type==ItemRenderType.INVENTORY) {
		final float slot = 16f;
		final SizeData size2 = ImageSizes.INNER.defineSize(size, slot, slot);
		OpenGL.glTranslatef((slot-size2.getWidth())/2f, (slot-size2.getHeight())/2f, 0f);
		OpenGL.glScalef(slot, slot, 1f);
		gui.drawScreen(0, 0, 0f, 1f, size2.getWidth()/slot, size2.getHeight()/slot, new RenderOption());
	} else {
		if (type==ItemRenderType.ENTITY) {
			if (RenderItem.renderInFrame) {
				OpenGL.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
				OpenGL.glTranslatef(0f, 0.025f, 0f);
				OpenGL.glScalef(1.6F, -1.6F, 1f);
				final float f = 0.0078125F; // vanilla map offset
				OpenGL.glTranslatef(-size.getWidth()/2f, -.5f, f*4);
			} else {
				OpenGL.glRotatef(180f, 1f, 0f, 0f);
				OpenGL.glScalef(2f, 2f, 1f);
				OpenGL.glTranslatef(.5f, -1f, 0f);
				OpenGL.glScalef(-1f, 1f, 1f);
				OpenGL.glTranslatef(-(size.getWidth()-1f)/2f, .125f, 0f);
			}
		} else {
			OpenGL.glScalef(2f, 2f, 1f);
			OpenGL.glTranslatef(.5f, 1f, 0f);
			OpenGL.glScalef(-1f, -1f, 1f);
		}
		OpenGL.glTranslatef(size.getWidth()/2f, .5f, 0f);
		OpenGL.glScalef(1f, -1f, 1f);
		gui.renderSignPicture(1f, 1f, new RenderOption());
		/*
		OpenGL.glTranslatef(0f, 1f-size.getHeight(), 0f);
		final OffsetData offset = attr.offsets.getMovie().get();
		OpenGL.glTranslatef(offset.x.offset, -offset.y.offset, offset.z.offset);
		RotationGL.glRotate(attr.rotations.getMovie().get().getRotate());
		entry.gui.drawScreen(0, 0, 0f, 1f, size.getWidth(), size.getHeight());
		*/
	}
	OpenGL.glPopAttrib();
	OpenGL.glPopMatrix();
}
 
開發者ID:Team-Fruit,項目名稱:SignPicture,代碼行數:61,代碼來源:CustomItemSignRenderer.java

示例11: renderEntityItem

import net.minecraft.client.renderer.entity.RenderItem; //導入方法依賴的package包/類
public static boolean renderEntityItem(EntityItem entity, ItemStack item, float bobing, float rotation, Random random, TextureManager engine, RenderBlocks renderBlocks, int count)
{
    IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, ENTITY);
    if (customRenderer == null)
    {
        return false;
    }

    if (customRenderer.shouldUseRenderHelper(ENTITY, item, ENTITY_ROTATION))
    {
        GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F);
    }
    if (!customRenderer.shouldUseRenderHelper(ENTITY, item, ENTITY_BOBBING))
    {
        GL11.glTranslatef(0.0F, -bobing, 0.0F);
    }
    boolean is3D = customRenderer.shouldUseRenderHelper(ENTITY, item, BLOCK_3D);

    engine.bindTexture(item.getItemSpriteNumber() == 0 ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture);
    Block block = item.getItem() instanceof ItemBlock ? Block.getBlockFromItem(item.getItem()) : null;
    if (is3D || (block != null && RenderBlocks.renderItemIn3d(block.getRenderType())))
    {
        int renderType = (block != null ? block.getRenderType() : 1);
        float scale = (renderType == 1 || renderType == 19 || renderType == 12 || renderType == 2 ? 0.5F : 0.25F);
        boolean blend = block != null && block.getRenderBlockPass() > 0;

        if (RenderItem.renderInFrame)
        {
            GL11.glScalef(1.25F, 1.25F, 1.25F);
            GL11.glTranslatef(0.0F, 0.05F, 0.0F);
            GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
        }

        if (blend)
        {
            GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
            GL11.glEnable(GL11.GL_BLEND);
            OpenGlHelper.glBlendFunc(770, 771, 1, 0);
        }

        GL11.glScalef(scale, scale, scale);

        for(int j = 0; j < count; j++)
        {
            GL11.glPushMatrix();
            if (j > 0)
            {
                GL11.glTranslatef(
                    ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / scale,
                    ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / scale,
                    ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / scale);
            }
            customRenderer.renderItem(ENTITY, item, renderBlocks, entity);
            GL11.glPopMatrix();
        }

        if (blend)
        {
            GL11.glDisable(GL11.GL_BLEND);
        }
    }
    else
    {
        GL11.glScalef(0.5F, 0.5F, 0.5F);
        customRenderer.renderItem(ENTITY, item, renderBlocks, entity);
    }
    return true;
}
 
開發者ID:alexandrage,項目名稱:CauldronGit,代碼行數:69,代碼來源:ForgeHooksClient.java

示例12: renderItem

import net.minecraft.client.renderer.entity.RenderItem; //導入方法依賴的package包/類
protected void renderItem(final ItemStack stack, final int x, final int y,
		final boolean includeQuantity, final int renderStyle) {

	if (stack == null)
		return;

	item.setEntityItemStack(stack);

	GL11.glPushMatrix();

	// Flip
	GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
	GL11.glTranslatef(xOffset[x], yOffset[y], FRONT_EDGE_OFFSET);
	GL11.glPushMatrix();

	GL11.glScalef(BLOCK_SCALE * 1.1F, BLOCK_SCALE * 1.1F,
			BLOCK_SCALE * 1.1F);

	final boolean save = RenderItem.renderInFrame;
	RenderItem.renderInFrame = true;
	GL11.glTranslatef(0.0F, 0.11F, 0.0F);
	GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F);
	itemRenderer.doRender(item, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
	RenderItem.renderInFrame = save;
	GL11.glPopMatrix();

	if (includeQuantity) {

		final FontRenderer font = Minecraft.getMinecraft().fontRenderer;

		// Move the number slightly in front of the item
		GL11.glTranslatef(0.02F, 0.02F, -0.11F);
		GL11.glNormal3f(0.0F, 1.0F, 0.0F);
		GL11.glScalef(-f1, -f1, f1);

		GL11.glDisable(2896);
		GL11.glDisable(3042);

		String amt = String.valueOf(stack.stackSize);
		font.drawString(amt, 13 - font.getStringWidth(amt), -12,
				RENDER_FORE_COLORS[renderStyle]);
		GL11.glEnable(2896);
	}

	GL11.glPopMatrix();
}
 
開發者ID:OreCruncher,項目名稱:ThermalRecycling,代碼行數:47,代碼來源:VendingTileEntityRenderer.java

示例13: renderItem

import net.minecraft.client.renderer.entity.RenderItem; //導入方法依賴的package包/類
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
    AlchemicalFireModel model = new AlchemicalFireModel();

    GL11.glPushMatrix();
    if (type == ItemRenderType.EQUIPPED_FIRST_PERSON)
    {
        GL11.glTranslatef(0.5F, 2.0F, 0.5F);
    }
    else if (RenderItem.renderInFrame)
    {
        GL11.glTranslatef(0.0F, 2.4F, 0.0F);
    }
    else if (type == ItemRenderType.EQUIPPED)
    {
        GL11.glTranslatef(0.5F, 1.9F, 0.5F);
        GL11.glEnable(GL11.GL_CULL_FACE);
    }
    else if (type == ItemRenderType.INVENTORY)
    {
        GL11.glTranslatef(0.5F, 1.7F, 0.5F);
    }
    else if (type == ItemRenderType.ENTITY)
    {
        GL11.glTranslatef(0.0F, 1.2F, 0.0F);
    }
    else
    {
        GL11.glTranslatef(0.5F, 1.2F, 0.5F);
    }

    Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(Dictionary.TEXTURE_ALCHEMICAL_FIRE));

    GL11.glPushMatrix();
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);

    model.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

    GL11.glPopMatrix();
    GL11.glPopMatrix();
}
 
開發者ID:msrEagle,項目名稱:Adventurers-Alchemy,代碼行數:43,代碼來源:AlchemicalFireItemRender.java

示例14: renderTileEntityAt

import net.minecraft.client.renderer.entity.RenderItem; //導入方法依賴的package包/類
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {

	boolean b = true;

	if (tileEntity instanceof TileEntityTwoInputs) {

		TileEntityTwoInputs tileEntityTwoInputs = (TileEntityTwoInputs) tileEntity;

		if (tileEntityTwoInputs.recipeType != EnumRecipeType.MISSILE_FACTORY) {
			b = false;
		}
	}

	if (System.currentTimeMillis() - lastTime >= targetTime) {
		lastTime = System.currentTimeMillis();
		rot += 3F;
		rot %= 360;
	}

	if (b) {
		
		GL11.glPushMatrix();

		EntityItem entItem = new EntityItem(Minecraft.getMinecraft().theWorld, 0D, 0D, 0D, stack);

		GL11.glPushMatrix();
		entItem.hoverStart = 0.0F;
		RenderItem.renderInFrame = false;
		GL11.glTranslatef((float) x + xOffset, (float) y + yOffset, (float) z + zOffset);
		GL11.glScalef(scale, scale, scale);

		if (Minecraft.getMinecraft().gameSettings.fancyGraphics) {
			GL11.glRotatef(rot, 0, 1, 0);
		}

		RenderManager.instance.renderEntityWithPosYaw(entItem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
		RenderItem.renderInFrame = false;
		GL11.glPopMatrix();
		GL11.glPopMatrix();

	}

}
 
開發者ID:TeamMonumental,項目名稱:FusionWarfare,代碼行數:45,代碼來源:RenderFloatingItem.java

示例15: renderFlatItem

import net.minecraft.client.renderer.entity.RenderItem; //導入方法依賴的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


注:本文中的net.minecraft.client.renderer.entity.RenderItem.renderInFrame方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。