net.minecraft.client.renderer.entity.RenderItem Java Examples
The following examples show how to use
net.minecraft.client.renderer.entity.RenderItem.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BWItem.java From NOVA-Core with GNU Lesser General Public License v3.0 | 6 votes |
public BWItem(net.minecraft.item.Item item, int meta, NBTTagCompound tag) { this.item = item; this.meta = meta; this.tag = tag; components.add(new StaticRenderer()) .onRender(model -> { model.addChild(new CustomModel(self -> { Tessellator.instance.draw(); GL11.glPushMatrix(); DoubleBuffer buffer = BufferUtils.createDoubleBuffer(4 * 4); double[] flatArray = Arrays.stream(self.matrix.getMatrix().getData()) .flatMapToDouble(Arrays::stream) .toArray(); buffer.put(flatArray); buffer.position(0); GL11.glMultMatrix(buffer); RenderItem.getInstance().doRender(fakeEntity, 0, 0, 0, 0, 0); GL11.glPopMatrix(); Tessellator.instance.startDrawingQuads(); })); } ); }
Example #2
Source File: ItemIcon.java From OpenPeripheral-Addons with MIT License | 6 votes |
@Override @SideOnly(Side.CLIENT) protected void drawContents(RenderState renderState, float partialTicks) { renderState.enableTexture(); renderState.enableDepthTest(); renderState.enableCullFace(); renderState.disableLight(); renderState.setColor(0xFFFFFF, 1.0f); GL11.glScalef(scale, scale, scale); final RenderItem renderItem = getRenderItem(); final Minecraft minecraft = Minecraft.getMinecraft(); final TextureManager textureManager = minecraft.getTextureManager(); renderItem.renderItemAndEffectIntoGUI(minecraft.fontRenderer, textureManager, drawStack, 0, 0); if (damageBar > 0 || !Strings.isNullOrEmpty(label)) { renderItem.renderItemOverlayIntoGUI(minecraft.fontRenderer, textureManager, dummyStack, 0, 0, label); } RenderUtils.disableLightmap(); renderState.readState(); }
Example #3
Source File: ElementRenderer.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
public static void render(List<ItemStack> itemStacks, int x, double y, boolean showDurability) { GlStateManager.pushMatrix(); int line = 0; RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); for (ItemStack stack : itemStacks) { if (stack.getMaxDamage() == 0) continue; String dur = stack.getMaxDamage() - stack.getItemDamage() + ""; renderItem.renderItemAndEffectIntoGUI(stack, (int) (x / ElementRenderer.getCurrentScale() - (current.isRightSided() ? (showDurability ? currentScale + fontRendererObj.getStringWidth(dur) : -8) : 0)), (int) ((y + (16 * line * ElementRenderer.getCurrentScale())) / ElementRenderer.getCurrentScale())); if (showDurability) ElementRenderer.draw((int) (x + (double) 20 * currentScale), y + (16 * line) + 4, dur); line++; } GlStateManager.popMatrix(); }
Example #4
Source File: ShowArmor.java From ehacks-pro with GNU General Public License v3.0 | 5 votes |
private void drawItemStack(ItemStack itemStack, int x, int y) { if (itemStack == null) { return; } RenderHelper.enableGUIStandardItemLighting(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); RenderItem.getInstance().renderItemAndEffectIntoGUI(Wrapper.INSTANCE.mc().fontRenderer, Wrapper.INSTANCE.mc().renderEngine, itemStack, x - 8, y); RenderItem.getInstance().renderItemOverlayIntoGUI(Wrapper.INSTANCE.mc().fontRenderer, Wrapper.INSTANCE.mc().renderEngine, itemStack, x - 8, y); GL11.glDisable(GL12.GL_RESCALE_NORMAL); RenderHelper.disableStandardItemLighting(); }
Example #5
Source File: RenderAutoChisel.java From Chisel-2 with GNU General Public License v2.0 | 5 votes |
public RenderAutoChisel() { Chisel.renderAutoChiselId = RenderingRegistry.getNextAvailableRenderId(); renderItem = new RenderItem() { @Override public boolean shouldBob() { return false; } }; renderItem.setRenderManager(RenderManager.instance); }
Example #6
Source File: RenderEntityChopperSeeds.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
public RenderEntityChopperSeeds(){ itemRenderer = new RenderItem(){ @Override public boolean shouldBob(){ return false; }; }; itemRenderer.setRenderManager(RenderManager.instance); }
Example #7
Source File: RenderDroneAI.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
public RenderDroneAI(EntityDrone drone){ this.drone = drone; renderItem = new RenderItem(); renderItem.setRenderManager(RenderManager.instance); entityItem = new EntityItem(drone.worldObj); update(); }
Example #8
Source File: TileEntitySelectorRenderer.java From OpenPeripheral-Addons with MIT License | 5 votes |
@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(); }
Example #9
Source File: BW_GT_ItemRenderer.java From bartworks with MIT License | 4 votes |
@Override public void renderItem(IItemRenderer.ItemRenderType type, ItemStack aStack, Object... data) { if (!GT_Utility.isStackInvalid(aStack)) { short aMetaData = (short) aStack.getItemDamage(); if (aMetaData >= 0) { BW_Meta_Items.BW_GT_MetaGen_Item_Hook aItem = (BW_Meta_Items.BW_GT_MetaGen_Item_Hook) aStack.getItem(); GL11.glEnable(3042); if (type == IItemRenderer.ItemRenderType.ENTITY) { if (RenderItem.renderInFrame) { GL11.glScalef(0.85F, 0.85F, 0.85F); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); } GL11.glTranslated(-0.5D, -0.42D, 0.0D); } GL11.glColor3f(1.0F, 1.0F, 1.0F); IIcon tIcon = (IIcon) BW_Util.get2DCoordFrom1DArray(aMetaData, 0, 2, aItem.mIconList); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); GL11.glBlendFunc(770, 771); if (type.equals(IItemRenderer.ItemRenderType.INVENTORY)) { if (aMetaData < CircuitImprintLoader.reverseIDs) GT_RenderUtil.renderItemIcon(tIcon, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F); else { for (int i = 0; i < 4; i++) { GT_RenderUtil.renderItemIcon(tIcon, 0.0D+i*2D,0.0D+i*2D,10.0D+i*2D,10.0D+i*2D, 0.001D, 0.0F, 0.0F, -1.0F); } } } else { if (aMetaData < CircuitImprintLoader.reverseIDs) ItemRenderer.renderItemIn2D(Tessellator.instance,tIcon.getMaxU(), tIcon.getMinV(), tIcon.getMinU(), tIcon.getMaxV(), tIcon.getIconWidth(), tIcon.getIconHeight(), 0.0625F); // else { // for (int i = 0; i < 4; i++) { // ItemRenderer.renderItemIn2D(Tessellator.instance, 0.0F+i*2F,0.0F+i*2F,10.0F+i*2F,10.0F+i*2F, tIcon.getIconWidth(), tIcon.getIconHeight(),0.0625F); // } // } // ItemRenderer.renderItemIn2D(Tessellator.instance, tIcon.getMaxU(), tIcon.getMinV(), tIcon.getMinU(), tIcon.getMaxV(), tIcon.getIconWidth(), tIcon.getIconHeight(), 0.0625F); } IIcon tOverlay = (IIcon) BW_Util.get2DCoordFrom1DArray(aMetaData, 1, 2, aItem.mIconList); GL11.glColor3f(1.0F, 1.0F, 1.0F); if (tOverlay != null) { Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); GL11.glBlendFunc(770, 771); if (type.equals(IItemRenderer.ItemRenderType.INVENTORY)) { GT_RenderUtil.renderItemIcon(tOverlay, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F); } else { ItemRenderer.renderItemIn2D(Tessellator.instance, tOverlay.getMaxU(), tOverlay.getMinV(), tOverlay.getMinU(), tOverlay.getMaxV(), tOverlay.getIconWidth(), tOverlay.getIconHeight(), 0.0625F); } } } GL11.glDisable(3042); } }
Example #10
Source File: HyperiumRenderItem.java From Hyperium with GNU Lesser General Public License v3.0 | 4 votes |
public HyperiumRenderItem(RenderItem parent) { this.parent = parent; }
Example #11
Source File: ArmourHud.java From Hyperium with GNU Lesser General Public License v3.0 | 4 votes |
private void drawArmour(int x, double y) { RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; if (thePlayer == null || renderItem == null) return; ElementRenderer.render(list, x, y, dur); }
Example #12
Source File: MixinRenderManger.java From Hyperium with GNU Lesser General Public License v3.0 | 4 votes |
@Inject(method = "<init>", at = @At("RETURN")) private void injectEntities(TextureManager renderEngineIn, RenderItem itemRendererIn, CallbackInfo ci) { entityRenderMap.put(EntityHamster.class, new RenderHamster((RenderManager) (Object) this)); }
Example #13
Source File: ShowArmor.java From ehacks-pro with GNU General Public License v3.0 | 4 votes |
private int drawHoveringText(List<String> text, int x, int y, FontRenderer font) { int t = 0; if (!text.isEmpty()) { GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); int k = 0; for (String s : text) { int l = font.getStringWidth(s); if (l > k) { k = l; } } int j2 = x; int k2 = y; int i1 = 8; if (text.size() > 1) { i1 += 2 + (text.size() - 1) * 10; } t = i1; RenderItem.getInstance().zLevel = 300.0F; int j1 = -267386864; this.drawGradientRect(j2 - 3, k2 - 4, j2 + k + 3, k2 - 3, j1, j1); this.drawGradientRect(j2 - 3, k2 + i1 + 3, j2 + k + 3, k2 + i1 + 4, j1, j1); this.drawGradientRect(j2 - 3, k2 - 3, j2 + k + 3, k2 + i1 + 3, j1, j1); this.drawGradientRect(j2 - 4, k2 - 3, j2 - 3, k2 + i1 + 3, j1, j1); this.drawGradientRect(j2 + k + 3, k2 - 3, j2 + k + 4, k2 + i1 + 3, j1, j1); int k1 = 1347420415; int l1 = (k1 & 16711422) >> 1 | k1 & -16777216; this.drawGradientRect(j2 - 3, k2 - 3 + 1, j2 - 3 + 1, k2 + i1 + 3 - 1, k1, l1); this.drawGradientRect(j2 + k + 2, k2 - 3 + 1, j2 + k + 3, k2 + i1 + 3 - 1, k1, l1); this.drawGradientRect(j2 - 3, k2 - 3, j2 + k + 3, k2 - 3 + 1, k1, k1); this.drawGradientRect(j2 - 3, k2 + i1 + 2, j2 + k + 3, k2 + i1 + 3, l1, l1); for (int i2 = 0; i2 < text.size(); ++i2) { String s1 = text.get(i2); font.drawStringWithShadow(s1, j2, k2, -1); if (i2 == 0) { k2 += 2; } k2 += 10; } RenderItem.getInstance().zLevel = 0.0F; GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL12.GL_RESCALE_NORMAL); } return t; }
Example #14
Source File: ModelAssemblyIOUnit.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
public ModelAssemblyIOUnit(){ // EE3 snippet, to initialize an EntityItem which doesn't bob. customRenderItem = new RenderItem(){ @Override public boolean shouldBob(){ return false; }; }; customRenderItem.setRenderManager(RenderManager.instance); textureWidth = 64; textureHeight = 64; Base = new ModelRenderer(this, 0, 0); Base.addBox(0F, 0F, 1F, 16, 1, 16); Base.setRotationPoint(-8F, 23F, -9F); Base.setTextureSize(64, 32); Base.mirror = true; setRotation(Base, 0F, 0F, 0F); BaseTurn = new ModelRenderer(this, 0, 17); BaseTurn.addBox(0F, 0F, 0F, 7, 1, 7); BaseTurn.setRotationPoint(-3.5F, 22F, -3.5F); BaseTurn.setTextureSize(64, 32); BaseTurn.mirror = true; setRotation(BaseTurn, 0F, 0F, 0F); BaseTurn2 = new ModelRenderer(this, 28, 17); BaseTurn2.addBox(0F, 0F, 0F, 4, 5, 4); BaseTurn2.setRotationPoint(-2F, 17F, -2F); BaseTurn2.setTextureSize(64, 32); BaseTurn2.mirror = true; setRotation(BaseTurn2, 0F, 0F, 0F); ArmBase1 = new ModelRenderer(this, 0, 25); ArmBase1.addBox(0F, 0F, 0F, 1, 2, 8); ArmBase1.setRotationPoint(2F, 17F, -1F); ArmBase1.setTextureSize(64, 32); ArmBase1.mirror = true; setRotation(ArmBase1, 0F, 0F, 0F); ArmBase2 = new ModelRenderer(this, 0, 25); ArmBase2.addBox(0F, 0F, 0F, 1, 2, 8); ArmBase2.setRotationPoint(-3F, 17F, -1F); ArmBase2.setTextureSize(64, 32); ArmBase2.mirror = true; setRotation(ArmBase2, 0F, 0F, 0F); SupportMiddle = new ModelRenderer(this, 0, 57); SupportMiddle.addBox(0F, 0F, 0F, 2, 1, 1); SupportMiddle.setRotationPoint(-1F, 17.5F, 5.5F); SupportMiddle.setTextureSize(64, 32); SupportMiddle.mirror = true; setRotation(SupportMiddle, 0F, 0F, 0F); ArmMiddle1 = new ModelRenderer(this, 0, 35); ArmMiddle1.addBox(0F, 0F, 0F, 1, 17, 2); ArmMiddle1.setRotationPoint(-2F, 2F, 5F); ArmMiddle1.setTextureSize(64, 32); ArmMiddle1.mirror = true; setRotation(ArmMiddle1, 0F, 0F, 0F); ArmMiddle2 = new ModelRenderer(this, 0, 35); ArmMiddle2.addBox(0F, 0F, 0F, 1, 17, 2); ArmMiddle2.setRotationPoint(1F, 2F, 5F); ArmMiddle2.setTextureSize(64, 32); ArmMiddle2.mirror = true; setRotation(ArmMiddle2, 0F, 0F, 0F); ClawBase = new ModelRenderer(this, 8, 38); ClawBase.addBox(0F, 0F, 0F, 2, 2, 3); ClawBase.setRotationPoint(-1F, 2F, 4.5F); ClawBase.setTextureSize(64, 32); ClawBase.mirror = true; setRotation(ClawBase, 0F, 0F, 0F); ClawAxil = new ModelRenderer(this, 8, 45); ClawAxil.addBox(0F, 0F, 0F, 1, 1, 1); ClawAxil.setRotationPoint(-0.5F, 2.5F, 4F); ClawAxil.setTextureSize(64, 32); ClawAxil.mirror = true; setRotation(ClawAxil, 0F, 0F, 0F); ClawTurn = new ModelRenderer(this, 8, 49); ClawTurn.addBox(0F, 0F, 0F, 4, 2, 1); ClawTurn.setRotationPoint(-2F, 2F, 3F); ClawTurn.setTextureSize(64, 32); ClawTurn.mirror = true; setRotation(ClawTurn, 0F, 0F, 0F); Claw1 = new ModelRenderer(this, 8, 54); Claw1.addBox(0F, 0F, 0F, 1, 2, 1); Claw1.setRotationPoint(0F, 2F, 2F); Claw1.setTextureSize(64, 32); Claw1.mirror = true; setRotation(Claw1, 0F, 0F, 0F); Claw2 = new ModelRenderer(this, 8, 59); Claw2.addBox(0F, 0F, 0F, 1, 2, 1); Claw2.setRotationPoint(-1F, 2F, 2F); Claw2.setTextureSize(64, 32); Claw2.mirror = true; setRotation(Claw2, 0F, 0F, 0F); }
Example #15
Source File: ModelAssemblyPlatform.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
public ModelAssemblyPlatform(){ // EE3 snippet, to initialize an EntityItem which doesn't bob. customRenderItem = new RenderItem(){ @Override public boolean shouldBob(){ return false; }; }; customRenderItem.setRenderManager(RenderManager.instance); textureWidth = 64; textureHeight = 32; Base = new ModelRenderer(this, 0, 15); Base.addBox(0F, 0F, 0F, 16, 1, 16); Base.setRotationPoint(-8F, 23F, -8F); Base.setTextureSize(64, 32); Base.mirror = true; setRotation(Base, 0F, 0F, 0F); Platform = new ModelRenderer(this, 0, 6); Platform.addBox(0F, 0F, 0F, 8, 1, 8); Platform.setRotationPoint(-4F, 18F, -4F); Platform.setTextureSize(64, 32); Platform.mirror = true; setRotation(Platform, 0F, 0F, 0F); Leg1 = new ModelRenderer(this, 34, 0); Leg1.addBox(0F, 0F, 0F, 1, 6, 1); Leg1.setRotationPoint(2.3F, 18F, -3F); Leg1.setTextureSize(64, 32); Leg1.mirror = true; setRotation(Leg1, -0.5585054F, -0.7853982F, 0F); Leg2 = new ModelRenderer(this, 34, 0); Leg2.addBox(0F, 0F, 0F, 1, 6, 1); Leg2.setRotationPoint(-3F, 18F, -2.3F); Leg2.setTextureSize(64, 32); Leg2.mirror = true; setRotation(Leg2, -0.5585054F, 0.7853982F, 0F); Leg3 = new ModelRenderer(this, 34, 0); Leg3.addBox(0F, 0F, 0F, 1, 6, 1); Leg3.setRotationPoint(3F, 18F, 2.3F); Leg3.setTextureSize(64, 32); Leg3.mirror = true; setRotation(Leg3, -0.5585054F, -2.356194F, 0F); Leg4 = new ModelRenderer(this, 34, 0); Leg4.addBox(0F, 0F, 0F, 1, 6, 1); Leg4.setRotationPoint(-2.3F, 18F, 3F); Leg4.setTextureSize(64, 32); Leg4.mirror = true; setRotation(Leg4, -0.5585054F, 2.356194F, 0F); Claw1 = new ModelRenderer(this, 0, 0); Claw1.addBox(0F, 0F, 0F, 2, 1, 1); Claw1.setRotationPoint(-1F, 17F, 0F); Claw1.setTextureSize(64, 32); Claw1.mirror = true; setRotation(Claw1, 0F, 0F, 0F); Claw2 = new ModelRenderer(this, 0, 0); Claw2.addBox(0F, 0F, 0F, 2, 1, 1); Claw2.setRotationPoint(-1F, 17F, -1F); Claw2.setTextureSize(64, 32); Claw2.mirror = true; setRotation(Claw2, 0F, 0F, 0F); }
Example #16
Source File: ModelPressureChamberInterface.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
public ModelPressureChamberInterface(){ textureWidth = 128; textureHeight = 128; Shape1 = new ModelRenderer(this, 0, 0); Shape1.addBox(0F, 0F, 0F, 13, 3, 16); Shape1.setRotationPoint(-5F, 21F, -8F); Shape1.setTextureSize(128, 128); Shape1.mirror = true; setRotation(Shape1, 0F, 0F, 0F); Shape2 = new ModelRenderer(this, 0, 19); Shape2.addBox(0F, 0F, 0F, 3, 13, 16); Shape2.setRotationPoint(5F, 8F, -8F); Shape2.setTextureSize(128, 128); Shape2.mirror = true; setRotation(Shape2, 0F, 0F, 0F); Shape3 = new ModelRenderer(this, 58, 0); Shape3.addBox(0F, 0F, 0F, 13, 3, 16); Shape3.setRotationPoint(-8F, 8F, -8F); Shape3.setTextureSize(128, 128); Shape3.mirror = true; setRotation(Shape3, 0F, 0F, 0F); Shape4 = new ModelRenderer(this, 38, 19); Shape4.addBox(0F, 0F, 0F, 3, 13, 16); Shape4.setRotationPoint(-8F, 11F, -8F); Shape4.setTextureSize(128, 128); Shape4.mirror = true; setRotation(Shape4, 0F, 0F, 0F); Shape5 = new ModelRenderer(this, 0, 48); Shape5.addBox(0F, 0F, 0F, 2, 2, 16); Shape5.setRotationPoint(-5F, 11F, -8F); Shape5.setTextureSize(128, 128); Shape5.mirror = true; setRotation(Shape5, 0F, 0F, 0F); Shape6 = new ModelRenderer(this, 36, 48); Shape6.addBox(0F, 0F, 0F, 2, 2, 16); Shape6.setRotationPoint(3F, 11F, -8F); Shape6.setTextureSize(128, 128); Shape6.mirror = true; setRotation(Shape6, 0F, 0F, 0F); Shape7 = new ModelRenderer(this, 0, 66); Shape7.addBox(0F, 0F, 0F, 2, 2, 16); Shape7.setRotationPoint(-5F, 19F, -8F); Shape7.setTextureSize(128, 128); Shape7.mirror = true; setRotation(Shape7, 0F, 0F, 0F); Shape8 = new ModelRenderer(this, 36, 66); Shape8.addBox(0F, 0F, 0F, 2, 2, 16); Shape8.setRotationPoint(3F, 19F, -8F); Shape8.setTextureSize(128, 128); Shape8.mirror = true; setRotation(Shape8, 0F, 0F, 0F); Input = new ModelRenderer(this, 0, 84); Input.addBox(0F, 0F, 0F, 10, 10, 2); Input.setRotationPoint(-5F, 11F, -7.2F); Input.setTextureSize(128, 128); Input.mirror = true; setRotation(Input, 0F, 0F, 0F); Output = new ModelRenderer(this, 24, 84); Output.addBox(0F, 0F, 0F, 10, 10, 2); Output.setRotationPoint(-5F, 11F, 5.2F); Output.setTextureSize(128, 128); Output.mirror = true; setRotation(Output, 0F, 0F, 0F); setRotation(Output, 0F, 0F, 0F); // EE3 snippet, to initialize an EntityItem which doesn't bob. customRenderItem = new RenderItem(){ @Override public boolean shouldBob(){ return false; }; }; customRenderItem.setRenderManager(RenderManager.instance); }