Java Code Examples for net.minecraft.client.renderer.GlStateManager#enableLighting()
The following examples show how to use
net.minecraft.client.renderer.GlStateManager#enableLighting() .
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: SurfaceHelper.java From ForgeHax with MIT License | 6 votes |
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); }
Example 2
Source File: TileManaMagnetRenderer.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void render(TileManaMagnet te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { if (te.manaOrb != null) { GlStateManager.pushMatrix(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.translate(x + 0.5, y + 0.5, z + 0.5); GlStateManager.translate(0, MathHelper.sin(ClientTickHandler.getTicks()) / 2.0, 0); GlStateManager.disableRescaleNormal(); { GlStateManager.enableRescaleNormal(); GlStateManager.disableCull(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.enableLighting(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); RenderHelper.disableStandardItemLighting(); Minecraft.getMinecraft().getTextureManager().bindTexture(manaPearlCubeTexture); TileOrbHolderRenderer.renderCube(0.1, Color.WHITE); GlStateManager.disableRescaleNormal(); } GlStateManager.disableBlend(); GlStateManager.popMatrix(); } }
Example 3
Source File: RenderFallTofu.java From TofuCraftReload with MIT License | 5 votes |
/** * Renders the desired {@code T} type Entity. */ public void doRender(EntityFallTofu entity, double x, double y, double z, float entityYaw, float partialTicks) { IBlockState iblockstate = BlockLoader.tofuTerrain.getDefaultState(); if (iblockstate.getRenderType() == EnumBlockRenderType.MODEL) { World world = entity.getWorldObj(); if (iblockstate != world.getBlockState(new BlockPos(entity)) && iblockstate.getRenderType() != EnumBlockRenderType.INVISIBLE) { this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } bufferbuilder.begin(7, DefaultVertexFormats.BLOCK); BlockPos blockpos = new BlockPos(entity.posX, entity.getEntityBoundingBox().maxY, entity.posZ); GlStateManager.translate((float) (x - (double) blockpos.getX() - 0.5D), (float) (y - (double) blockpos.getY()), (float) (z - (double) blockpos.getZ() - 0.5D)); BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); blockrendererdispatcher.getBlockModelRenderer().renderModel(world, blockrendererdispatcher.getModelForState(iblockstate), iblockstate, blockpos, bufferbuilder, false); tessellator.draw(); if (this.renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } GlStateManager.enableLighting(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); } } }
Example 4
Source File: LogoutSpotsModule.java From seppuku with GNU General Public License v3.0 | 5 votes |
@Listener public void onRenderWorld(EventRender3D event) { final Minecraft mc = Minecraft.getMinecraft(); for (String uuid : this.logoutCache.keySet()) { final PlayerData data = this.logoutCache.get(uuid); if (this.isOutOfRange(data)) { this.logoutCache.remove(uuid); continue; } data.ghost.prevLimbSwingAmount = 0; data.ghost.limbSwing = 0; data.ghost.limbSwingAmount = 0; data.ghost.hurtTime = 0; GlStateManager.pushMatrix(); GlStateManager.enableLighting(); GlStateManager.enableBlend(); GlStateManager.enableDepth(); GlStateManager.color(1, 1, 1, 1); mc.getRenderManager().renderEntity(data.ghost, data.position.x - mc.getRenderManager().renderPosX, data.position.y - mc.getRenderManager().renderPosY, data.position.z - mc.getRenderManager().renderPosZ, data.ghost.rotationYaw, mc.getRenderPartialTicks(), false); GlStateManager.disableLighting(); GlStateManager.disableBlend(); GlStateManager.popMatrix(); } }
Example 5
Source File: RenderCyberlimbHand.java From Cyberware with MIT License | 5 votes |
private void renderMapFirstPerson(ItemStack stack) { GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); GlStateManager.scale(0.38F, 0.38F, 0.38F); GlStateManager.disableLighting(); this.mc.getTextureManager().bindTexture(RES_MAP_BACKGROUND); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); GlStateManager.translate(-0.5F, -0.5F, 0.0F); GlStateManager.scale(0.0078125F, 0.0078125F, 0.0078125F); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX); vertexbuffer.pos(-7.0D, 135.0D, 0.0D).tex(0.0D, 1.0D).endVertex(); vertexbuffer.pos(135.0D, 135.0D, 0.0D).tex(1.0D, 1.0D).endVertex(); vertexbuffer.pos(135.0D, -7.0D, 0.0D).tex(1.0D, 0.0D).endVertex(); vertexbuffer.pos(-7.0D, -7.0D, 0.0D).tex(0.0D, 0.0D).endVertex(); tessellator.draw(); if (stack != null) { MapData mapdata = Items.FILLED_MAP.getMapData(stack, Minecraft.getMinecraft().theWorld); if (mapdata != null) { this.mc.entityRenderer.getMapItemRenderer().renderMap(mapdata, false); } } GlStateManager.enableLighting(); }
Example 6
Source File: TESRBarrel.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
private void renderText(String text, double x, double y, double z, EnumFacing side, EnumFacing barrelFront) { FontRenderer fontRenderer = this.mc.fontRenderer; int strLenHalved = fontRenderer.getStringWidth(text) / 2; GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); if (side == EnumFacing.UP || side == EnumFacing.DOWN) { GlStateManager.rotate(LABEL_ROT_SIDE_Y[barrelFront.getIndex()], 0, 1, 0); GlStateManager.rotate(90f * side.getYOffset(), 1, 0, 0); } else { GlStateManager.rotate(LABEL_ROT_SIDE_Y[side.getIndex()], 0, 1, 0); } GlStateManager.translate(0, 0.48, 0); GlStateManager.scale(-0.01F, -0.01F, 0.01F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableLighting(); GlStateManager.enablePolygonOffset(); GlStateManager.depthMask(false); GlStateManager.enableBlend(); GlStateManager.doPolygonOffset(-1, -20); this.getFontRenderer().drawString(text, -strLenHalved, 0, 0xFFFFFFFF); GlStateManager.disableBlend(); GlStateManager.depthMask(true); GlStateManager.disablePolygonOffset(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); }
Example 7
Source File: LayoutManager.java From NotEnoughItems with MIT License | 5 votes |
public void renderObjects(GuiContainer gui, int mousex, int mousey) { if (!isHidden()) { layout(gui); if (isEnabled()) { getLayoutStyle().drawBackground(GuiContainerManager.getManager(gui)); for (Widget widget : drawWidgets) widget.draw(mousex, mousey); } else { options.draw(mousex, mousey); } GlStateManager.enableLighting(); GlStateManager.disableDepth(); } }
Example 8
Source File: WorldOverlayRenderer.java From NotEnoughItems with MIT License | 4 votes |
private static void renderChunkBounds(Entity entity) { if (chunkOverlay == 0) { return; } GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); GlStateManager.disableLighting(); glLineWidth(1.5F); glBegin(GL_LINES); for (int cx = -4; cx <= 4; cx++) { for (int cz = -4; cz <= 4; cz++) { double x1 = (entity.chunkCoordX + cx) << 4; double z1 = (entity.chunkCoordZ + cz) << 4; double x2 = x1 + 16; double z2 = z1 + 16; double dy = 128; double y1 = Math.floor(entity.posY - dy / 2); double y2 = y1 + dy; if (y1 < 0) { y1 = 0; y2 = dy; } if (y1 > entity.world.getHeight()) { y2 = entity.world.getHeight(); y1 = y2 - dy; } double dist = Math.pow(1.5, -(cx * cx + cz * cz)); GlStateManager.color(0.9F, 0, 0, (float) dist); if (cx >= 0 && cz >= 0) { glVertex3d(x2, y1, z2); glVertex3d(x2, y2, z2); } if (cx >= 0 && cz <= 0) { glVertex3d(x2, y1, z1); glVertex3d(x2, y2, z1); } if (cx <= 0 && cz >= 0) { glVertex3d(x1, y1, z2); glVertex3d(x1, y2, z2); } if (cx <= 0 && cz <= 0) { glVertex3d(x1, y1, z1); glVertex3d(x1, y2, z1); } if (chunkOverlay == 2 && cx == 0 && cz == 0) { dy = 32; y1 = Math.floor(entity.posY - dy / 2); y2 = y1 + dy; if (y1 < 0) { y1 = 0; y2 = dy; } if (y1 > entity.world.getHeight()) { y2 = entity.world.getHeight(); y1 = y2 - dy; } GlStateManager.color(0, 0.9F, 0, 0.4F); for (double y = (int) y1; y <= y2; y++) { glVertex3d(x2, y, z1); glVertex3d(x2, y, z2); glVertex3d(x1, y, z1); glVertex3d(x1, y, z2); glVertex3d(x1, y, z2); glVertex3d(x2, y, z2); glVertex3d(x1, y, z1); glVertex3d(x2, y, z1); } for (double h = 1; h <= 15; h++) { glVertex3d(x1 + h, y1, z1); glVertex3d(x1 + h, y2, z1); glVertex3d(x1 + h, y1, z2); glVertex3d(x1 + h, y2, z2); glVertex3d(x1, y1, z1 + h); glVertex3d(x1, y2, z1 + h); glVertex3d(x2, y1, z1 + h); glVertex3d(x2, y2, z1 + h); } } } } glEnd(); GlStateManager.enableLighting(); GlStateManager.disableBlend(); GlStateManager.enableTexture2D(); }
Example 9
Source File: SpeedTelegraphTileEntityRenderer.java From Valkyrien-Skies with Apache License 2.0 | 4 votes |
@Override public void render(TileEntitySpeedTelegraph tileentity, double x, double y, double z, float partialTick, int destroyStage, float alpha) { IBlockState telegraphState = tileentity.getWorld().getBlockState(tileentity.getPos()); if (telegraphState.getBlock() != ValkyrienSkiesControl.INSTANCE.vsControlBlocks.speedTelegraph) { return; } GlStateManager.resetColor(); this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder tessellatorBuffer = tessellator.getBuffer(); double oldX = tessellatorBuffer.xOffset; double oldY = tessellatorBuffer.yOffset; double oldZ = tessellatorBuffer.zOffset; tessellatorBuffer.setTranslation(0, 0, 0); GL11.glTranslated(x, y, z); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); BlockPos originPos = tileentity.getPos(); int brightness = tileentity.getWorld().getCombinedLight(tileentity.getPos(), 0); double multiplier = 1.9D; GL11.glTranslated((1D - multiplier) / 2.0D, 0, (1D - multiplier) / 2.0D); GL11.glScaled(multiplier, multiplier, multiplier); EnumFacing enumfacing = telegraphState.getValue(BlockSpeedTelegraph.FACING); double wheelAndCompassStateRotation = enumfacing.getHorizontalAngle(); GL11.glTranslated(0.5D, 0, 0.5D); GL11.glRotated(wheelAndCompassStateRotation, 0, 1, 0); GL11.glTranslated(-0.5D, 0, -0.5D); // FastBlockModelRenderer.renderBlockModel(tessellator, tileentity.getWorld(), helmStateToRender, brightness); GibsModelRegistry.renderGibsModel("chadburn_speed_telegraph_simplevoxel_geo", brightness); // FastBlockModelRenderer.renderBlockModel(tessellator, tileentity.getWorld(), dialState, brightness); GibsModelRegistry.renderGibsModel("chadburn_dial_simplevoxel_geo", brightness); GL11.glPushMatrix(); GL11.glTranslated(0.497D, 0.857D, 0.5D); GL11.glRotated(tileentity.getHandleRenderRotation(partialTick), 0D, 0D, 1D); GL11.glTranslated(-0.497D, -0.857D, -0.5D); // FastBlockModelRenderer.renderBlockModel(tessellator, tileentity.getWorld(), rightHandleState, brightness); GibsModelRegistry.renderGibsModel("chadburn_handles_simplevoxel_geo", brightness); // FastBlockModelRenderer.renderBlockModel(tessellator, tileentity.getWorld(), leftHandleState, brightness); GL11.glPopMatrix(); GlStateManager.enableAlpha(); GlStateManager.enableBlend(); // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // FastBlockModelRenderer.renderBlockModel(tessellator, tileentity.getWorld(), glassState, brightness); GibsModelRegistry.renderGibsModel("chadburn_glass_simplevoxel_geo", brightness); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); GL11.glPopMatrix(); tessellatorBuffer.setTranslation(oldX, oldY, oldZ); GlStateManager.enableLighting(); GlStateManager.resetColor(); }
Example 10
Source File: StenciledTextureRenderer.java From OpenModsLib with MIT License | 4 votes |
@Override public void render(RenderGlobal context, float partialTickTime) { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glOrtho(-1, +1, -1, +1, -1, +1); GL11.glEnable(GL11.GL_STENCIL_TEST); GL11.glStencilMask(stencilMask); GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_KEEP); GL11.glStencilFunc(GL11.GL_EQUAL, stencilMask, stencilMask); TextureUtils.bindTextureToClient(texture); RenderUtils.disableLightmap(); GlStateManager.disableLighting(); GlStateManager.color(1, 1, 1); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex3f(-1, -1, 0); GL11.glTexCoord2f(1, 0); GL11.glVertex3f(+1, -1, 0); GL11.glTexCoord2f(1, 1); GL11.glVertex3f(+1, +1, 0); GL11.glTexCoord2f(0, 1); GL11.glVertex3f(-1, +1, 0); GL11.glEnd(); // mask should prevent this command from clearing other bits GL11.glClearStencil(0); GL11.glClear(GL11.GL_STENCIL_BUFFER_BIT); GL11.glDisable(GL11.GL_STENCIL_TEST); RenderUtils.enableLightmap(); GlStateManager.enableLighting(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPopMatrix(); }
Example 11
Source File: TileEntityRendererEnergyBridge.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
public void renderBeamVertical(double x, double y, double z, double yMin, double yMax, double radius, double rot, double flowSpeed, boolean powered) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder vertexBuffer = tessellator.getBuffer(); double tx1 = 0.0d, tx2 = 0.0d; double tz1 = 0.0d, tz2 = 0.0d; double angle = 0.0d; double vScale = yMax - yMin; double v1 = -rot * flowSpeed; double v2 = (vScale * 2.0d) + v1; int r_i = (powered ? 160 : 255); int g_i = (powered ? 255 : 160); int b_i = (powered ? 230 : 160); int r_o = (powered ? 210 : 255); int g_o = (powered ? 255 : 160); int b_o = (powered ? 230 : 160); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); this.bindTexture(TEXTURE); GlStateManager.disableFog(); GlStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497); GlStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497); GlStateManager.disableLighting(); GlStateManager.disableCull(); GlStateManager.disableBlend(); GlStateManager.depthMask(true); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); // Beam (inner part) vertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); for (int i = 0; i < 8; ++i) { tx1 = Math.sin(rot + angle) * radius; tz1 = Math.cos(rot + angle) * radius; angle += Math.PI / 4.0d; tx2 = Math.sin(rot + angle) * radius; tz2 = Math.cos(rot + angle) * radius; vertexBuffer.pos(tx1, yMin, tz1).tex(0.125, v1).color(r_i, g_i, b_i, 200).endVertex(); vertexBuffer.pos(tx1, yMax, tz1).tex(0.125, v2).color(r_i, g_i, b_i, 200).endVertex(); vertexBuffer.pos(tx2, yMax, tz2).tex(0.875, v2).color(r_i, g_i, b_i, 200).endVertex(); vertexBuffer.pos(tx2, yMin, tz2).tex(0.875, v1).color(r_i, g_i, b_i, 200).endVertex(); } tessellator.draw(); // Glow (outer part) GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.depthMask(false); v1 = -rot * flowSpeed * 3.0d; v2 = (vScale * 2.0d) + v1; radius *= 2.0d; rot = Math.PI / 8.0d; vertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); for (int i = 0; i < 8; ++i) { tx1 = Math.sin(rot + angle) * radius; tz1 = Math.cos(rot + angle) * radius; angle += Math.PI / 4.0d; tx2 = Math.sin(rot + angle) * radius; tz2 = Math.cos(rot + angle) * radius; vertexBuffer.pos(tx1, yMin, tz1).tex(0.125, v1).color(r_o, g_o, b_o, 80).endVertex(); vertexBuffer.pos(tx1, yMax, tz1).tex(0.125, v2).color(r_o, g_o, b_o, 80).endVertex(); vertexBuffer.pos(tx2, yMax, tz2).tex(0.875, v2).color(r_o, g_o, b_o, 80).endVertex(); vertexBuffer.pos(tx2, yMin, tz2).tex(0.875, v1).color(r_o, g_o, b_o, 80).endVertex(); } tessellator.draw(); GlStateManager.enableLighting(); GlStateManager.enableTexture2D(); GlStateManager.depthMask(true); GlStateManager.enableFog(); GlStateManager.popMatrix(); }
Example 12
Source File: ValkyriumCompressorPartTileEntityRenderer.java From Valkyrien-Skies with Apache License 2.0 | 4 votes |
@Override public void render(TileEntityValkyriumCompressorPart tileentity, double x, double y, double z, float partialTick, int destroyStage, float alpha) { this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); GlStateManager.translate(x, y, z); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); int brightness = tileentity.getWorld().getCombinedLight(tileentity.getPos(), 0); GlStateManager.pushMatrix(); if (!tileentity.isPartOfAssembledMultiblock()) { IBlockState state = Blocks.GOLD_BLOCK.getDefaultState(); Tessellator tessellator = Tessellator.getInstance(); FastBlockModelRenderer .renderBlockModel(tessellator, tileentity.getWorld(), state, brightness); } else { if (tileentity.isMaster()) { double keyframe = tileentity.getCurrentKeyframe(partialTick); GlStateManager.pushMatrix(); float rotationYaw = tileentity.getMultiBlockSchematic().getMultiblockRotation() .getYaw(); Vector centerOffset = new Vector(.5, 0, .5); RotationMatrices .applyTransform(RotationMatrices.getRotationMatrix(0, -rotationYaw, 0), centerOffset); GlStateManager.translate(centerOffset.X, centerOffset.Y, centerOffset.Z); GlStateManager.translate(.5, 0, .5); GlStateManager.scale(2, 2, 2); GlStateManager.rotate(-rotationYaw, 0, 1, 0); GlStateManager.translate(-.5, 0, -.5); GibsAnimationRegistry.getAnimation("valkyrium_compressor") .renderAnimation(keyframe, brightness); GlStateManager.popMatrix(); } } GlStateManager.popMatrix(); GlStateManager.popMatrix(); GlStateManager.enableLighting(); GlStateManager.resetColor(); }
Example 13
Source File: ValkyriumEnginePartTileEntityRenderer.java From Valkyrien-Skies with Apache License 2.0 | 4 votes |
@Override public void render(TileEntityValkyriumEnginePart tileentity, double x, double y, double z, float partialTick, int destroyStage, float alpha) { this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); GlStateManager.translate(x, y, z); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); int brightness = tileentity.getWorld().getCombinedLight(tileentity.getPos(), 0); GlStateManager.pushMatrix(); if (!tileentity.isPartOfAssembledMultiblock()) { IBlockState state = Blocks.IRON_BLOCK.getDefaultState(); Tessellator tessellator = Tessellator.getInstance(); FastBlockModelRenderer .renderBlockModel(tessellator, tileentity.getWorld(), state, brightness); } else if (tileentity.isMaster()) { // Im not sure why this has to be done, something is wrong with my rotation // intuition. float tileYaw = -tileentity.getMultiBlockSchematic().getMultiblockRotation().getYaw() + 180; GlStateManager.translate(.5, 0, .5); GlStateManager.scale(3, 3, 3); GlStateManager.rotate(tileYaw, 0, 1, 0); GlStateManager.translate(-.5, 0, -.5); double keyframe = tileentity.getCurrentKeyframe(partialTick); GibsAnimationRegistry.getAnimation("valkyrium_engine") .renderAnimation(keyframe, brightness); } GlStateManager.popMatrix(); GlStateManager.popMatrix(); GlStateManager.enableLighting(); GlStateManager.resetColor(); }
Example 14
Source File: GuiEnderUtilities.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
/** * Draw the template stacks from a "lockable inventory" for otherwise empty slots * @param inv */ protected void drawTemplateStacks(ItemStackHandlerLockable inv) { // Draw a faint version of the template item for empty locked slots RenderHelper.enableGUIStandardItemLighting(); GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); GlStateManager.enableRescaleNormal(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0f, 240.0f); this.zLevel = 100.0F; this.itemRender.zLevel = 100.0F; int invSize = inv.getSlots(); for (int slotNum = 0; slotNum < invSize; slotNum++) { Slot slot = this.inventorySlots.getSlot(slotNum); if (inv.isSlotLocked(slotNum) && inv.getStackInSlot(slotNum).isEmpty()) { ItemStack stack = inv.getTemplateStackInSlot(slotNum); if (stack.isEmpty() == false) { int x = this.guiLeft + slot.xPos; int y = this.guiTop + slot.yPos; GlStateManager.enableLighting(); GlStateManager.enableDepth(); GlStateManager.enableBlend(); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); this.itemRender.renderItemAndEffectIntoGUI(stack, x, y); } } } this.itemRender.zLevel = 0.0F; this.zLevel = 0.0F; GlStateManager.disableBlend(); GlStateManager.enableLighting(); GlStateManager.enableDepth(); RenderHelper.enableStandardItemLighting(); }
Example 15
Source File: FontUtils.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 4 votes |
public static void drawItemQuantity(int x, int y, ItemStack item, String quantity, int mode) { if(item == null || (quantity == null && item.stackSize <= 1)) return; if(quantity == null) { switch(mode) { case 2: int q = item.stackSize; String postfix = ""; for(int p = 0; p < 3 && q > 1000; p++) { q/=1000; postfix = prefixes[p]; } quantity = Integer.toString(q)+postfix; break; case 1: quantity = ""; if(item.stackSize/64 > 0) quantity+=item.stackSize/64 + "s"; if(item.stackSize%64 > 0) quantity+=item.stackSize%64; break; default: quantity = Integer.toString(item.stackSize); break; } } double scale = quantity.length() > 2 ? 0.5 : 1; double sheight = 8*scale; double swidth = fontRenderer.getStringWidth(quantity)*scale; GlStateManager.disableLighting(); GlStateManager.disableDepth(); GlStateManager.pushMatrix(); GlStateManager.translate(x + 16 - swidth, y + 16 - sheight, 0); GlStateManager.scale(scale, scale, 1); fontRenderer.drawStringWithShadow(quantity, 0, 0, 0xFFFFFF); GlStateManager.popMatrix(); GlStateManager.enableLighting(); GlStateManager.enableDepth(); }
Example 16
Source File: BasicNodeTileEntityRenderer.java From Valkyrien-Skies with Apache License 2.0 | 4 votes |
private void renderWire(double x, double y, double z, double entity1x, double entity1y, double entity1z, double entity2x, double entity2y, double entity2z) { GlStateManager.enableAlpha(); GlStateManager.enableBlend(); float wireR = .6f; float wireG = .25f; float wireB = .02f; float wireAlpha = 1.0f; // Vec3d vec = new Vec3d(x,y,z); // if (vec.lengthSquared() < .01D) { // System.out.println("REE"); // } // y = .5D; Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); double d0 = 0;// this.interpolateValue(entity.prevRotationYaw, entity.rotationYaw, // partialTicks * 0.5F) * 0.01745329238474369D; double d1 = 0;// this.interpolateValue(entity.prevRotationPitch, entity.rotationPitch, // partialTicks * 0.5F) * 0.01745329238474369D; double d2 = Math.cos(d0); double d3 = Math.sin(d0); double d4 = Math.sin(d1); // if (entity instanceof EntityHanging) // { d4 = -1.0D; // } double fakeYaw = 0;// Math.PI / 6D; double d6 = entity1x; double d7 = entity1y; double d8 = entity1z; double d9 = fakeYaw; d2 = 0;// fakeWidth;; d3 = 0;// fakeWidth; double d10 = entity2x + d2; double d11 = entity2y; double d12 = entity2z + d3; x = x + d2; z = z + d3; double d13 = ((float) (d6 - d10)); double d14 = ((float) (d7 - d11)); double d15 = ((float) (d8 - d12)); GlStateManager.disableTexture2D(); GlStateManager.disableLighting(); GlStateManager.disableCull(); int i = 24; double d16 = 0.025D; bufferbuilder.begin(5, DefaultVertexFormats.POSITION_COLOR); for (int j = 0; j <= 24; ++j) { float f3 = j / 24.0F; bufferbuilder.pos(x + d13 * f3 + 0.0D, y + d14 * (f3 * f3 + f3) * 0.5D + ((24.0F - j) / 18.0F + 0.125F), z + d15 * f3).color(wireR, wireG, wireB, wireAlpha).endVertex(); bufferbuilder .pos(x + d13 * f3 + 0.025D, y + d14 * (f3 * f3 + f3) * 0.5D + ((24.0F - j) / 18.0F + 0.125F) + 0.025D, z + d15 * f3) .color(wireR, wireG, wireB, wireAlpha).endVertex(); } tessellator.draw(); bufferbuilder.begin(5, DefaultVertexFormats.POSITION_COLOR); for (int k = 0; k <= 24; ++k) { float f4 = 204F / 255F;// .282F;//0.5F; float f5 = 122F / 255F;// .176F;//0.4F; float f6 = 0;// 0.078F;//0.3F; // f4 *= 2.2F; // f5 *= 2.2F; // f6 *= 2.2F; if (k % 2 == 0) { f4 *= 0.7F; f5 *= 0.7F; f6 *= 0.7F; } float f7 = k / 24.0F; bufferbuilder.pos(x + d13 * f7 + 0.0D, y + d14 * (f7 * f7 + f7) * 0.5D + ((24.0F - k) / 18.0F + 0.125F) + 0.025D, z + d15 * f7) .color(wireR, wireG, wireB, wireAlpha).endVertex(); bufferbuilder.pos(x + d13 * f7 + 0.025D, y + d14 * (f7 * f7 + f7) * 0.5D + ((24.0F - k) / 18.0F + 0.125F), z + d15 * f7 + 0.025D).color(wireR, wireG, wireB, wireAlpha).endVertex(); } tessellator.draw(); GlStateManager.enableLighting(); GlStateManager.enableTexture2D(); GlStateManager.enableCull(); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); }
Example 17
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 18
Source File: RenderBeam.java From TofuCraftReload with MIT License | 4 votes |
/** * Renders the desired {@code T} type Entity. */ public void doRender(EntityBeam entity, double x, double y, double z, float entityYaw, float partialTicks) { this.bindEntityTexture(entity); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); GlStateManager.translate((float) x, (float) y, (float) z); GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); GlStateManager.enableRescaleNormal(); GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F); GlStateManager.scale(0.05625F, 0.05625F, 0.05625F); GlStateManager.translate(-4.0F, 0.0F, 0.0F); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE); GlStateManager.depthMask(true); GlStateManager.glNormal3f(0.05625F, 0.0F, 0.0F); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(-7.0D, -2.0D, -2.0D).tex(0.0D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, -2.0D, 2.0D).tex(0.15625D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, 2.0D, 2.0D).tex(0.15625D, 0.3125D).endVertex(); bufferbuilder.pos(-7.0D, 2.0D, -2.0D).tex(0.0D, 0.3125D).endVertex(); tessellator.draw(); GlStateManager.glNormal3f(-0.05625F, 0.0F, 0.0F); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(-7.0D, 2.0D, -2.0D).tex(0.0D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, 2.0D, 2.0D).tex(0.15625D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, -2.0D, 2.0D).tex(0.15625D, 0.3125D).endVertex(); bufferbuilder.pos(-7.0D, -2.0D, -2.0D).tex(0.0D, 0.3125D).endVertex(); tessellator.draw(); for (int j = 0; j < 4; ++j) { GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.glNormal3f(0.0F, 0.0F, 0.05625F); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(-8.0D, -2.0D, 0.0D).tex(0.0D, 0.0D).endVertex(); bufferbuilder.pos(8.0D, -2.0D, 0.0D).tex(0.5D, 0.0D).endVertex(); bufferbuilder.pos(8.0D, 2.0D, 0.0D).tex(0.5D, 0.15625D).endVertex(); bufferbuilder.pos(-8.0D, 2.0D, 0.0D).tex(0.0D, 0.15625D).endVertex(); tessellator.draw(); } if (this.renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.disableRescaleNormal(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); }
Example 19
Source File: LiftLeverTileEntityRenderer.java From Valkyrien-Skies with Apache License 2.0 | 4 votes |
@Override public void render(TileEntityLiftLever tileentity, double x, double y, double z, float partialTick, int destroyStage, float alpha) { this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); GlStateManager.translate(x, y, z); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); GlStateManager.pushMatrix(); int brightness = tileentity.getWorld().getCombinedLight(tileentity.getPos(), 0); IBlockState gearState = Minecraft.getMinecraft().world.getBlockState(tileentity.getPos()); if (gearState.getBlock() instanceof BlockLiftLever) { EnumFacing facing = gearState.getValue(BlockHorizontal.FACING); GlStateManager.translate(0.5, 0.5, 0.5); switch (facing) { case UP: GL11.glRotated(90, 1, 0, 0); break; case DOWN: GL11.glRotated(270, 1, 0, 0); break; case NORTH: GL11.glRotated(0, 0, 1, 0); break; case EAST: GL11.glRotated(270, 0, 1, 0); break; case SOUTH: GL11.glRotated(180, 0, 1, 0); break; case WEST: GL11.glRotated(90, 0, 1, 0); break; } GlStateManager.translate(-0.5, -0.5, -0.5); } float leverOffset = tileentity.getPrevLeverOffset() + (tileentity.getLeverOffset() - tileentity.getPrevLeverOffset()) * partialTick; // double keyframe = ((Minecraft.getMinecraft().world.getTotalWorldTime() + partialTick) % 44) + 1; double keyframe = (44 * leverOffset) + 1; GibsAnimationRegistry.getAnimation("lift_lever").renderAnimation(keyframe, brightness); GlStateManager.popMatrix(); GlStateManager.popMatrix(); GlStateManager.enableLighting(); GlStateManager.resetColor(); }
Example 20
Source File: TileEntityPhysicsInfuserRenderer.java From Valkyrien-Skies with Apache License 2.0 | 4 votes |
@Override public void render(TileEntityPhysicsInfuser tileentity, double x, double y, double z, float partialTick, int destroyStage, float alpha) { this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); GlStateManager.translate(x, y, z); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); GlStateManager.pushMatrix(); int brightness = tileentity.getWorld() .getCombinedLight(tileentity.getPos(), 0); GlStateManager.translate(.5, 0, .5); double keyframe = 1; IBlockState physicsInfuserState = ValkyrienSkiesMod.INSTANCE.physicsInfuser .getStateFromMeta(tileentity.getBlockMetadata()); EnumFacing enumfacing = physicsInfuserState.getValue(BlockPhysicsInfuser.FACING); int coreBrightness = physicsInfuserState.getValue(BlockPhysicsInfuser.INFUSER_LIGHT_ON) ? 15728864 : brightness; float physicsInfuserRotation = -enumfacing.getHorizontalAngle() + 180; GlStateManager.rotate(physicsInfuserRotation, 0, 1, 0); GlStateManager.translate(-.5, 0, -.5); // First translate the model one block to the right GlStateManager.translate(-1, 0, 0); GlStateManager.scale(2, 2, 2); GibsAnimationRegistry.getAnimation("physics_infuser_empty") .renderAnimation(keyframe, brightness); IAtomAnimation cores_animation = GibsAnimationRegistry .getAnimation("physics_infuser_cores"); // Render only the cores that exist within the physics infuser's inventory. IItemHandler handler = tileentity .getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); for (TileEntityPhysicsInfuser.EnumInfuserCore infuserCore : TileEntityPhysicsInfuser.EnumInfuserCore .values()) { if (!handler.getStackInSlot(infuserCore.coreSlotIndex).isEmpty) { GlStateManager.pushMatrix(); GlStateManager .translate(0, tileentity.getCoreVerticalOffset(infuserCore, partialTick), 0); cores_animation .renderAnimationNode(infuserCore.coreModelName, keyframe, coreBrightness); GlStateManager.popMatrix(); } } GlStateManager.popMatrix(); GlStateManager.popMatrix(); GlStateManager.enableLighting(); GlStateManager.resetColor(); }