protected void drawItem(ItemStack stack, int x, int y) { GlStateManager.color(1, 1, 1, 1); GlStateManager.translate(0.0F, 0.0F, 32.0F); GlStateManager.disableLighting(); GlStateManager.enableDepth(); RenderHelper.disableStandardItemLighting(); RenderHelper.enableGUIStandardItemLighting(); this.zLevel = 200.0F; this.itemRender.zLevel = 200.0F; net.minecraft.client.gui.FontRenderer font = null; if (stack != null) font = stack.getItem().getFontRenderer(stack); if (font == null) font = fontRendererObj; this.itemRender.renderItemAndEffectIntoGUI(stack, x, y); this.itemRender.renderItemOverlayIntoGUI(font, stack, x, y, null); this.zLevel = 0.0F; this.itemRender.zLevel = 0.0F; RenderHelper.enableStandardItemLighting(); GlStateManager.enableLighting(); GlStateManager.disableDepth(); }
@Override public void drawButton(Minecraft mc, int x, int y, float partialTicks) { if (thisVisible) super.drawButton(mc, x, y, partialTicks); if (visible) { if (renderedStacks != null) { int middleX = this.x + width / 2; int startX = middleX - renderedStacks.length * 9 + 1; GL11.glEnable(GL12.GL_RESCALE_NORMAL); RenderHelper.enableGUIStandardItemLighting(); for (int i = 0; i < renderedStacks.length; i++) { itemRenderer.renderItemAndEffectIntoGUI(renderedStacks[i], startX + i * 18, this.y + 2); } RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); } if (resLoc != null) { mc.getTextureManager().bindTexture(resLoc); drawModalRectWithCustomSizedTexture(this.x + width / 2 - 8, this.y + 2, 0, 0, 16, 16, 16, 16); } if (enabled && !thisVisible && x >= this.x && y >= this.y && x < this.x + width && y < this.y + height) { Gui.drawRect(this.x, this.y, this.x + width, this.y + height, invisibleHoverColor); } } }
@SideOnly(Side.CLIENT) @Override public void doRenderLayer(AbstractClientPlayer entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { if (!Arrays.asList(contributors.uuid).contains(entitylivingbaseIn.getUniqueID().toString())) return; if (!entitylivingbaseIn.isWearing(EnumPlayerModelParts.CAPE)) return; GlStateManager.pushMatrix(); GlStateManager.enableBlend(); GlStateManager.disableCull(); RenderHelper.disableStandardItemLighting(); if (Minecraft.isAmbientOcclusionEnabled()) { GlStateManager.shadeModel(GL11.GL_SMOOTH); } else { GlStateManager.shadeModel(GL11.GL_FLAT); } GlStateManager.translate(0, -0.015f, 0); if (!entitylivingbaseIn.inventory.armorInventory.get(3).isEmpty()) GlStateManager.translate(0, -0.02f, 0); if (entitylivingbaseIn.isSneaking()) GlStateManager.translate(0, 0.27, 0); GlStateManager.rotate(90, 0, 1, 0); GlStateManager.rotate(180, 1, 0, 0); GlStateManager.rotate(netHeadYaw, 0, -1, 0); GlStateManager.rotate(headPitch, 0, 0, -1); Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Calendar calendar = Calendar.getInstance(); if (calendar.get(Calendar.MONTH) == Calendar.OCTOBER) { spookyScarySkeletons(); } else if (calendar.get(Calendar.MONTH) == Calendar.DECEMBER) { itsSnowyHere(); } else { Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor(ClientProxy.ears_baked, 0.5f, 255, 255, 255); } RenderHelper.enableStandardItemLighting(); GlStateManager.depthMask(true); GlStateManager.popMatrix(); }
public void renderTileEntity(TileEntity tileentityIn, float partialTicks, int destroyStage) { if (tileentityIn.getDistanceSq(this.entityX, this.entityY, this.entityZ) < tileentityIn.getMaxRenderDistanceSquared()) { RenderHelper.enableStandardItemLighting(); boolean flag = true; if (Reflector.ForgeTileEntity_hasFastRenderer.exists()) { flag = !this.drawingBatch || !Reflector.callBoolean(tileentityIn, Reflector.ForgeTileEntity_hasFastRenderer, new Object[0]); } if (flag) { int i = this.worldObj.getCombinedLight(tileentityIn.getPos(), 0); int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); } BlockPos blockpos = tileentityIn.getPos(); this.renderTileEntityAt(tileentityIn, (double)blockpos.getX() - staticPlayerX, (double)blockpos.getY() - staticPlayerY, (double)blockpos.getZ() - staticPlayerZ, partialTicks, destroyStage); } }
public static void drawItemWithOverlay(ItemStack item, double x, double y, double scale) { GlStateManager.pushMatrix(); RenderHelper.enableGUIStandardItemLighting(); GlStateManager.disableLighting(); GlStateManager.enableRescaleNormal(); GlStateManager.enableColorMaterial(); GlStateManager.enableLighting(); MC.getRenderItem().zLevel = 100.f; renderItemAndEffectIntoGUI(getLocalPlayer(), item, x, y, 16.D); renderItemOverlayIntoGUI(MC.fontRenderer, item, x, y, null, scale); MC.getRenderItem().zLevel = 0.f; GlStateManager.popMatrix(); GlStateManager.disableLighting(); GlStateManager.enableDepth(); GlStateManager.color(1.f, 1.f, 1.f, 1.f); }
public static void drawPotionEffect(PotionEffect potion, int x, int y) { int index = potion.getPotion().getStatusIconIndex(); GlStateManager.pushMatrix(); RenderHelper.enableGUIStandardItemLighting(); GlStateManager.disableLighting(); GlStateManager.enableRescaleNormal(); GlStateManager.enableColorMaterial(); GlStateManager.enableLighting(); GlStateManager.enableTexture2D(); GlStateManager.color(1.f, 1.f, 1.f, 1.f); MC.getTextureManager().bindTexture(GuiContainer.INVENTORY_BACKGROUND); drawTexturedRect(x, y, index % 8 * 18, 198 + index / 8 * 18, 18, 18, 100); potion.getPotion().renderHUDEffect(x, y, potion, MC, 255); GlStateManager.disableLighting(); GlStateManager.enableDepth(); GlStateManager.color(1.f, 1.f, 1.f, 1.f); GlStateManager.popMatrix(); }
private void renderItem(TileEntityAnimaConjurer te) { ItemStack stack = te.getStack(); if (!stack.isEmpty()) { RenderHelper.enableStandardItemLighting(); GlStateManager.enableLighting(); GlStateManager.pushMatrix(); GlStateManager.translate(.5, 0.935, .5); GlStateManager.scale(.2f, .2f, .2f); GlStateManager.rotate(te.getFrameAge(), 0, 1, 0); GlStateManager.translate(0, Math.sin((Math.PI / 180) * (te.increaseFrameAge())) / 3.2 + 0.1, 0); if (te.getFrameAge() < 0 || te.getFrameAge() == Integer.MAX_VALUE) { te.setFrameAge(0); } Minecraft.getMinecraft().getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.NONE); GlStateManager.popMatrix(); } }
public IToast.Visibility draw(GuiToast toastGui, long delta) { toastGui.getMinecraft().getTextureManager().bindTexture(TEXTURE_TOASTS); GlStateManager.color(1.0F, 1.0F, 1.0F); toastGui.drawTexturedModalRect(0, 0, 0, 0, 160, 32); toastGui.getMinecraft().fontRenderer.drawString( I18n.format(expanded ? "toast.arcanemagic.page_expanded" : "toast.arcanemagic.page_unlocked"), 30, 7, 0x5bc14d); toastGui.getMinecraft().fontRenderer.drawString(I18n.format(unlocked.getUnlocalizedName()), 30, 18, 0x65a595); if (!this.hasPlayedSound && delta > 0L) { this.hasPlayedSound = true; toastGui.getMinecraft().getSoundHandler() .playSound(PositionedSoundRecord.getRecord(ArcaneMagicSoundHandler.randomLearnSound(), 1.0F, 1.0F)); } RenderHelper.enableGUIStandardItemLighting(); toastGui.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI((EntityLivingBase) null, unlocked.getIcon(), 8, 8); return delta >= 5000L ? IToast.Visibility.HIDE : IToast.Visibility.SHOW; }
/** * Draw the foreground layer for the GuiContainer (everything in front of the items) */ protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { RenderHelper.disableStandardItemLighting(); this.drawCenteredString(this.fontRendererObj, I18n.format("tile.beacon.primary", new Object[0]), 62, 10, 14737632); this.drawCenteredString(this.fontRendererObj, I18n.format("tile.beacon.secondary", new Object[0]), 169, 10, 14737632); for (GuiButton guibutton : this.buttonList) { if (guibutton.isMouseOver()) { guibutton.drawButtonForegroundLayer(mouseX - this.guiLeft, mouseY - this.guiTop); break; } } RenderHelper.enableGUIStandardItemLighting(); }
public void renderTileEntity(TileEntity tileentityIn, float partialTicks, int destroyStage) { if (tileentityIn.getDistanceSq(this.entityX, this.entityY, this.entityZ) < tileentityIn.getMaxRenderDistanceSquared()) { RenderHelper.enableStandardItemLighting(); if(!drawingBatch || !tileentityIn.hasFastRenderer()) { int i = this.worldObj.getCombinedLight(tileentityIn.getPos(), 0); int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); } BlockPos blockpos = tileentityIn.getPos(); this.renderTileEntityAt(tileentityIn, (double)blockpos.getX() - staticPlayerX, (double)blockpos.getY() - staticPlayerY, (double)blockpos.getZ() - staticPlayerZ, partialTicks, destroyStage); } }
/** * Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY */ protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { RenderHelper.disableStandardItemLighting(); this.drawCenteredString(this.fontRendererObj, I18n.format("tile.beacon.primary", new Object[0]), 62, 10, 14737632); this.drawCenteredString(this.fontRendererObj, I18n.format("tile.beacon.secondary", new Object[0]), 169, 10, 14737632); for (GuiButton guibutton : this.buttonList) { if (guibutton.isMouseOver()) { guibutton.drawButtonForegroundLayer(mouseX - this.guiLeft, mouseY - this.guiTop); break; } } RenderHelper.enableGUIStandardItemLighting(); }
protected void renderPage(ScaledResolution p_175258_1_, float p_175258_2_, int p_175258_3_, float p_175258_4_, SpectatorDetails p_175258_5_) { GlStateManager.enableRescaleNormal(); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.color(1.0F, 1.0F, 1.0F, p_175258_2_); this.mc.getTextureManager().bindTexture(WIDGETS); this.drawTexturedModalRect((float)(p_175258_3_ - 91), p_175258_4_, 0, 0, 182, 22); if (p_175258_5_.getSelectedSlot() >= 0) { this.drawTexturedModalRect((float)(p_175258_3_ - 91 - 1 + p_175258_5_.getSelectedSlot() * 20), p_175258_4_ - 1.0F, 0, 22, 24, 22); } RenderHelper.enableGUIStandardItemLighting(); for (int i = 0; i < 9; ++i) { this.renderSlot(i, p_175258_1_.getScaledWidth() / 2 - 90 + i * 20 + 2, p_175258_4_ + 3.0F, p_175258_2_, p_175258_5_.getObject(i)); } RenderHelper.disableStandardItemLighting(); GlStateManager.disableRescaleNormal(); GlStateManager.disableBlend(); }
public static void endRender() { if (isShadowPass) { checkGLError("shadow endRender"); } else { if (!isCompositeRendered) { renderCompositeFinal(); } isRenderingWorld = false; GlStateManager.colorMask(true, true, true, true); useProgram(0); RenderHelper.disableStandardItemLighting(); checkGLError("endRender end"); } }
protected void func_175258_a(ScaledResolution p_175258_1_, float p_175258_2_, int p_175258_3_, float p_175258_4_, SpectatorDetails p_175258_5_) { GlStateManager.enableRescaleNormal(); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.color(1.0F, 1.0F, 1.0F, p_175258_2_); this.field_175268_g.getTextureManager().bindTexture(field_175267_f); this.drawTexturedModalRect((float)(p_175258_3_ - 91), p_175258_4_, 0, 0, 182, 22); if (p_175258_5_.func_178681_b() >= 0) { this.drawTexturedModalRect((float)(p_175258_3_ - 91 - 1 + p_175258_5_.func_178681_b() * 20), p_175258_4_ - 1.0F, 0, 22, 24, 22); } RenderHelper.enableGUIStandardItemLighting(); for (int i = 0; i < 9; ++i) { this.func_175266_a(i, p_175258_1_.getScaledWidth() / 2 - 90 + i * 20 + 2, p_175258_4_ + 3.0F, p_175258_2_, p_175258_5_.func_178680_a(i)); } RenderHelper.disableStandardItemLighting(); GlStateManager.disableRescaleNormal(); GlStateManager.disableBlend(); }
@SuppressWarnings({"rawtypes", "unchecked"}) @SubscribeEvent public void renderWorldLastEvent(RenderWorldLastEvent event) { Minecraft mc = FMLClientHandler.instance().getClient(); EntityPlayer player = mc.player; double playerX = player.prevPosX + (player.posX - player.prevPosX) * event.getPartialTicks(); double playerY = player.prevPosY + (player.posY - player.prevPosY) * event.getPartialTicks(); double playerZ = player.prevPosZ + (player.posZ - player.prevPosZ) * event.getPartialTicks(); GL11.glPushMatrix(); GL11.glTranslated(-playerX, -playerY, -playerZ); RenderHelper.enableStandardItemLighting(); for (Map<BlockPos, List<ISemiBlock>> map : SemiBlockManager.getInstance(player.world).getSemiBlocks().values()) { for (List<ISemiBlock> semiBlocks : map.values()) { for(ISemiBlock semiBlock : semiBlocks){ ISemiBlockRenderer renderer = getRenderer(semiBlock); if (renderer != null) { GL11.glPushMatrix(); GL11.glTranslated(semiBlock.getPos().getX(), semiBlock.getPos().getY(), semiBlock.getPos().getZ()); renderer.render(semiBlock, event.getPartialTicks()); GL11.glPopMatrix(); } } } } RenderHelper.disableStandardItemLighting(); GL11.glPopMatrix(); }
@SideOnly(Side.CLIENT) @Override public void render() { GlStateManager.enableRescaleNormal(); RenderHelper.enableGUIStandardItemLighting(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240); Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(stack, 0, 0); RenderHelper.disableStandardItemLighting(); }
@Override public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) { if (this.visible) { this.hovered = mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + height; RenderHelper.enableGUIStandardItemLighting(); GlStateManager.scale(width / 16f, width / 16f, width / 16f); GlStateManager.color(1f, 1f, 1f); mc.getRenderItem().renderItemIntoGUI(stack, (int) (x / (width / 16f)), (int) (y / (width / 16f))); GlStateManager.scale(1 / (width / 16f), 1 / (width / 16f), 1 / (width / 16f)); } }
public static void drawEntityOnScreen(int posX, int posY, int scale, EntityLivingBase ent) { GlStateManager.enableColorMaterial(); GlStateManager.pushMatrix(); GlStateManager.translate(posX, posY, 50.0F); GlStateManager.scale((-scale), scale, scale); GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); float f = ent.renderYawOffset; float f1 = ent.rotationYaw; float f2 = ent.rotationPitch; float f3 = ent.prevRotationYawHead; float f4 = ent.rotationYawHead; GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); ent.renderYawOffset = 0; ent.rotationYaw = 0; ent.rotationPitch = 0; ent.rotationYawHead = ent.rotationYaw; ent.prevRotationYawHead = ent.rotationYaw; GlStateManager.translate(0.0F, 0.0F, 0.0F); RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); rendermanager.setPlayerViewY(180.0F); rendermanager.setRenderShadow(false); rendermanager.doRenderEntity(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false); rendermanager.setRenderShadow(true); ent.renderYawOffset = f; ent.rotationYaw = f1; ent.rotationPitch = f2; ent.prevRotationYawHead = f3; ent.rotationYawHead = f4; GlStateManager.popMatrix(); RenderHelper.disableStandardItemLighting(); GlStateManager.disableRescaleNormal(); GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); GlStateManager.disableTexture2D(); GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); }
@SideOnly(Side.CLIENT) @Override public void drawScreenPre(CategoryEntry entry, GUIBookBase base, int mouseX, int mouseY, float partialTicks, FontRenderer renderer) { //base.drawCenteredString(renderer, TextFormatting.AQUA+"Recipe"+TextFormatting.RESET, base.getGuiLeft()+base.getGuiXSize()/2,base.getGuiTop()+30,0xFFFFFF); base.mc.getTextureManager().bindTexture(GUIBookBase.BOOK_EXTRAS); base.drawTexturedModalRect(base.getGuiLeft() + 20, base.getGuiTop() + 64, 45, 1, 124, 62); int pos = 0; RenderHelper.enableGUIStandardItemLighting(); for (Ingredient ingredient : recipe.getIngredients()) { if (ingredient != null && ingredient.getMatchingStacks().length > 0) base.mc.getRenderItem().renderItemIntoGUI(ingredient.getMatchingStacks()[0], base.getGuiLeft() + 25 + (pos % 3) * 18, base.getGuiTop() + 69 + (pos / 3) * 18); ++pos; } base.mc.getRenderItem().renderItemIntoGUI(recipe.getRecipeOutput(), base.getGuiLeft() + 25 + 94, base.getGuiTop() + 69 + 18); }
@Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { if(mc == null) { mc = Minecraft.getMinecraft(); fontRenderer = mc.fontRenderer; } drawDefaultBackground(); GlStateManager.color(1F, 1F, 1F, 1F); this.mc.getTextureManager().bindTexture(texBackground); this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); trackList.drawScreen(mouseX, mouseY, partialTicks); super.drawScreen(mouseX, mouseY, partialTicks); GlStateManager.pushMatrix(); GlStateManager.enableDepth(); RenderHelper.enableGUIStandardItemLighting(); GlStateManager.translate(guiLeft + xSize + 3, guiTop + 2, 0); mc.getRenderItem().renderItemAndEffectIntoGUI(new ItemStack(GeneralLaymansAestheticSpyingScreen.blockGlass, 1, 2), 0, 0); RenderHelper.disableStandardItemLighting(); GlStateManager.disableDepth(); GlStateManager.popMatrix(); GlStateManager.pushMatrix(); GlStateManager.scale(0.5F, 0.5F, 0.5F); fontRenderer.drawString(I18n.translateToLocal("glass.gui.availableChannels"), (guiLeft + 5) / 0.5F, (guiTop + 5) / 0.5F, 16777215, true); GlStateManager.popMatrix(); }
private void renderItem(TilePedestal te) { ItemStack stack = te.getStack(); if (stack != null) { RenderHelper.enableStandardItemLighting(); GlStateManager.enableLighting(); GlStateManager.pushMatrix(); GlStateManager.translate(0.5, 0.75, 0.5); GlStateManager.scale(0.4F, .4F, 0.4F); Minecraft.getMinecraft().getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.NONE); GlStateManager.popMatrix(); } }
@SubscribeEvent public void guiRendered(TickEvent.RenderTickEvent evt) { if (CreeperHost.instance.toastText != null) { long curTime = System.currentTimeMillis(); if (CreeperHost.instance.fadeTime > curTime) { long fadeDiff = CreeperHost.instance.fadeTime - CreeperHost.instance.endTime; long curFade = Math.min(CreeperHost.instance.fadeTime - curTime, fadeDiff); float alpha = (float) curFade / (float) fadeDiff; RenderHelper.disableStandardItemLighting(); GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha); mc.renderEngine.bindTexture(getToastResourceLocation()); ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); drawTexturedModalRect(res.getScaledWidth() - 160, 0, u, v, 160, 32); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); int textColour = (0xFFFFFF << 32) | ((int) (alpha * 255) << 24); mc.fontRenderer.drawSplitString(CreeperHost.instance.toastText, res.getScaledWidth() - 160 + 5, 6, 160, textColour); } else { CreeperHost.instance.toastText = null; } } }
@SubscribeEvent public void guiRendered(TickEvent.RenderTickEvent evt) { if (CreeperHost.instance.toastText != null) { long curTime = System.currentTimeMillis(); if (CreeperHost.instance.fadeTime > curTime) { long fadeDiff = CreeperHost.instance.fadeTime - CreeperHost.instance.endTime; long curFade = Math.min(CreeperHost.instance.fadeTime - curTime, fadeDiff); float alpha = (float) curFade / (float) fadeDiff; RenderHelper.disableStandardItemLighting(); GlStateManager.color(1.0F, 1.0F, 1.0F, alpha); mc.renderEngine.bindTexture(getToastResourceLocation()); ScaledResolution res = new ScaledResolution(mc); drawTexturedModalRect(res.getScaledWidth() - 160, 0, u, v, 160, 32); GlStateManager.enableBlend(); int textColour = (0xFFFFFF << 32) | ((int) (alpha * 255) << 24); mc.fontRendererObj.drawSplitString(CreeperHost.instance.toastText, res.getScaledWidth() - 160 + 5, 6, 160, textColour); } else { CreeperHost.instance.toastText = null; } } }
private static void rotateArroundXAndY(float angle, float angleY) { GlStateManager.pushMatrix(); GlStateManager.rotate(angle, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(angleY, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GlStateManager.popMatrix(); }
public static void drawItem(ItemStack item, double x, double y) { GlStateManager.pushMatrix(); RenderHelper.enableGUIStandardItemLighting(); GlStateManager.disableLighting(); GlStateManager.enableRescaleNormal(); GlStateManager.enableColorMaterial(); GlStateManager.enableLighting(); MC.getRenderItem().zLevel = 100.f; renderItemAndEffectIntoGUI(getLocalPlayer(), item, x, y, 16.D); MC.getRenderItem().zLevel = 0.f; GlStateManager.popMatrix(); GlStateManager.disableLighting(); GlStateManager.enableDepth(); GlStateManager.color(1.f, 1.f, 1.f, 1.f); }
public static void renderItemWithTransform(World world, ItemStack stack, ItemCameraTransforms.TransformType transform) { GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); GlStateManager.enableCull(); GlStateManager.depthMask(true); RenderHelper.enableStandardItemLighting(); GlStateManager.enableAlpha(); GlStateManager.enableRescaleNormal(); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); IBakedModel ibakedmodel = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, world, (EntityLivingBase) null); IBakedModel transformedModel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, transform, false); Minecraft.getMinecraft().getRenderItem().renderItem(stack, transformedModel); GlStateManager.disableBlend(); GlStateManager.disableAlpha(); RenderHelper.disableStandardItemLighting(); GlStateManager.depthMask(false); GlStateManager.disableCull(); GlStateManager.popAttrib(); GlStateManager.popMatrix(); }
private void renderItem(ItemStack stack, int slot) { if (stack != null && !stack.isEmpty()) { int slotX = slot; int slotY = 0; if (slot >= 6) { slotX = slot - 6; slotY = 2; } else if (slot >= 3) { slotX = slot - 3; slotY = 1; } RenderHelper.enableStandardItemLighting(); GlStateManager.enableLighting(); GlStateManager.pushMatrix(); GlStateManager.translate((slotX / 5.35d) + 0.315, .675, (slotY / 5.35d) + 0.315); GlStateManager.scale(.1f, .1f, .1f); if (!(stack.getItem() instanceof ItemBlock)) { GlStateManager.rotate(-90, 1, 0, 0); GlStateManager.translate(0, 0, -0.5); } Minecraft.getMinecraft().getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.NONE); GlStateManager.popMatrix(); } }
public void renderItem(ItemStack stack, int x, int y) { RenderHelper.disableStandardItemLighting(); RenderHelper.enableGUIStandardItemLighting(); this.getItem().renderItemAndEffectIntoGUI(this.mc.player, stack, x, y); this.getItem().renderItemOverlayIntoGUI(this.getFont(), stack, x, y, this.det(stack)); RenderHelper.enableStandardItemLighting(); }
/** * Renders the particle */ public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) { int i = (int)(((float)this.field_70581_a + partialTicks) * 15.0F / (float)this.field_70584_aq); if (i <= 15) { this.theRenderEngine.bindTexture(EXPLOSION_TEXTURE); float f = (float)(i % 4) / 4.0F; float f1 = f + 0.24975F; float f2 = (float)(i / 4) / 4.0F; float f3 = f2 + 0.24975F; float f4 = 2.0F * this.field_70582_as; float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX); float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY); float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableLighting(); RenderHelper.disableStandardItemLighting(); worldRendererIn.begin(7, field_181549_az); worldRendererIn.pos((double)(f5 - p_180434_4_ * f4 - p_180434_7_ * f4), (double)(f6 - p_180434_5_ * f4), (double)(f7 - p_180434_6_ * f4 - p_180434_8_ * f4)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex(); worldRendererIn.pos((double)(f5 - p_180434_4_ * f4 + p_180434_7_ * f4), (double)(f6 + p_180434_5_ * f4), (double)(f7 - p_180434_6_ * f4 + p_180434_8_ * f4)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex(); worldRendererIn.pos((double)(f5 + p_180434_4_ * f4 + p_180434_7_ * f4), (double)(f6 + p_180434_5_ * f4), (double)(f7 + p_180434_6_ * f4 + p_180434_8_ * f4)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex(); worldRendererIn.pos((double)(f5 + p_180434_4_ * f4 - p_180434_7_ * f4), (double)(f6 - p_180434_5_ * f4), (double)(f7 + p_180434_6_ * f4 - p_180434_8_ * f4)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex(); Tessellator.getInstance().draw(); GlStateManager.enableLighting(); } }
/** * Renders the particle */ public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { int i = (int)(((float)this.life + partialTicks) * 15.0F / (float)this.lifeTime); if (i <= 15) { this.theRenderEngine.bindTexture(EXPLOSION_TEXTURE); float f = (float)(i % 4) / 4.0F; float f1 = f + 0.24975F; float f2 = (float)(i / 4) / 4.0F; float f3 = f2 + 0.24975F; float f4 = 2.0F * this.size; float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX); float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY); float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableLighting(); RenderHelper.disableStandardItemLighting(); worldRendererIn.begin(7, VERTEX_FORMAT); worldRendererIn.pos((double)(f5 - rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4), (double)(f7 - rotationYZ * f4 - rotationXZ * f4)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex(); worldRendererIn.pos((double)(f5 - rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4), (double)(f7 - rotationYZ * f4 + rotationXZ * f4)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex(); worldRendererIn.pos((double)(f5 + rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4), (double)(f7 + rotationYZ * f4 + rotationXZ * f4)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex(); worldRendererIn.pos((double)(f5 + rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4), (double)(f7 + rotationYZ * f4 - rotationXZ * f4)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex(); Tessellator.getInstance().draw(); GlStateManager.enableLighting(); } }
private void func_148225_a(int p_148225_1_, int p_148225_2_, ItemStack p_148225_3_) { this.func_148226_e(p_148225_1_ + 1, p_148225_2_ + 1); GlStateManager.enableRescaleNormal(); if (p_148225_3_ != null && p_148225_3_.getItem() != null) { RenderHelper.enableGUIStandardItemLighting(); GuiCreateFlatWorld.this.itemRender.renderItemIntoGUI(p_148225_3_, p_148225_1_ + 2, p_148225_2_ + 2); RenderHelper.disableStandardItemLighting(); } GlStateManager.disableRescaleNormal(); }
protected void renderTooltip(ScaledResolution sr, float partialTicks) { if (this.mc.getRenderViewEntity() instanceof EntityPlayer) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(widgetsTexPath); EntityPlayer entityplayer = (EntityPlayer)this.mc.getRenderViewEntity(); int i = sr.getScaledWidth() / 2; float f = this.zLevel; this.zLevel = -90.0F; this.drawTexturedModalRect(i - 91, sr.getScaledHeight() - 22, 0, 0, 182, 22); this.drawTexturedModalRect(i - 91 - 1 + entityplayer.inventory.currentItem * 20, sr.getScaledHeight() - 22 - 1, 0, 22, 24, 22); this.zLevel = f; GlStateManager.enableRescaleNormal(); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); RenderHelper.enableGUIStandardItemLighting(); for (int j = 0; j < 9; ++j) { int k = sr.getScaledWidth() / 2 - 90 + j * 20 + 2; int l = sr.getScaledHeight() - 16 - 3; this.renderHotbarItem(j, k, l, partialTicks, entityplayer); } RenderHelper.disableStandardItemLighting(); GlStateManager.disableRescaleNormal(); GlStateManager.disableBlend(); } }
/** * Draws an entity on the screen looking toward the cursor. */ public static void drawEntityOnScreen(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase ent) { GlStateManager.enableColorMaterial(); GlStateManager.pushMatrix(); GlStateManager.translate((float)posX, (float)posY, 50.0F); GlStateManager.scale((float)(-scale), (float)scale, (float)scale); GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); float f = ent.renderYawOffset; float f1 = ent.rotationYaw; float f2 = ent.rotationPitch; float f3 = ent.prevRotationYawHead; float f4 = ent.rotationYawHead; GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(-((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F); ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F; ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F; ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F; ent.rotationYawHead = ent.rotationYaw; ent.prevRotationYawHead = ent.rotationYaw; GlStateManager.translate(0.0F, 0.0F, 0.0F); RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); rendermanager.setPlayerViewY(180.0F); rendermanager.setRenderShadow(false); rendermanager.doRenderEntity(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false); rendermanager.setRenderShadow(true); ent.renderYawOffset = f; ent.rotationYaw = f1; ent.rotationPitch = f2; ent.prevRotationYawHead = f3; ent.rotationYawHead = f4; GlStateManager.popMatrix(); RenderHelper.disableStandardItemLighting(); GlStateManager.disableRescaleNormal(); GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); GlStateManager.disableTexture2D(); GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); }
/** * Args : renderPartialTicks, mouseX, mouseY */ protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderHelper.enableGUIStandardItemLighting(); CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; for (CreativeTabs creativetabs1 : CreativeTabs.creativeTabArray) { this.mc.getTextureManager().bindTexture(creativeInventoryTabs); if (creativetabs1.getTabIndex() != selectedTabIndex) { this.func_147051_a(creativetabs1); } } this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName())); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); this.searchField.drawTextBox(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); int i = this.guiLeft + 175; int j = this.guiTop + 18; int k = j + 112; this.mc.getTextureManager().bindTexture(creativeInventoryTabs); if (creativetabs.shouldHidePlayerInventory()) { this.drawTexturedModalRect(i, j + (int)((float)(k - j - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15); } this.func_147051_a(creativetabs); if (creativetabs == CreativeTabs.tabInventory) { GuiInventory.drawEntityOnScreen(this.guiLeft + 43, this.guiTop + 45, 20, (float)(this.guiLeft + 43 - mouseX), (float)(this.guiTop + 45 - 30 - mouseY), this.mc.thePlayer); } }
private static void renderZoomedStack(ItemStack itemStack, GuiContainer guiContainer, Minecraft minecraft) { ScaledResolution scaledResolution = new ScaledResolution(minecraft); final float scale = Config.getZoomAmount() / 100f * guiContainer.getGuiLeft() / 17f; // item is 16 wide, give it some extra space on each side final float xPosition = (guiContainer.getGuiLeft() / scale - 16f) / 2f; final float yPosition = (scaledResolution.getScaledHeight() / scale - 16f) / 2f; FontRenderer font = getFontRenderer(minecraft, itemStack); GlStateManager.pushMatrix(); GlStateManager.scale(scale, scale, 1); GlStateManager.translate(xPosition, yPosition, 0); ZoomRenderHelper.enableGUIStandardItemLighting(scale); minecraft.getRenderItem().zLevel += 100; minecraft.getRenderItem().renderItemAndEffectIntoGUI(minecraft.player, itemStack, 0, 0); renderItemOverlayIntoGUI(font, itemStack); minecraft.getRenderItem().zLevel -= 100; GlStateManager.disableBlend(); RenderHelper.disableStandardItemLighting(); GlStateManager.popMatrix(); if (Config.showHelpText()) { String modName = ItemZoom.MOD_NAME; int stringWidth = font.getStringWidth(modName); int x = (guiContainer.getGuiLeft() - stringWidth) / 2; int y = (scaledResolution.getScaledHeight() + Math.round(17 * scale)) / 2; font.drawString(modName, x, y, 4210752); if (Config.isToggledEnabled()) { String toggleText = KeyBindings.TOGGLE.getDisplayName(); stringWidth = font.getStringWidth(toggleText); x = (guiContainer.getGuiLeft() - stringWidth) / 2; y += font.FONT_HEIGHT; font.drawString(toggleText, x, y, 4210752); } } }