private void renderLiquid(TileEntity tile, double par2, double par4, double par6) { GL11.glTranslated(par2, par4, par6); TileEntityFillingStation tr = (TileEntityFillingStation) tile; double dx = 0; double dz = 0; double ddx = 0; double ddz = 0; switch (tr.getBlockMetadata()) { case 0: dx = 0.25; break; case 1: ddx = 0.25; break; case 2: dz = 0.25; break; case 3: ddz = 0.25; break; } if (!tr.isEmpty() && tr.isInWorld()) { Fluid f = tr.getFluid(); if (!f.equals(FluidRegistry.LAVA)) { GL11.glEnable(GL11.GL_BLEND); } ReikaLiquidRenderer.bindFluidTexture(f); IIcon ico = f.getIcon(); float u = ico.getMinU(); float v = ico.getMinV(); float du = ico.getMaxU(); float dv = ico.getMaxV(); double h = 0.0625 + 14D / 16D * tr.getLevel() / tr.CAPACITY; Tessellator v5 = Tessellator.instance; if (f.getLuminosity() > 0) ReikaRenderHelper.disableLighting(); v5.startDrawingQuads(); v5.setNormal(0, 1, 0); v5.addVertexWithUV(dx + 0, h, -ddz + 1, u, dv); v5.addVertexWithUV(-ddx + 1, h, -ddz + 1, du, dv); v5.addVertexWithUV(-ddx + 1, h, dz + 0, du, v); v5.addVertexWithUV(dx + 0, h, dz + 0, u, v); v5.draw(); ReikaRenderHelper.enableLighting(); } GL11.glTranslated(-par2, -par4, -par6); GL11.glDisable(GL11.GL_BLEND); }
private final void drawGraphics() { int posX = (width - xSize) / 2 - 2; int posY = (height - ySize) / 2 - 8; ReikaRenderHelper.disableLighting(); int msx = ReikaGuiAPI.instance.getMouseRealX(); int msy = ReikaGuiAPI.instance.getMouseRealY(); this.drawAuxGraphics(posX, posY); }
public void grind(World world, int mx, int my, int mz, int x, int y, int z, int meta) { if (this.processBlock(world, x, y, z)) { if (this.isBedrock(world, x, y, z)) { world.playSoundEffect( x + 0.5D, y + 0.5D, z + 0.5D, "dig.stone", 0.5F, rand.nextFloat() * 0.4F + 0.8F); world.setBlock(x, y, z, BlockRegistry.BEDROCKSLICE.getBlockInstance(), 0, 3); } else { int rockmetadata = world.getBlockMetadata(x, y, z); if (rockmetadata < 15) { world.playSoundEffect( x + 0.5D, y + 0.5D, z + 0.5D, "dig.stone", 0.5F, rand.nextFloat() * 0.4F + 0.8F); world.setBlockMetadataWithNotify(x, y, z, rockmetadata + 1, 3); } else { world.playSoundEffect( x + 0.5D, y + 0.5D, z + 0.5D, "mob.blaze.hit", 0.5F, rand.nextFloat() * 0.4F + 0.8F); ItemStack is = this.getDrops(world, x, y, z); world.setBlockToAir(x, y, z); if (!this.chestCheck(world, x, y, z, is)) { if (this.isInventoryFull()) ReikaItemHelper.dropItem(world, dropx, dropy, dropz, is); else ReikaInventoryHelper.addOrSetStack(is, inv, 0); } RotaryAchievements.BEDROCKBREAKER.triggerAchievement(this.getPlacer()); MinecraftForge.EVENT_BUS.post(new BedrockDigEvent(this, x, y, z)); if (!world.isRemote) this.incrementStep(world, mx, my, mz); } } } else { Block b = world.getBlock(x, y, z); if (b != Blocks.air && b.getBlockHardness(world, x, y, z) >= 0) { ReikaSoundHelper.playBreakSound(world, x, y, z, b); if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) ReikaRenderHelper.spawnDropParticles(world, x, y, z, b, world.getBlockMetadata(x, y, z)); world.setBlockToAir(x, y, z); } if (!world.isRemote) this.incrementStep(world, mx, my, mz); } }
private void renderScreen(TileEntityDisplay tile, double par2, double par4, double par6) { if (tile == null) return; GL11.glTranslated(0, 0, 0.495); ReikaRenderHelper.prepareGeoDraw(true); Tessellator v5 = Tessellator.instance; int r = tile.getRed(); int g = tile.getGreen(); int b = tile.getBlue(); int br = tile.getBorderRed(); int bg = tile.getBorderGreen(); int bb = tile.getBorderBlue(); v5.startDrawingQuads(); v5.setColorRGBA(r, g, b, 96); v5.addVertex(-2, 4, 0); v5.addVertex(3, 4, 0); v5.addVertex(3, 1, 0); v5.addVertex(-2, 1, 0); v5.draw(); double dd = 0.03125; double dx = dd; double dy = dd; double dz = 0; GL11.glTranslated(0, 0, 0.0005); v5.startDrawingQuads(); v5.setColorRGBA(br, bg, bb, 255); v5.addVertex(-2, 4, 0); v5.addVertex(3, 4, 0); v5.addVertex(3, 4 - dy, 0); v5.addVertex(-2, 4 - dy, 0); v5.draw(); v5.startDrawingQuads(); v5.setColorRGBA(br, bg, bb, 255); v5.addVertex(-2, 1, 0); v5.addVertex(3, 1, 0); v5.addVertex(3, 1 + dy, 0); v5.addVertex(-2, 1 + dy, 0); v5.draw(); v5.startDrawingQuads(); v5.setColorRGBA(br, bg, bb, 255); v5.addVertex(3, 4, 0); v5.addVertex(3, 1, 0); v5.addVertex(3 - dx, 1, 0); v5.addVertex(3 - dx, 4, 0); v5.draw(); v5.startDrawingQuads(); v5.setColorRGBA(br, bg, bb, 255); v5.addVertex(-2, 4, 0); v5.addVertex(-2, 1, 0); v5.addVertex(-2 + dx, 1, 0); v5.addVertex(-2 + dx, 4, 0); v5.draw(); v5.startDrawing(GL11.GL_LINES); v5.setColorRGBA(br, bg, bb, 32); float vspacing = 0.0625F; float hspacing = 0.25F; for (float k = 1 + vspacing; k < 4; k += vspacing) { v5.addVertex(-2, k, 0); v5.addVertex(3, k, 0); } for (float k = -2 + hspacing; k < 3; k += hspacing) { v5.addVertex(k, 4, 0); v5.addVertex(k, 1, 0); } v5.draw(); GL11.glTranslated(0, 0, -0.0005); ReikaRenderHelper.exitGeoDraw(); GL11.glTranslated(0, 0, -0.495); }
private void renderLiquid( TileEntityPiping tile, double par2, double par4, double par6, ForgeDirection dir) { if (!tile.hasLiquid()) return; float size = 0.75F / 2F; float window = 0.5F / 2F; float dl = size - window; float dd = 0.5F - size; double in = 0.5 + size - 0.01; double in2 = 0.5 - size + 0.01; double dd2 = in - in2; Fluid f = tile.getLiquidType(); if (f == null) return; Icon ico = tile.getLiquidType().getIcon(); ReikaLiquidRenderer.bindFluidTexture(f); if (f.getLuminosity() > 0) ReikaRenderHelper.disableLighting(); float u = ico.getMinU(); float v = ico.getMinV(); float u2 = ico.getMaxU(); float v2 = ico.getMaxV(); double du = dd2 * (u2 - u) / 4D; GL11.glTranslated(par2, par4, par6); GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor3f(1, 1, 1); Tessellator v5 = new Tessellator(); v5.startDrawingQuads(); v5.setNormal(dir.offsetX, dir.offsetY, dir.offsetZ); // this.faceBrightness(ForgeDirection.DOWN, v5); if (!tile.isConnectionValidForSide(dir)) { switch (dir) { case UP: v5.addVertexWithUV(in2, in, in, u, v2); v5.addVertexWithUV(in, in, in, u2, v2); v5.addVertexWithUV(in, in, in2, u2, v); v5.addVertexWithUV(in2, in, in2, u, v); break; case DOWN: v5.addVertexWithUV(in2, in2, in2, u, v); v5.addVertexWithUV(in, in2, in2, u2, v); v5.addVertexWithUV(in, in2, in, u2, v2); v5.addVertexWithUV(in2, in2, in, u, v2); break; case SOUTH: v5.addVertexWithUV(in, in, in, u, v); v5.addVertexWithUV(in2, in, in, u2, v); v5.addVertexWithUV(in2, in2, in, u2, v2); v5.addVertexWithUV(in, in2, in, u, v2); break; case NORTH: v5.addVertexWithUV(in, in2, in2, u, v2); v5.addVertexWithUV(in2, in2, in2, u2, v2); v5.addVertexWithUV(in2, in, in2, u2, v); v5.addVertexWithUV(in, in, in2, u, v); break; case EAST: v5.addVertexWithUV(in, in2, in, u, v2); v5.addVertexWithUV(in, in2, in2, u2, v2); v5.addVertexWithUV(in, in, in2, u2, v); v5.addVertexWithUV(in, in, in, u, v); break; case WEST: v5.addVertexWithUV(in2, in, in, u, v); v5.addVertexWithUV(in2, in, in2, u2, v); v5.addVertexWithUV(in2, in2, in2, u2, v2); v5.addVertexWithUV(in2, in2, in, u, v2); default: break; } } else { // is connected on side switch (dir) { case DOWN: v5.setNormal(-1, 0, 0); v5.addVertexWithUV(in2, in2, in, u, v); v5.addVertexWithUV(in2, in2, in2, u2, v); v5.addVertexWithUV(in2, 0, in2, u2, v + du); v5.addVertexWithUV(in2, 0, in, u, v + du); v5.setNormal(1, 0, 0); v5.addVertexWithUV(in, 0, in, u, v + du); v5.addVertexWithUV(in, 0, in2, u2, v + du); v5.addVertexWithUV(in, in2, in2, u2, v); v5.addVertexWithUV(in, in2, in, u, v); v5.setNormal(0, 0, -1); v5.addVertexWithUV(in, 0, in2, u, v + du); v5.addVertexWithUV(in2, 0, in2, u2, v + du); v5.addVertexWithUV(in2, in2, in2, u2, v); v5.addVertexWithUV(in, in2, in2, u, v); v5.setNormal(0, 0, 1); v5.addVertexWithUV(in, in2, in, u, v); v5.addVertexWithUV(in2, in2, in, u2, v); v5.addVertexWithUV(in2, 0, in, u2, v + du); v5.addVertexWithUV(in, 0, in, u, v + du); break; case UP: v5.setNormal(-1, 0, 0); v5.addVertexWithUV(in2, 1, in, u, v + du); v5.addVertexWithUV(in2, 1, in2, u2, v + du); v5.addVertexWithUV(in2, in, in2, u2, v); v5.addVertexWithUV(in2, in, in, u, v); v5.setNormal(1, 0, 0); v5.addVertexWithUV(in, in, in, u, v); v5.addVertexWithUV(in, in, in2, u2, v); v5.addVertexWithUV(in, 1, in2, u2, v + du); v5.addVertexWithUV(in, 1, in, u, v + du); v5.setNormal(0, 0, -1); v5.addVertexWithUV(in, in, in2, u, v); v5.addVertexWithUV(in2, in, in2, u2, v); v5.addVertexWithUV(in2, 1, in2, u2, v + du); v5.addVertexWithUV(in, 1, in2, u, v + du); v5.setNormal(0, 0, 1); v5.addVertexWithUV(in, 1, in, u, v + du); v5.addVertexWithUV(in2, 1, in, u2, v + du); v5.addVertexWithUV(in2, in, in, u2, v); v5.addVertexWithUV(in, in, in, u, v); break; case NORTH: v5.setNormal(-1, 0, 0); v5.addVertexWithUV(in2, in2, 0, u, v2); v5.addVertexWithUV(in2, in2, in2, u + du, v2); v5.addVertexWithUV(in2, in, in2, u + du, v); v5.addVertexWithUV(in2, in, 0, u, v); v5.setNormal(1, 0, 0); v5.addVertexWithUV(in, in, 0, u, v); v5.addVertexWithUV(in, in, in2, u + du, v); v5.addVertexWithUV(in, in2, in2, u + du, v2); v5.addVertexWithUV(in, in2, 0, u, v2); v5.setNormal(0, 1, 0); v5.addVertexWithUV(in2, in, 0, u, v2); v5.addVertexWithUV(in2, in, in2, u + du, v2); v5.addVertexWithUV(in, in, in2, u + du, v); v5.addVertexWithUV(in, in, 0, u, v); v5.setNormal(0, -1, 0); v5.addVertexWithUV(in, in2, 0, u, v); v5.addVertexWithUV(in, in2, in2, u + du, v); v5.addVertexWithUV(in2, in2, in2, u + du, v2); v5.addVertexWithUV(in2, in2, 0, u, v2); break; case SOUTH: v5.setNormal(-1, 0, 0); v5.addVertexWithUV(in2, in, 1, u, v); v5.addVertexWithUV(in2, in, in, u + du, v); v5.addVertexWithUV(in2, in2, in, u + du, v2); v5.addVertexWithUV(in2, in2, 1, u, v2); v5.setNormal(1, 0, 0); v5.addVertexWithUV(in, in2, 1, u, v2); v5.addVertexWithUV(in, in2, in, u + du, v2); v5.addVertexWithUV(in, in, in, u + du, v); v5.addVertexWithUV(in, in, 1, u, v); v5.setNormal(0, 1, 0); v5.addVertexWithUV(in, in, 1, u, v); v5.addVertexWithUV(in, in, in, u + du, v); v5.addVertexWithUV(in2, in, in, u + du, v2); v5.addVertexWithUV(in2, in, 1, u, v2); v5.setNormal(0, -1, 0); v5.addVertexWithUV(in2, in2, 1, u, v2); v5.addVertexWithUV(in2, in2, in, u + du, v2); v5.addVertexWithUV(in, in2, in, u + du, v); v5.addVertexWithUV(in, in2, 1, u, v); break; case EAST: v5.setNormal(0, 0, 1); v5.addVertexWithUV(1, in, in, u, v); v5.addVertexWithUV(in, in, in, u + du, v); v5.addVertexWithUV(in, in2, in, u + du, v2); v5.addVertexWithUV(1, in2, in, u, v2); v5.setNormal(0, 0, -1); v5.addVertexWithUV(1, in2, in2, u, v2); v5.addVertexWithUV(in, in2, in2, u + du, v2); v5.addVertexWithUV(in, in, in2, u + du, v); v5.addVertexWithUV(1, in, in2, u, v); v5.setNormal(0, 1, 0); v5.addVertexWithUV(1, in, in2, u, v2); v5.addVertexWithUV(in, in, in2, u + du, v2); v5.addVertexWithUV(in, in, in, u + du, v); v5.addVertexWithUV(1, in, in, u, v); v5.setNormal(0, -1, 0); v5.addVertexWithUV(1, in2, in, u, v); v5.addVertexWithUV(in, in2, in, u + du, v); v5.addVertexWithUV(in, in2, in2, u + du, v2); v5.addVertexWithUV(1, in2, in2, u, v2); break; case WEST: v5.setNormal(0, 0, 1); v5.addVertexWithUV(0, in2, in, u, v2); v5.addVertexWithUV(in2, in2, in, u + du, v2); v5.addVertexWithUV(in2, in, in, u + du, v); v5.addVertexWithUV(0, in, in, u, v); v5.setNormal(0, 0, -1); v5.addVertexWithUV(0, in, in2, u, v); v5.addVertexWithUV(in2, in, in2, u + du, v); v5.addVertexWithUV(in2, in2, in2, u + du, v2); v5.addVertexWithUV(0, in2, in2, u, v2); v5.setNormal(0, 1, 0); v5.addVertexWithUV(0, in, in, u, v); v5.addVertexWithUV(in2, in, in, u + du, v); v5.addVertexWithUV(in2, in, in2, u + du, v2); v5.addVertexWithUV(0, in, in2, u, v2); v5.setNormal(0, -1, 0); v5.addVertexWithUV(0, in2, in2, u, v2); v5.addVertexWithUV(in2, in2, in2, u + du, v2); v5.addVertexWithUV(in2, in2, in, u + du, v); v5.addVertexWithUV(0, in2, in, u, v); break; default: break; } } if (tile.isConnectedToNonSelf(dir)) { v5.setNormal(dir.offsetX, dir.offsetY, dir.offsetZ); switch (dir) { case UP: v5.addVertexWithUV(in2, 0.99, in, u, v2); v5.addVertexWithUV(in, 0.99, in, u2, v2); v5.addVertexWithUV(in, 0.99, in2, u2, v); v5.addVertexWithUV(in2, 0.99, in2, u, v); break; case DOWN: v5.addVertexWithUV(in2, 0.01, in2, u, v); v5.addVertexWithUV(in, 0.01, in2, u2, v); v5.addVertexWithUV(in, 0.01, in, u2, v2); v5.addVertexWithUV(in2, 0.01, in, u, v2); break; case SOUTH: v5.addVertexWithUV(in, in, 0.99, u, v); v5.addVertexWithUV(in2, in, 0.99, u2, v); v5.addVertexWithUV(in2, in2, 0.99, u2, v2); v5.addVertexWithUV(in, in2, 0.99, u, v2); break; case NORTH: v5.addVertexWithUV(in, in2, 0.01, u, v2); v5.addVertexWithUV(in2, in2, 0.01, u2, v2); v5.addVertexWithUV(in2, in, 0.01, u2, v); v5.addVertexWithUV(in, in, 0.01, u, v); break; case EAST: v5.addVertexWithUV(0.99, in2, in, u, v2); v5.addVertexWithUV(0.99, in2, in2, u2, v2); v5.addVertexWithUV(0.99, in, in2, u2, v); v5.addVertexWithUV(0.99, in, in, u, v); break; case WEST: v5.addVertexWithUV(0.01, in, in, u, v); v5.addVertexWithUV(0.01, in, in2, u2, v); v5.addVertexWithUV(0.01, in2, in2, u2, v2); v5.addVertexWithUV(0.01, in2, in, u, v2); default: break; } } v5.draw(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); ReikaRenderHelper.enableLighting(); GL11.glTranslated(-par2, -par4, -par6); GL11.glDisable(GL11.GL_BLEND); }
private void renderPylon(int posX, int posY) { float mod = 2000F; int tick = (int) ((System.currentTimeMillis() / (double) mod) % 16); CrystalElement e1 = CrystalElement.elements[tick]; CrystalElement e2 = CrystalElement.elements[(tick + 1) % 16]; float mix = (float) (System.currentTimeMillis() % (double) mod) / mod; mix = Math.min(mix * 2, 1); int c1 = e1.getColor(); int c2 = e2.getColor(); int color = ReikaColorAPI.mixColors(c2, c1, mix); ReikaTextureHelper.bindTerrainTexture(); Tessellator v5 = Tessellator.instance; v5.setBrightness(240); v5.startDrawingQuads(); v5.setColorOpaque_I(color); IIcon ico = ChromaIcons.ROUNDFLARE.getIcon(); GL11.glEnable(GL11.GL_BLEND); BlendMode.ADDITIVEDARK.apply(); float u = ico.getMinU(); float v = ico.getMinV(); float du = ico.getMaxU(); float dv = ico.getMaxV(); int w = 96; int x = posX + 115; int y = posY - 4; v5.addVertexWithUV(x, y + w, 0, u, dv); v5.addVertexWithUV(x + w, y + w, 0, du, dv); v5.addVertexWithUV(x + w, y, 0, du, v); v5.addVertexWithUV(x, y, 0, u, v); ico = ChromaIcons.BIGFLARE.getIcon(); u = ico.getMinU(); v = ico.getMinV(); du = ico.getMaxU(); dv = ico.getMaxV(); w = 8; Iterator<PylonParticle> it = particles.iterator(); while (it.hasNext()) { PylonParticle p = it.next(); v5.addVertexWithUV(p.posX, p.posY + w, 0, u, dv); v5.addVertexWithUV(p.posX + w, p.posY + w, 0, du, dv); v5.addVertexWithUV(p.posX + w, p.posY, 0, du, v); v5.addVertexWithUV(p.posX, p.posY, 0, u, v); p.move(180D / ReikaRenderHelper.getFPS()); p.age++; if (!ReikaMathLibrary.isValueInsideBounds(posX, posX + xSize - 8, p.posX) || !ReikaMathLibrary.isValueInsideBounds(posY, posY + 80, p.posY)) { it.remove(); } } v5.draw(); if (rand.nextInt(50) == 0) { particles.add(new PylonParticle(245, 40, rand.nextInt(360))); } BlendMode.DEFAULT.apply(); }
private final void drawGraphics(float ptick) { int posX = (width - xSize) / 2 - 2; int posY = (height - ySize) / 2 - 8; if (!this.isLimitedView()) { ReikaRenderHelper.disableLighting(); int msx = ReikaGuiAPI.instance.getMouseRealX(); int msy = ReikaGuiAPI.instance.getMouseRealY(); String s = String.format("Page %d/%d", screen, this.getMaxScreen()); // ReikaGuiAPI.instance.drawCenteredStringNoShadow(fontRendererObj, s, posX+xSize+23, posY+5, // 0xffffff); ReikaGuiAPI.instance.drawTooltipAt( fontRendererObj, s, posX + 24 + xSize + fontRendererObj.getStringWidth(s), posY + 20); if (ReikaGuiAPI.instance.isMouseInBox(posX - 18, posX + 2, posY + 0, posY + 220)) { String sg = ""; List<HandbookEntry> li = this.getAllTabsOnScreen(); int idx = (msy - posY) / 20; if (idx >= PAGES_PER_SCREEN) { int diff = idx - PAGES_PER_SCREEN; switch (diff) { case 0: sg = "Next"; break; case 1: sg = "Back"; break; case 2: sg = "Return"; break; } } else if (idx < li.size()) { HandbookEntry h = li.get(idx); sg = h.getTitle(); } if (!sg.isEmpty()) ReikaGuiAPI.instance.drawTooltipAt( fontRendererObj, sg, msx + fontRendererObj.getStringWidth(sg) + 30, msy); } } if (HandbookNotifications.instance.newAlerts() || PackModificationTracker.instance.modificationsExist(RotaryCraft.instance)) { ReikaTextureHelper.bindFinalTexture(DragonAPICore.class, "Resources/warning.png"); GL11.glEnable(GL11.GL_BLEND); Tessellator v5 = Tessellator.instance; int x = posX + 257; int y = posY + 18; int alpha = (int) (155 + 100 * Math.sin(Math.toRadians(System.currentTimeMillis() / 8 % 360))); v5.startDrawingQuads(); v5.setColorRGBA_I(0xffffff, alpha); v5.addVertexWithUV(x, y + 24, 0, 0, 1); v5.addVertexWithUV(x + 24, y + 24, 0, 1, 1); v5.addVertexWithUV(x + 24, y, 0, 1, 0); v5.addVertexWithUV(x, y, 0, 0, 0); v5.draw(); GL11.glDisable(GL11.GL_BLEND); int i = Mouse.getX() * width / mc.displayWidth; int j = height - Mouse.getY() * height / mc.displayHeight - 1; int dx = i - posX; int dy = j - posY; if (ReikaMathLibrary.isValueInsideBoundsIncl(261, 377, dx) && ReikaMathLibrary.isValueInsideBoundsIncl(22, 36, dy)) { if (HandbookNotifications.instance.newAlerts()) ReikaGuiAPI.instance.drawTooltip( fontRendererObj, "Some config settings have been changed."); if (PackModificationTracker.instance.modificationsExist(RotaryCraft.instance)) ReikaGuiAPI.instance.drawTooltip( fontRendererObj, "The modpack has made some changes to the mod.", 0, 10); } } this.drawAuxGraphics(posX, posY, ptick); }