use of net.minecraft.client.renderer.entity.RenderItem in project LogisticsPipes by RS485.
the class FluidContainerRenderer method doRenderItem.
public void doRenderItem(ItemStack itemstack, Minecraft mc, ItemRenderType type, Object[] data) {
useThis = false;
if (renderItem == null) {
renderItem = new RenderItem() {
@Override
public boolean shouldBob() {
return false;
}
;
@Override
public boolean shouldSpreadItems() {
return false;
}
;
};
renderItem.setRenderManager(RenderManager.instance);
}
if (type == ItemRenderType.INVENTORY) {
renderItem.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, itemstack, 0, 0);
} else {
GL11.glPushMatrix();
dummyEntityItem.setEntityItemStack(itemstack);
dummyEntityItem.hoverStart = 0;
GL11.glScalef(2F, 2F, 2F);
GL11.glRotatef(((((EntityItem) data[1]).age) / 20.0F + ((EntityItem) data[1]).hoverStart) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
renderItem.doRender(dummyEntityItem, 0, 0, 0, 0, 0);
GL11.glPopMatrix();
}
useThis = true;
}
use of net.minecraft.client.renderer.entity.RenderItem in project PneumaticCraft by MineMaarten.
the class GuiAnimatedStat method render.
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
lastMouseX = mouseX;
lastMouseY = mouseY;
float zLevel = 0;
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
int renderBaseX = (int) (oldBaseX + (baseX - oldBaseX) * partialTicks);
int renderAffectedY = (int) (oldAffectedY + (affectedY - oldAffectedY) * partialTicks);
int renderWidth = (int) (oldWidth + (width - oldWidth) * partialTicks);
int renderHeight = (int) (oldHeight + (height - oldHeight) * partialTicks);
if (leftSided)
renderWidth *= -1;
Gui.drawRect(renderBaseX, renderAffectedY, /* + 1 */
renderBaseX + renderWidth, /*- 1*/
renderAffectedY + renderHeight, backGroundColor);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glLineWidth(3.0F);
GL11.glColor4d(0, 0, 0, 1);
Tessellator tess = Tessellator.instance;
tess.startDrawing(GL11.GL_LINE_LOOP);
tess.addVertex(renderBaseX, renderAffectedY, zLevel);
tess.addVertex(renderBaseX + renderWidth, renderAffectedY, zLevel);
tess.addVertex(renderBaseX + renderWidth, renderAffectedY + renderHeight, zLevel);
tess.addVertex(renderBaseX, renderAffectedY + renderHeight, zLevel);
tess.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
if (leftSided)
renderWidth *= -1;
// if done expanding, draw the information
if (doneExpanding) {
GL11.glPushMatrix();
GL11.glTranslated(renderBaseX + (leftSided ? -renderWidth : 16), renderAffectedY, 0);
GL11.glScaled(textSize, textSize, textSize);
GL11.glTranslated(-renderBaseX - (leftSided ? -renderWidth : 16), -renderAffectedY, 0);
fontRenderer.drawStringWithShadow(title, renderBaseX + (leftSided ? -renderWidth + 2 : 18), renderAffectedY + 2, 0xFFFF00);
for (int i = curScroll; i < textList.size() && i < curScroll + MAX_LINES; i++) {
if (textList.get(i).contains("ยง0") || textList.get(i).contains(EnumChatFormatting.DARK_RED.toString())) {
fontRenderer.drawString(textList.get(i), renderBaseX + (leftSided ? -renderWidth + 2 : 18), renderAffectedY + (i - curScroll) * 10 + 12, 0xFFFFFF);
} else {
fontRenderer.drawStringWithShadow(textList.get(i), renderBaseX + (leftSided ? -renderWidth + 2 : 18), renderAffectedY + (i - curScroll) * 10 + 12, 0xFFFFFF);
}
}
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(renderBaseX, renderAffectedY, 0);
GL11.glEnable(GL11.GL_TEXTURE_2D);
for (IGuiWidget widget : widgets) widget.render(mouseX - renderBaseX, mouseY - renderAffectedY, partialTicks);
GL11.glPopMatrix();
}
if (renderHeight > 16 && renderWidth > 16) {
GL11.glColor4d(1, 1, 1, 1);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
if (iStack == null) {
if (texture.contains(Textures.GUI_LOCATION)) {
GuiPneumaticContainerBase.drawTexture(texture, renderBaseX - (leftSided ? 16 : 0), renderAffectedY);
} else {
fontRenderer.drawString(texture, renderBaseX - (leftSided ? 16 : 0), renderAffectedY, 0xFFFFFFFF);
}
} else if (gui != null || !(iStack.getItem() instanceof ItemBlock)) {
if (itemRenderer == null)
itemRenderer = new RenderItem();
itemRenderer.zLevel = 1;
GL11.glPushMatrix();
GL11.glTranslated(0, 0, -50);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
itemRenderer.renderItemAndEffectIntoGUI(fontRenderer, FMLClientHandler.instance().getClient().renderEngine, iStack, renderBaseX - (leftSided ? 16 : 0), renderAffectedY);
GL11.glEnable(GL11.GL_ALPHA_TEST);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
}
}
use of net.minecraft.client.renderer.entity.RenderItem in project PneumaticCraft by MineMaarten.
the class ProgWidgetItemFilter method drawItemStack.
public static void drawItemStack(ItemStack p_146982_1_, int p_146982_2_, int p_146982_3_, String p_146982_4_) {
RenderHelper.disableStandardItemLighting();
GL11.glPushMatrix();
Minecraft mc = Minecraft.getMinecraft();
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
// zLevel = 200.0F;
if (itemRender == null)
itemRender = new RenderItem();
itemRender.zLevel = 200.0F;
FontRenderer font = null;
if (p_146982_1_ != null)
font = p_146982_1_.getItem().getFontRenderer(p_146982_1_);
if (font == null)
font = mc.fontRenderer;
itemRender.renderItemAndEffectIntoGUI(font, mc.getTextureManager(), p_146982_1_, p_146982_2_, p_146982_3_);
itemRender.renderItemOverlayIntoGUI(font, mc.getTextureManager(), p_146982_1_, p_146982_2_, p_146982_3_, p_146982_4_);
GL11.glPopMatrix();
//GL11.glEnable(GL11.GL_LIGHTING);
RenderHelper.enableGUIStandardItemLighting();
// zLevel = 0.0F;
// itemRender.zLevel = 0.0F;
GL11.glDisable(GL11.GL_LIGHTING);
}
use of net.minecraft.client.renderer.entity.RenderItem in project BluePower by Qmunity.
the class TubeStack method render.
@SideOnly(Side.CLIENT)
public void render(float partialTick) {
if (renderMode == RenderMode.AUTO) {
renderMode = Minecraft.getMinecraft().gameSettings.fancyGraphics ? RenderMode.NORMAL : RenderMode.REDUCED;
}
final RenderMode finalRenderMode = renderMode;
if (customRenderItem == null) {
customRenderItem = new RenderItem() {
@Override
public boolean shouldBob() {
return false;
}
;
@Override
public byte getMiniBlockCount(ItemStack stack, byte original) {
return finalRenderMode == RenderMode.REDUCED ? (byte) 1 : original;
}
};
customRenderItem.setRenderManager(RenderManager.instance);
renderedItem = new EntityItem(FMLClientHandler.instance().getWorldClient());
renderedItem.hoverStart = 0.0F;
}
renderedItem.setEntityItemStack(stack);
double renderProgress = (oldProgress + (progress - oldProgress) * partialTick) * 2 - 1;
GL11.glPushMatrix();
GL11.glTranslated(heading.offsetX * renderProgress * 0.5, heading.offsetY * renderProgress * 0.5, heading.offsetZ * renderProgress * 0.5);
if (finalRenderMode != RenderMode.NONE) {
GL11.glPushMatrix();
if (stack.stackSize > 5) {
GL11.glScaled(0.8, 0.8, 0.8);
}
if (!(stack.getItem() instanceof ItemBlock)) {
GL11.glScaled(0.8, 0.8, 0.8);
GL11.glTranslated(0, -0.15, 0);
}
customRenderItem.doRender(renderedItem, 0, 0, 0, 0, 0);
GL11.glPopMatrix();
} else {
float size = 0.02F;
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glBegin(GL11.GL_QUADS);
RenderHelper.drawColoredCube(new Vec3dCube(-size, -size, -size, size, size, size), 1, 1, 1, 1);
GL11.glEnd();
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
if (color != TubeColor.NONE) {
float size = 0.2F;
int colorInt = ItemDye.field_150922_c[color.ordinal()];
float red = (colorInt >> 16) / 256F;
float green = (colorInt >> 8 & 255) / 256F;
float blue = (colorInt & 255) / 256F;
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glColor3f(red, green, blue);
Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(Refs.MODID, "textures/blocks/tubes/inside_color_border.png"));
RenderHelper.drawTesselatedTexturedCube(new Vec3dCube(-size, -size, -size, size, size, size));
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_LIGHTING);
}
GL11.glPopMatrix();
}
use of net.minecraft.client.renderer.entity.RenderItem in project LogisticsPipes by RS485.
the class LogisticsRenderPipe method renderItemStackOnSign.
public void renderItemStackOnSign(ItemStack itemstack) {
if (itemstack == null || itemstack.getItem() == null) {
// Only happens on false configuration
return;
}
Item item = itemstack.getItem();
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, ItemRenderType.INVENTORY);
Minecraft.getMinecraft().renderEngine.bindTexture(itemstack.getItemSpriteNumber() == 0 ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture);
GL11.glPushMatrix();
if (customRenderer != null) {
if (customRenderer.shouldUseRenderHelper(ItemRenderType.INVENTORY, itemstack, ItemRendererHelper.INVENTORY_BLOCK)) {
GL11.glScalef(0.20F, -0.20F, -0.01F);
GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-45.0F, 0.0F, 1.0F, 0.0F);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_LIGHT0);
GL11.glDisable(GL11.GL_LIGHT1);
GL11.glDisable(GL11.GL_COLOR_MATERIAL);
customRenderer.renderItem(ItemRenderType.INVENTORY, itemstack, renderBlocks);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_LIGHT0);
GL11.glEnable(GL11.GL_LIGHT1);
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
} else {
GL11.glScalef(0.018F, -0.018F, -0.01F);
GL11.glTranslatef(-7F, -8F, 0F);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_LIGHT0);
GL11.glDisable(GL11.GL_LIGHT1);
GL11.glDisable(GL11.GL_COLOR_MATERIAL);
customRenderer.renderItem(ItemRenderType.INVENTORY, itemstack, renderBlocks);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_LIGHT0);
GL11.glEnable(GL11.GL_LIGHT1);
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
}
} else if (item instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item).getRenderType())) {
GL11.glScalef(0.20F, -0.20F, -0.01F);
GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-45.0F, 0.0F, 1.0F, 0.0F);
renderBlocks.useInventoryTint = false;
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_LIGHT0);
GL11.glDisable(GL11.GL_LIGHT1);
GL11.glDisable(GL11.GL_COLOR_MATERIAL);
renderBlocks.renderBlockAsItem(Block.getBlockFromItem(item), itemstack.getItemDamage(), 1.0F);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_LIGHT0);
GL11.glEnable(GL11.GL_LIGHT1);
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
} else {
GL11.glScalef(0.02F, -0.02F, -0.01F);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_LIGHT0);
GL11.glDisable(GL11.GL_LIGHT1);
GL11.glDisable(GL11.GL_COLOR_MATERIAL);
GL11.glTranslatef(-8F, -8F, 0.0F);
if (item.requiresMultipleRenderPasses()) {
for (int var14 = 0; var14 < item.getRenderPasses(itemstack.getItemDamage()); ++var14) {
IIcon var15 = item.getIconFromDamageForRenderPass(itemstack.getItemDamage(), var14);
renderItem(var15);
}
} else {
renderItem(item.getIconIndex(itemstack));
}
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_LIGHT0);
GL11.glEnable(GL11.GL_LIGHT1);
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
}
GL11.glPopMatrix();
}
Aggregations