Java Code Examples for net.minecraft.client.renderer.RenderHelper#enableStandardItemLighting()
The following examples show how to use
net.minecraft.client.renderer.RenderHelper#enableStandardItemLighting() .
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: GuiSurgery.java From Cyberware with MIT License | 6 votes |
public void renderEntity(Entity entity, float x, float y, float scale, float rotation) { GlStateManager.enableColorMaterial(); GlStateManager.pushMatrix(); GlStateManager.translate(x, y, 50.0F); GlStateManager.scale(-scale, scale, scale); GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(rotation, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); Minecraft.getMinecraft().getRenderManager().playerViewY = 180.0F; Minecraft.getMinecraft().getRenderManager().doRenderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false); GlStateManager.popMatrix(); RenderHelper.disableStandardItemLighting(); GlStateManager.disableRescaleNormal(); OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GlStateManager.disableTexture2D(); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); GlStateManager.enableTexture2D(); }
Example 2
Source File: GuiSelectionScreen.java From XRay-Mod with GNU General Public License v3.0 | 6 votes |
@Override // @mcp: func_230432_a_ = render public void func_230432_a_(MatrixStack stack, int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean p_194999_5_, float partialTicks) { BlockData blockData = this.block; FontRenderer font = Minecraft.getInstance().fontRenderer; // @mcp: func_238407_a_ = drawString font.func_238407_a_(stack, ITextProperties.func_240652_a_(blockData.getEntryName()), left + 40, top + 7, 0xFFFFFF); font.func_238407_a_(stack, ITextProperties.func_240652_a_(blockData.isDrawing() ? "Enabled" : "Disabled"), left + 40, top + 17, blockData.isDrawing() ? Color.GREEN.getRGB() : Color.RED.getRGB()); RenderHelper.enableStandardItemLighting(); Minecraft.getInstance().getItemRenderer().renderItemAndEffectIntoGUI(blockData.getItemStack(), left + 15, top + 7); RenderHelper.disableStandardItemLighting(); if (mouseX > left && mouseX < (left + entryWidth) && mouseY > top && mouseY < (top + entryHeight) && mouseY < (this.parent.getTop() + this.parent.getHeight()) && mouseY > this.parent.getTop()) { this.parent.parent.func_238654_b_( stack, Arrays.asList(new TranslationTextComponent("xray.tooltips.edit1"), new TranslationTextComponent("xray.tooltips.edit2")), left + 15, (entryIdx == this.parent.func_231039_at__().size() - 1 ? (top - (entryHeight - 20)) : (top + (entryHeight + 15))) // @mcp: func_231039_at__ = getEntries ); // @mcp: func_230457_a_ = renderTooltip } RenderSystem.enableAlphaTest(); RenderSystem.enableBlend(); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); Minecraft.getInstance().getRenderManager().textureManager.bindTexture(GuiSelectionScreen.CIRCLE); GuiBase.drawTexturedQuadFit((left + entryWidth) - 37, top + (entryHeight / 2f) - 9, 14, 14, new int[]{255, 255, 255}, 50f); GuiBase.drawTexturedQuadFit((left + entryWidth) - 35, top + (entryHeight / 2f) - 7, 10, 10, blockData.getColor()); RenderSystem.disableAlphaTest(); RenderSystem.disableBlend(); }
Example 3
Source File: PuzzleTESR.java From YouTubeModdingTutorial with MIT License | 6 votes |
private void renderSlot(TilePuzzle te) { ItemStack stack = te.getItem(); if (stack.isEmpty()) { return; } RenderHelper.enableGUIStandardItemLighting(); float factor = 4.0f; float f3 = 0.0075F; GlStateManager.translate(-0.5F, 0.5F, -0.15F); GlStateManager.scale(f3 * factor, -f3 * factor, 0.0001f); RenderItem itemRender = Minecraft.getMinecraft().getRenderItem(); itemRender.renderItemAndEffectIntoGUI(stack, 8, 8); RenderHelper.enableStandardItemLighting(); }
Example 4
Source File: MetaTileEntityTESR.java From GregTech with GNU Lesser General Public License v3.0 | 6 votes |
private void renderTileEntityFastPart(MetaTileEntityHolder te, double x, double y, double z, float partialTicks, int destroyStage) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); RenderHelper.disableStandardItemLighting(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.enableBlend(); GlStateManager.disableCull(); if (Minecraft.isAmbientOcclusionEnabled()) { GlStateManager.shadeModel(GL11.GL_SMOOTH); } else { GlStateManager.shadeModel(GL11.GL_FLAT); } buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, partialTicks, buffer); buffer.setTranslation(0, 0, 0); tessellator.draw(); RenderHelper.enableStandardItemLighting(); }
Example 5
Source File: PlayerDisplay.java From Hyperium with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void draw(int x, double y, boolean config) { GlStateManager.pushMatrix(); GlStateManager.color(1, 1, 1); GlStateManager.translate(x, y, 0); RenderHelper.enableStandardItemLighting(); GlStateManager.enableAlpha(); GlStateManager.shadeModel(GL11.GL_FLAT); GlStateManager.enableAlpha(); GlStateManager.enableDepth(); GlStateManager.rotate(30, 0, 1.0F, 0); GuiInventory.drawEntityOnScreen(0, 100, 50, 0, 0, Minecraft.getMinecraft().thePlayer); GlStateManager.depthFunc(GL11.GL_LEQUAL); GlStateManager.resetColor(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableDepth(); GlStateManager.popMatrix(); }
Example 6
Source File: GuiEdit.java From XRay-Mod with GNU General Public License v3.0 | 5 votes |
@Override public void renderExtra(MatrixStack stack, int x, int y, float partialTicks) { getFontRender().func_238405_a_(stack, this.block.getItemStack().getDisplayName().getString(), getWidth() / 2f - 138, getHeight() / 2f - 90, 0xffffff); // @mcp: func_238405_a_ = drawtextwithshadow oreName.func_230430_a_(stack, x, y, partialTicks); // @mcp: func_230430_a_ = render GuiAddBlock.renderPreview(getWidth() / 2 - 138, getHeight() / 2 - 40, (float) redSlider.getValue(), (float) greenSlider.getValue(), (float) blueSlider.getValue()); RenderHelper.enableStandardItemLighting(); this.field_230707_j_.renderItemAndEffectIntoGUI(this.block.getItemStack(), getWidth() / 2 + 50, getHeight() / 2 - 105); // @mcp: field_230707_j_ = itemRenderer RenderHelper.disableStandardItemLighting(); }
Example 7
Source File: GuiAddBlock.java From XRay-Mod with GNU General Public License v3.0 | 5 votes |
@Override public void renderExtra(MatrixStack stack, int x, int y, float partialTicks) { // @mcp: func_238405_a_ = drawStringWithShadow // @mcp: func_235333_g_ = getNameTextComponent getFontRender().func_238405_a_(stack, selectBlock.func_235333_g_().getString(), getWidth() / 2f - 100, getHeight() / 2f - 90, 0xffffff); oreName.func_230430_a_(stack, x, y, partialTicks); // @mcp: func_230430_a_ = render renderPreview(getWidth() / 2 - 100, getHeight() / 2 - 40, (float) redSlider.getValue(), (float) greenSlider.getValue(), (float) blueSlider.getValue()); RenderHelper.enableStandardItemLighting(); this.field_230707_j_.renderItemAndEffectIntoGUI(this.itemStack, getWidth() / 2 + 85, getHeight() / 2 - 105); // @mcp: field_230707_j_ = itemRender RenderHelper.disableStandardItemLighting(); }
Example 8
Source File: SelfRf.java From ehacks-pro with GNU General Public License v3.0 | 4 votes |
@Override public void onWorldRender(RenderWorldLastEvent event) { if (selectedEnt == null) { return; } if (distVec != null) { distVec = Wrapper.INSTANCE.mc().renderViewEntity.getLookVec().normalize(); distVec.xCoord *= size; distVec.yCoord *= size; distVec.zCoord *= size; } NBTTagCompound tag = new NBTTagCompound(); selectedEnt.writeToNBT(tag); if (!GLUtils.hasClearedDepth) { GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GLUtils.hasClearedDepth = true; } Entity ent = selectedEnt; double tXPos = ent.posX; double tYPos = ent.posY; double tZPos = ent.posZ; double xPos = (Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosX + distVec.xCoord) + (Wrapper.INSTANCE.mc().renderViewEntity.posX - Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosX) * event.partialTicks; double yPos = (Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosY + distVec.yCoord + 1) + (Wrapper.INSTANCE.mc().renderViewEntity.posY - Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosY) * event.partialTicks; double zPos = (Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosZ + distVec.zCoord) + (Wrapper.INSTANCE.mc().renderViewEntity.posZ - Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosZ) * event.partialTicks; ent.posX = ent.lastTickPosX = xPos; ent.posY = ent.lastTickPosY = yPos; ent.posZ = ent.lastTickPosZ = zPos; float f1 = ent.prevRotationYaw + (ent.rotationYaw - ent.prevRotationYaw) * event.partialTicks; RenderHelper.enableStandardItemLighting(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240 / 1.0F, 240 / 1.0F); if (Wrapper.INSTANCE.world().loadedEntityList.contains(selectedEnt)) { GL11.glColor4f(0, 1.0F, 0, 1f); } else { GL11.glColor4f(1.0F, 0, 0, 1f); } RenderManager.instance.func_147939_a(ent, xPos - renderPosX, yPos - renderPosY, zPos - renderPosZ, f1, event.partialTicks, false); ent.posX = ent.lastTickPosX = tXPos; ent.posY = ent.lastTickPosY = tYPos; ent.posZ = ent.lastTickPosZ = tZPos; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); }
Example 9
Source File: ModularUIGui.java From GregTech with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.hoveredSlot = null; drawDefaultBackground(); GlStateManager.disableRescaleNormal(); RenderHelper.disableStandardItemLighting(); GlStateManager.disableLighting(); GlStateManager.disableDepth(); drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY); RenderHelper.enableGUIStandardItemLighting(); GlStateManager.pushMatrix(); GlStateManager.translate(guiLeft, guiTop, 0.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.enableRescaleNormal(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); for (int i = 0; i < this.inventorySlots.inventorySlots.size(); ++i) { Slot slot = this.inventorySlots.inventorySlots.get(i); if (slot.isEnabled()) { this.drawSlotContents(slot); } if (isPointInRegion(slot.xPos, slot.yPos, 16, 16, mouseX, mouseY) && slot.isEnabled()) { renderSlotOverlay(slot); setHoveredSlot(slot); } } RenderHelper.disableStandardItemLighting(); GlStateManager.popMatrix(); drawGuiContainerForegroundLayer(mouseX, mouseY); GlStateManager.pushMatrix(); GlStateManager.translate(guiLeft, guiTop, 0.0F); RenderHelper.enableGUIStandardItemLighting(); MinecraftForge.EVENT_BUS.post(new GuiContainerEvent.DrawForeground(this, mouseX, mouseY)); GlStateManager.enableDepth(); renderItemStackOnMouse(mouseX, mouseY); renderReturningItemStack(); GlStateManager.popMatrix(); GlStateManager.enableLighting(); RenderHelper.enableStandardItemLighting(); renderHoveredToolTip(mouseX, mouseY); }
Example 10
Source File: TileCraftingPlateRenderer.java From Wizardry with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void render(float partialTicks, int destroyStage, float alpha) { ArrayList<BlockPos> errors = new ArrayList<>(((IStructure) tile.getBlockType()).testStructure(tile.getWorld(), tile.getPos())); errors.sort(Vec3i::compareTo); ItemStack input = tile.getInput(); if (input.isEmpty()) { input = tile.getOutput(); if (input.isEmpty()) { input = ItemStack.EMPTY; } } ICraftingPlateRecipe recipeForItem = CraftingPlateRecipeManager.getRecipe(tile.getWorld(), tile.getPos(), input); if (recipeForItem != null) recipeForItem.renderInput(tile.getWorld(), tile.getPos(), input, partialTicks); if (!errors.isEmpty() && tile.revealStructure && tile.getBlockType() instanceof IStructure) { ModStructures.structureManager.draw(ModStructures.CRAFTING_PLATE, (float) (Math.sin(ClientTickHandler.getTicks() / 10.0) + 1) / 10.0f + 0.3f); } if (!errors.isEmpty()) { for (BlockPos error : errors) { StructureErrorRenderer.addError(error); } return; } else if (tile.getWorld().isAirBlock(tile.getPos().offset(EnumFacing.UP)) && !CraftingPlateRecipeManager.doesRecipeExist(tile.getWorld(), tile.getPos(), input) && RandUtil.nextInt(4) == 0) { LibParticles.CRAFTING_ALTAR_IDLE(tile.getWorld(), new Vec3d(tile.getPos()).add(0.5, 0.7, 0.5)); } // render each item at its current position final int mapSize = hoveringStacks.size(); for (HoveringStack hoveringStack : hoveringStacks.values()) { if (!hoveringStack.stack.isEmpty()) { { GlStateManager.pushMatrix(); GlStateManager.translate(0.5 + hoveringStack.location.x, 1 + hoveringStack.location.y, 0.5 + hoveringStack.location.z); GlStateManager.scale(0.3, 0.3, 0.3); GlStateManager.rotate((hoveringStack.randX + ClientTickHandler.getTicks()), 0, 1, 0); GlStateManager.rotate((hoveringStack.randY + ClientTickHandler.getTicks()), 1, 0, 0); GlStateManager.rotate((hoveringStack.randZ + ClientTickHandler.getTicks()), 0, 0, 1); GlStateManager.enableLighting(); RenderHelper.disableStandardItemLighting(); Minecraft.getMinecraft().getRenderItem().renderItem(hoveringStack.stack, TransformType.NONE); RenderHelper.enableStandardItemLighting(); GlStateManager.popMatrix(); } if (tile.suckingCooldown <= 0) { if (RandUtil.nextInt(mapSize / 2) == 0) { LibParticles.CLUSTER_DRAPE( tile.getWorld(), hoveringStack.location.add(new Vec3d(tile.getPos())).add(0.5, 0.5, 0.5)); } } else { if (RandUtil.nextInt(mapSize) == 0) { LibParticles.CRAFTING_ALTAR_CLUSTER_SUCTION( tile.getWorld(), new Vec3d(tile.getPos()).add(0.5, 0.75, 0.5), new InterpBezier3D(hoveringStack.location, new Vec3d(0, 0, 0))); } } } } }
Example 11
Source File: RenderTileEntityMapleCauldron.java From Sakura_mod with MIT License | 4 votes |
@Override public void render(TileEntityMapleCauldron te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { super.render(te, x, y, z, partialTicks, destroyStage, alpha); FluidStack fluid = te.getFluidForRendering(partialTicks); if (fluid != null) { RenderHelper.disableStandardItemLighting(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.pushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); TextureAtlasSprite still = Minecraft.getMinecraft().getTextureMapBlocks().getTextureExtry(fluid.getFluid().getStill(fluid).toString()); if (still == null) { still = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite(); } int brightness = Minecraft.getMinecraft().world.getCombinedLight(te.getPos(), fluid.getFluid().getLuminosity(fluid)); int lx = brightness >> 0x10 & 0xFFFF; int ly = brightness & 0xFFFF; int color = fluid.getFluid().getColor(fluid); int r = color >> 16 & 0xFF; int g = color >> 8 & 0xFF; int b = color & 0xFF; int a = color >> 24 & 0xFF; double height = 0.6 + 0.4 * ((double) fluid.amount / te.tank.getCapacity()); GlStateManager.translate(x + 0.1, y, z + 0.1); GlStateManager.scale(0.8, 0.8, 0.8); buffer.pos(0.0625, height, 0.0625).color(r, g, b, a).tex(still.getMinU(), still.getMinV()).lightmap(lx, ly).endVertex(); buffer.pos(0.0625, height, 0.9375).color(r, g, b, a).tex(still.getMinU(), still.getMaxV()).lightmap(lx, ly).endVertex(); buffer.pos(0.9375, height, 0.9375).color(r, g, b, a).tex(still.getMaxU(), still.getMaxV()).lightmap(lx, ly).endVertex(); buffer.pos(0.9375, height, 0.0625).color(r, g, b, a).tex(still.getMaxU(), still.getMinV()).lightmap(lx, ly).endVertex(); tessellator.draw(); GlStateManager.disableBlend(); GlStateManager.popMatrix(); RenderHelper.enableStandardItemLighting(); } }
Example 12
Source File: LocatedString.java From IGW-mod with GNU General Public License v2.0 | 4 votes |
protected void drawHoveringText(List par1List, int par2, int par3, FontRenderer font){ if(!par1List.isEmpty()) { GL11.glDisable(GL12.GL_RESCALE_NORMAL); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); int k = 0; Iterator iterator = par1List.iterator(); while(iterator.hasNext()) { String s = (String)iterator.next(); int l = font.getStringWidth(s); if(l > k) { k = l; } } int i1 = par2 + 12; int j1 = par3 - 12; int k1 = 8; if(par1List.size() > 1) { k1 += 2 + (par1List.size() - 1) * 10; } /* if(i1 + k > width) { i1 -= 28 + k; } if(j1 + k1 + 6 > height) { j1 = height - k1 - 6; }*/ zLevel = 300.0F; // itemRenderer.zLevel = 300.0F; int l1 = -267386864; drawGradientRect(i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1); drawGradientRect(i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1); drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 + k1 + 3, l1, l1); drawGradientRect(i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1); drawGradientRect(i1 + k + 3, j1 - 3, i1 + k + 4, j1 + k1 + 3, l1, l1); int i2 = 1347420415; int j2 = (i2 & 16711422) >> 1 | i2 & -16777216; drawGradientRect(i1 - 3, j1 - 3 + 1, i1 - 3 + 1, j1 + k1 + 3 - 1, i2, j2); drawGradientRect(i1 + k + 2, j1 - 3 + 1, i1 + k + 3, j1 + k1 + 3 - 1, i2, j2); drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 - 3 + 1, i2, i2); drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2); for(int k2 = 0; k2 < par1List.size(); ++k2) { String s1 = (String)par1List.get(k2); font.drawStringWithShadow(s1, i1, j1, -1); if(k2 == 0) { j1 += 2; } j1 += 10; } zLevel = 0.0F; //itemRenderer.zLevel = 0.0F; GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); RenderHelper.enableStandardItemLighting(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); } }
Example 13
Source File: ComponentGui.java From OpenModsLib with MIT License | 4 votes |
protected void restoreRenderState() { GlStateManager.enableRescaleNormal(); GlStateManager.enableLighting(); GlStateManager.enableDepth(); RenderHelper.enableStandardItemLighting(); }
Example 14
Source File: WidgetFluidModes.java From ExtraCells1 with MIT License | 4 votes |
@SuppressWarnings("rawtypes") protected void drawHoveringText(List list, int x, int y, FontRenderer fontrenderer) { if (!list.isEmpty()) { GL11.glDisable(GL12.GL_RESCALE_NORMAL); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); int k = 0; Iterator iterator = list.iterator(); while (iterator.hasNext()) { String s = (String) iterator.next(); int l = fontrenderer.getStringWidth(s); if (l > k) { k = l; } } int i1 = x + 12; int j1 = y - 12; int k1 = 8; if (list.size() > 1) { k1 += 2 + (list.size() - 1) * 10; } this.zLevel = 300.0F; int l1 = -267386864; this.drawGradientRect(i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1); this.drawGradientRect(i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1); this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 + k1 + 3, l1, l1); this.drawGradientRect(i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1); this.drawGradientRect(i1 + k + 3, j1 - 3, i1 + k + 4, j1 + k1 + 3, l1, l1); int i2 = 1347420415; int j2 = (i2 & 16711422) >> 1 | i2 & -16777216; this.drawGradientRect(i1 - 3, j1 - 3 + 1, i1 - 3 + 1, j1 + k1 + 3 - 1, i2, j2); this.drawGradientRect(i1 + k + 2, j1 - 3 + 1, i1 + k + 3, j1 + k1 + 3 - 1, i2, j2); this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 - 3 + 1, i2, i2); this.drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2); for (int k2 = 0; k2 < list.size(); ++k2) { String s1 = (String) list.get(k2); fontrenderer.drawStringWithShadow(s1, i1, j1, -1); if (k2 == 0) { j1 += 2; } j1 += 10; } this.zLevel = 0.0F; GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); RenderHelper.enableStandardItemLighting(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); } }
Example 15
Source File: RenderInfestedLeaves.java From ExNihiloAdscensio with MIT License | 4 votes |
@Override public void renderTileEntityAt(TileInfestedLeaves tile, double x, double y, double z, float partialTicks, int destroyStage) { if(tile != null) { long seed = tile.getWorld().rand.nextLong(); int color = tile.getColor(); IBlockState leafBlock = tile.getLeafBlock(); IBakedModel leafModel = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(leafBlock); if(leafModel == null) { leafModel = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(Blocks.LEAVES.getDefaultState()); } List<BakedQuad> leafQuads = Lists.newArrayList(); for(EnumFacing side : EnumFacing.VALUES) { if(leafBlock.shouldSideBeRendered(tile.getWorld(), tile.getPos(), side)) { leafQuads.addAll(leafModel.getQuads(leafBlock, side, seed)); } } Tessellator tessellator = Tessellator.getInstance(); VertexBuffer buffer = tessellator.getBuffer(); bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); RenderHelper.disableStandardItemLighting(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM); for(BakedQuad quad : leafQuads) { LightUtil.renderQuadColor(buffer, quad, color); } tessellator.draw(); RenderHelper.enableStandardItemLighting(); GlStateManager.popMatrix(); } }
Example 16
Source File: RenderCrucible.java From ExNihiloAdscensio with MIT License | 4 votes |
@Override public void renderTileEntityAt(TileCrucible te, double x, double y, double z, float partialTicks, int destroyStage) { Tessellator tes = Tessellator.getInstance(); VertexBuffer wr = tes.getBuffer(); RenderHelper.disableStandardItemLighting(); GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); SpriteColor sprite = te.getSpriteAndColor(); if (sprite != null) { TextureAtlasSprite icon = sprite.getSprite(); double minU = (double) icon.getMinU(); double maxU = (double) icon.getMaxU(); double minV = (double) icon.getMinV(); double maxV = (double) icon.getMaxV(); // determine the tint for the fluid/block Color color = sprite.getColor(); this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL); //wr.begin(GL11.GL_QUADS, new VertexFormat().addElement(DefaultVertexFormats.POSITION_3F).addElement(DefaultVertexFormats.COLOR_4UB).addElement(DefaultVertexFormats.NORMAL_3B)); // Offset by bottome of crucible, which is 4 pixels above the base of the block float fillAmount = (12F / 16F) * te.getFilledAmount() + (4F / 16F); wr.pos(0.125F, fillAmount, 0.125F).tex(minU, minV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex(); wr.pos(0.125F, fillAmount, 0.875F).tex(minU, maxV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex(); wr.pos(0.875F, fillAmount, 0.875F).tex(maxU, maxV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex(); wr.pos(0.875F, fillAmount, 0.125F).tex(maxU, minV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex(); tes.draw(); } GlStateManager.disableBlend(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); RenderHelper.enableStandardItemLighting(); }
Example 17
Source File: GuiEntityRender.java From WearableBackpacks with MIT License | 4 votes |
@Override public void draw(int mouseX, int mouseY, float partialTicks) { int w = getWidth(); int h = getHeight(); enableBlendAlphaStuffs(); setRenderColorARGB(_colorBackground); drawRect(1, 1, w - 2, h - 2); setRenderColorARGB(_colorBorder); drawOutline(0, 0, w, h); disableBlendAlphaStuffs(); Entity entity = getEntity(); if (entity == null) return; AxisAlignedBB bbox = entity.getRenderBoundingBox(); float entityWidth = (float)(bbox.maxX - bbox.minX); float entityHeight = (float)(bbox.maxY - bbox.minY); float scale = Math.min((w - RESERVED_SPACE) / entityWidth, (h - RESERVED_SPACE) / entityHeight) * _zoom; float yaw = _yawDefault + _yaw; float pitch = _pitchDefault + _pitch; getContext().pushScissor(this, 1, 1, w - 2, h - 2); if (entity.getEntityWorld() == null) entity.setWorld(DummyWorld.INSTANCE); if (getMC().player == null) { World world = entity.getEntityWorld(); if (!(world instanceof DummyWorld)) return; getMC().player = ((DummyWorld)world).player; getMC().player.setWorld(world); } setRenderColorARGB(Color.WHITE); GlStateManager.enableDepth(); // From GuiInventory.drawEntityOnScreen GlStateManager.enableColorMaterial(); GlStateManager.pushMatrix(); GlStateManager.translate(w * _centerX, h * _centerY, 100.0F); GlStateManager.scale(-scale, scale, scale); GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(pitch, 1.0F, 0.0F, 0.0F); GlStateManager.translate(0.0F, -(entityHeight / 2), 0.0F); GlStateManager.rotate(yaw, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); rendermanager.setPlayerViewY(180.0F); rendermanager.setRenderShadow(false); rendermanager.renderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false); rendermanager.setRenderShadow(true); GlStateManager.popMatrix(); RenderHelper.disableStandardItemLighting(); GlStateManager.disableRescaleNormal(); GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); GlStateManager.disableTexture2D(); GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); GlStateManager.disableDepth(); if (getMC().player instanceof DummyPlayerSP) getMC().player = null; getContext().popScissor(); }
Example 18
Source File: SelfEnd.java From ehacks-pro with GNU General Public License v3.0 | 4 votes |
@Override public void onWorldRender(RenderWorldLastEvent event) { if (selectedEnt == null) { return; } if (distVec != null) { distVec = Wrapper.INSTANCE.mc().renderViewEntity.getLookVec().normalize(); distVec.xCoord *= size; distVec.yCoord *= size; distVec.zCoord *= size; } NBTTagCompound tag = new NBTTagCompound(); selectedEnt.writeToNBT(tag); if (!GLUtils.hasClearedDepth) { GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GLUtils.hasClearedDepth = true; } Entity ent = selectedEnt; double tXPos = ent.posX; double tYPos = ent.posY; double tZPos = ent.posZ; double xPos = (Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosX + distVec.xCoord) + (Wrapper.INSTANCE.mc().renderViewEntity.posX - Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosX) * event.partialTicks; double yPos = (Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosY + distVec.yCoord + 1) + (Wrapper.INSTANCE.mc().renderViewEntity.posY - Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosY) * event.partialTicks; double zPos = (Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosZ + distVec.zCoord) + (Wrapper.INSTANCE.mc().renderViewEntity.posZ - Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosZ) * event.partialTicks; ent.posX = ent.lastTickPosX = xPos; ent.posY = ent.lastTickPosY = yPos; ent.posZ = ent.lastTickPosZ = zPos; float f1 = ent.prevRotationYaw + (ent.rotationYaw - ent.prevRotationYaw) * event.partialTicks; RenderHelper.enableStandardItemLighting(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240 / 1.0F, 240 / 1.0F); if (Wrapper.INSTANCE.world().loadedEntityList.contains(selectedEnt)) { GL11.glColor4f(0, 1.0F, 0, 1f); } else { GL11.glColor4f(1.0F, 0, 0, 1f); } RenderManager.instance.func_147939_a(ent, xPos - renderPosX, yPos - renderPosY, zPos - renderPosZ, f1, event.partialTicks, false); ent.posX = ent.lastTickPosX = tXPos; ent.posY = ent.lastTickPosY = tYPos; ent.posZ = ent.lastTickPosZ = tZPos; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); }
Example 19
Source File: WidgetRedstoneModes.java From ExtraCells1 with MIT License | 4 votes |
@SuppressWarnings("rawtypes") protected void drawHoveringText(List list, int x, int y, FontRenderer fontrenderer) { if (!list.isEmpty()) { GL11.glDisable(GL12.GL_RESCALE_NORMAL); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); int k = 0; Iterator iterator = list.iterator(); while (iterator.hasNext()) { String s = (String) iterator.next(); int l = fontrenderer.getStringWidth(s); if (l > k) { k = l; } } int i1 = x + 12; int j1 = y - 12; int k1 = 8; if (list.size() > 1) { k1 += 2 + (list.size() - 1) * 10; } this.zLevel = 300.0F; int l1 = -267386864; this.drawGradientRect(i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1); this.drawGradientRect(i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1); this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 + k1 + 3, l1, l1); this.drawGradientRect(i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1); this.drawGradientRect(i1 + k + 3, j1 - 3, i1 + k + 4, j1 + k1 + 3, l1, l1); int i2 = 1347420415; int j2 = (i2 & 16711422) >> 1 | i2 & -16777216; this.drawGradientRect(i1 - 3, j1 - 3 + 1, i1 - 3 + 1, j1 + k1 + 3 - 1, i2, j2); this.drawGradientRect(i1 + k + 2, j1 - 3 + 1, i1 + k + 3, j1 + k1 + 3 - 1, i2, j2); this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 - 3 + 1, i2, i2); this.drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2); for (int k2 = 0; k2 < list.size(); ++k2) { String s1 = (String) list.get(k2); fontrenderer.drawStringWithShadow(s1, i1, j1, -1); if (k2 == 0) { j1 += 2; } j1 += 10; } this.zLevel = 0.0F; GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); RenderHelper.enableStandardItemLighting(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); } }
Example 20
Source File: EndPort.java From ehacks-pro with GNU General Public License v3.0 | 4 votes |
@Override public void onWorldRender(RenderWorldLastEvent event) { if (selectedEnt == null) { return; } if (distVec != null) { distVec = Wrapper.INSTANCE.mc().renderViewEntity.getLookVec().normalize(); distVec.xCoord *= size; distVec.yCoord *= size; distVec.zCoord *= size; } NBTTagCompound tag = new NBTTagCompound(); selectedEnt.writeToNBT(tag); if (!GLUtils.hasClearedDepth) { GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GLUtils.hasClearedDepth = true; } Entity ent = selectedEnt; double tXPos = ent.posX; double tYPos = ent.posY; double tZPos = ent.posZ; double xPos = (Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosX + distVec.xCoord) + (Wrapper.INSTANCE.mc().renderViewEntity.posX - Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosX) * event.partialTicks; double yPos = (Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosY + distVec.yCoord + ((ent instanceof EntityPlayer) ? 1 : 0)) + (Wrapper.INSTANCE.mc().renderViewEntity.posY - Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosY) * event.partialTicks; double zPos = (Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosZ + distVec.zCoord) + (Wrapper.INSTANCE.mc().renderViewEntity.posZ - Wrapper.INSTANCE.mc().renderViewEntity.lastTickPosZ) * event.partialTicks; ent.posX = ent.lastTickPosX = xPos; ent.posY = ent.lastTickPosY = yPos; ent.posZ = ent.lastTickPosZ = zPos; float f1 = ent.prevRotationYaw + (ent.rotationYaw - ent.prevRotationYaw) * event.partialTicks; RenderHelper.enableStandardItemLighting(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240 / 1.0F, 240 / 1.0F); if (Wrapper.INSTANCE.world().loadedEntityList.contains(selectedEnt)) { GL11.glColor4f(0, 1.0F, 0, 1f); } else { GL11.glColor4f(1.0F, 0, 0, 1f); } RenderManager.instance.func_147939_a(ent, xPos - renderPosX, yPos - renderPosY, zPos - renderPosZ, f1, event.partialTicks, false); ent.posX = ent.lastTickPosX = tXPos; ent.posY = ent.lastTickPosY = tYPos; ent.posZ = ent.lastTickPosZ = tZPos; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); }