public void drawLiquidRect(int startU, int startV, Icon par3Icon, int endU, int endV) { Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV( startU + 0, startV + endV, this.zLevel, par3Icon.getMinU(), par3Icon.getMaxV()); // Bottom left tessellator.addVertexWithUV( startU + endU, startV + endV, this.zLevel, par3Icon.getMaxU(), par3Icon.getMaxV()); // Bottom right tessellator.addVertexWithUV( startU + endU, startV + 0, this.zLevel, par3Icon.getMaxU(), par3Icon.getMinV()); // Top right tessellator.addVertexWithUV( startU + 0, startV + 0, this.zLevel, par3Icon.getMinU(), par3Icon.getMinV()); // Top left tessellator.draw(); }
public void renderIcon(int par1, int par2, Icon par3Icon, int par4, int par5) { Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV( (double) (par1 + 0), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMaxV()); tessellator.addVertexWithUV( (double) (par1 + par4), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMaxV()); tessellator.addVertexWithUV( (double) (par1 + par4), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMinV()); tessellator.addVertexWithUV( (double) (par1 + 0), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMinV()); tessellator.draw(); }
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glPushMatrix(); if (mc == null) { mc = FMLClientHandler.instance().getClient(); itemRenderer = new RenderItem(); } this.mc.renderEngine.bindTexture(TextureMap.locationItemsTexture); Tessellator tessellator = Tessellator.instance; if (type == ItemRenderType.EQUIPPED) { GL11.glTranslatef(-0.5F, -0.5F, 0); GL11.glScalef(2, 2, 1); Icon icon = ((ItemSpear) item.getItem()).bigIcon; RenderManager.instance.itemRenderer.renderItemIn2D( tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); if (item != null && item.hasEffect(0)) { // HeraldryItemRenderer.renderEnchantmentEffects(tessellator); } } else if (type == ItemRenderType.INVENTORY) { GL11.glColor4f(1F, 1F, 1F, 1F); // GL11.glRotatef(90, 0, 0, 1); itemRenderer.renderIcon(0, 0, item.getIconIndex(), 16, 16); } else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) { Icon icon = item.getIconIndex(); RenderManager.instance.itemRenderer.renderItemIn2D( tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); if (item != null && item.hasEffect(0)) { renderEnchantmentEffects(tessellator); } } GL11.glPopMatrix(); }
/** Renders the fire on the screen for first person mode. Arg: partialTickTime */ private void renderFireInFirstPerson(float par1) { Tessellator tessellator = Tessellator.instance; GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.9F); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); float f1 = 1.0F; for (int i = 0; i < 2; ++i) { GL11.glPushMatrix(); Icon icon = Block.fire.func_94438_c(1); float f2 = icon.getMinU(); float f3 = icon.getMaxU(); float f4 = icon.getMinV(); float f5 = icon.getMaxV(); float f6 = (0.0F - f1) / 2.0F; float f7 = f6 + f1; float f8 = 0.0F - f1 / 2.0F; float f9 = f8 + f1; float f10 = -0.5F; GL11.glTranslatef((float) (-(i * 2 - 1)) * 0.24F, -0.3F, 0.0F); GL11.glRotatef((float) (i * 2 - 1) * 10.0F, 0.0F, 1.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV((double) f6, (double) f8, (double) f10, (double) f3, (double) f5); tessellator.addVertexWithUV((double) f7, (double) f8, (double) f10, (double) f2, (double) f5); tessellator.addVertexWithUV((double) f7, (double) f9, (double) f10, (double) f2, (double) f4); tessellator.addVertexWithUV((double) f6, (double) f9, (double) f10, (double) f3, (double) f4); tessellator.draw(); GL11.glPopMatrix(); } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); }
/** Renders any block requiring crossed squares such as reeds, flowers, and mushrooms */ public static boolean renderPlantCrossedSquares( RenderBlocks renderBlocks, Block block, int metadata, int x, int y, int z, float scale, boolean flipped) { Tessellator tessellator = Tessellator.instance; tessellator.setBrightness(block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y, z)); Icon icon = FlowerPotHandler.getPlantIcon(new ItemStack(block, 1, metadata)); setPlantColor(block, x, y, z); double uMin = icon.getMinU(); double vMin = icon.getMinV(); double uMax = icon.getMaxU(); double vMax = icon.getMaxV(); double rotation = 0.45D * scale; double xMin = x + 0.5D - rotation; double xMax = x + 0.5D + rotation; double zMin = z + 0.5D - rotation; double zMax = z + 0.5D + rotation; if (flipped) { double temp = vMin; vMin = vMax; vMax = temp; } tessellator.addVertexWithUV(xMin, y + (double) scale, zMin, uMin, vMin); tessellator.addVertexWithUV(xMin, y + 0.0D, zMin, uMin, vMax); tessellator.addVertexWithUV(xMax, y + 0.0D, zMax, uMax, vMax); tessellator.addVertexWithUV(xMax, y + (double) scale, zMax, uMax, vMin); tessellator.addVertexWithUV(xMax, y + (double) scale, zMax, uMin, vMin); tessellator.addVertexWithUV(xMax, y + 0.0D, zMax, uMin, vMax); tessellator.addVertexWithUV(xMin, y + 0.0D, zMin, uMax, vMax); tessellator.addVertexWithUV(xMin, y + (double) scale, zMin, uMax, vMin); tessellator.addVertexWithUV(xMin, y + (double) scale, zMax, uMin, vMin); tessellator.addVertexWithUV(xMin, y + 0.0D, zMax, uMin, vMax); tessellator.addVertexWithUV(xMax, y + 0.0D, zMin, uMax, vMax); tessellator.addVertexWithUV(xMax, y + (double) scale, zMin, uMax, vMin); tessellator.addVertexWithUV(xMax, y + (double) scale, zMin, uMin, vMin); tessellator.addVertexWithUV(xMax, y + 0.0D, zMin, uMin, vMax); tessellator.addVertexWithUV(xMin, y + 0.0D, zMax, uMax, vMax); tessellator.addVertexWithUV(xMin, y + (double) scale, zMax, uMax, vMin); return true; }
private void func_77026_a(Tessellator par1Tessellator, Icon par2Icon) { float f = par2Icon.getMinU(); float f1 = par2Icon.getMaxU(); float f2 = par2Icon.getMinV(); float f3 = par2Icon.getMaxV(); float f4 = 1.0F; float f5 = 0.5F; float f6 = 0.25F; GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); par1Tessellator.startDrawingQuads(); par1Tessellator.setNormal(0.0F, 1.0F, 0.0F); par1Tessellator.addVertexWithUV( (double) (0.0F - f5), (double) (0.0F - f6), 0.0D, (double) f, (double) f3); par1Tessellator.addVertexWithUV( (double) (f4 - f5), (double) (0.0F - f6), 0.0D, (double) f1, (double) f3); par1Tessellator.addVertexWithUV( (double) (f4 - f5), (double) (f4 - f6), 0.0D, (double) f1, (double) f2); par1Tessellator.addVertexWithUV( (double) (0.0F - f5), (double) (f4 - f6), 0.0D, (double) f, (double) f2); par1Tessellator.draw(); }
/** * Renders the texture of the block the player is inside as an overlay. Args: partialTickTime, * blockTextureIndex */ private void renderInsideOfBlock(float par1, Icon par2Icon) { Tessellator tessellator = Tessellator.instance; float f1 = 0.1F; GL11.glColor4f(f1, f1, f1, 0.5F); GL11.glPushMatrix(); float f2 = -1.0F; float f3 = 1.0F; float f4 = -1.0F; float f5 = 1.0F; float f6 = -0.5F; float f7 = par2Icon.getMinU(); float f8 = par2Icon.getMaxU(); float f9 = par2Icon.getMinV(); float f10 = par2Icon.getMaxV(); tessellator.startDrawingQuads(); tessellator.addVertexWithUV((double) f2, (double) f4, (double) f6, (double) f8, (double) f10); tessellator.addVertexWithUV((double) f3, (double) f4, (double) f6, (double) f7, (double) f10); tessellator.addVertexWithUV((double) f3, (double) f5, (double) f6, (double) f7, (double) f9); tessellator.addVertexWithUV((double) f2, (double) f5, (double) f6, (double) f8, (double) f9); tessellator.draw(); GL11.glPopMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); }
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); }
public void vboRender( Block block, float var2, float height, float ampheight, float magnitude, float angle, float waveTime, int xx, int zz, float var3, float var4, float var5, float var6, float var7) { int dim = ModLoader.getMinecraftInstance().thePlayer.dimension; double playerY = ModLoader.getMinecraftInstance().thePlayer.posY; Tessellator var1 = Tessellator.instance; Icon icon = getParticleTextureIndex(dim, block); float var12 = 0.5F; float var13 = renderX - (float) EntityFX.interpPosX; float var14 = renderY - (float) EntityFX.interpPosY; float var15 = renderZ - (float) EntityFX.interpPosZ; // var14 = renderY - (renderYlast + ((float)playerY - renderYlast) * var2); // float var13 = renderX - (float)EntityFX.interpPosX; // var14 = (renderY - (float)playerY) - (renderYlast - renderY) * var2; // float var15 = renderZ - (float)EntityFX.interpPosZ; // System.out.println(var14); double distToCamera = Math.sqrt(var13 * var13 + var14 * var14 + var15 * var15); double distAlpha = 1D - ((distToCamera / ConfigWavesMisc.waveRenderRange) * 2D); float particleAlpha = 1F; if (dim == WeatherUtil.tropiDimID) { particleAlpha = 0.9F * (float) Math.min( 1D, 0.2 + ModLoader.getMinecraftInstance().theWorld.getSunBrightness(1F)); } particleAlpha = (float) Math.max(0.10D, particleAlpha * distAlpha); if (particleAlpha == 0.1D) return; float br = entRef.getBrightness(var2); br = (0.9F + (ModLoader.getMinecraftInstance().gameSettings.gammaSetting * 0.1F)) - (ModLoader.getMinecraftInstance().theWorld.calculateSkylightSubtracted(var2) * 0.03F); br *= ModLoader.getMinecraftInstance().theWorld.getSunBrightness(1F); // wave height darkening br = br - (height * 0.5F); if (br < 0.3F) br = 0.3F; float var16 = 0.35F * br * (2F /* + ModLoader.getMinecraftInstance().gameSettings.gammaSetting*/); // mod_ExtendedRenderer.plBrightness * 0.0000001F; int var18 = 0; if (block != null) { var18 = block.colorMultiplier(entRef.worldObj, (int) renderX, (int) renderY, (int) renderZ); } this.red = (float) (var18 >> 16 & 255) / 255.0F; this.green = (float) (var18 >> 8 & 255) / 255.0F; this.blue = (float) (var18 & 255) / 255.0F; if (dim == WeatherUtil.tropiDimID) { green -= 0.3D; } // particleAlpha = 1F; // var16 = this.getBrightness(var2) * (1F + // ModLoader.getMinecraftInstance().gameSettings.gammaSetting); float vecX = (float) Math.sin(angle) * magnitude; float vecZ = (float) Math.cos(angle) * magnitude; float maxheight = ampheight; float adj = 0.5F; float adj2 = 1F; float adj3 = 1F; BlockDataGrid wg = WeatherMod.weatherMan.waterGrid; BlockDataPoint bdp; // xx -= 0.5F; // zz -= 0.5F; float height0 = ((float) Math.sin(waveTime - (xx - adj) * vecX - ((zz - adj) * vecZ)) + 1F) * magnitude * maxheight; float height1 = ((float) Math.sin(waveTime - (xx - adj) * vecX - ((zz + adj) * vecZ)) + 1F) * magnitude * maxheight; float height2 = ((float) Math.sin(waveTime - (xx + adj) * vecX - ((zz + adj) * vecZ)) + 1F) * magnitude * maxheight; float height3 = ((float) Math.sin(waveTime - (xx + adj) * vecX - ((zz - adj) * vecZ)) + 1F) * magnitude * maxheight; // xx += 1.5F; // zz -= 0.5F; float yy = renderY - 0.9F; boolean d = false; /*height0 = (float)Math.sqrt(wg.getPoint((int)(xx-adj2), (int)yy, (int)(zz)).height * wg.getPoint((int)(xx-adj2), (int)yy, (int)(zz)).height + wg.getPoint((int)(xx), (int)yy, (int)(zz-adj2)).height * wg.getPoint((int)(xx), (int)yy, (int)(zz-adj2)).height); height1 = (float)Math.sqrt(wg.getPoint((int)(xx-adj2), (int)yy, (int)(zz)).height * wg.getPoint((int)(xx-adj2), (int)yy, (int)(zz)).height + wg.getPoint((int)(xx), (int)yy, (int)(zz+adj2)).height * wg.getPoint((int)(xx), (int)yy, (int)(zz+adj2)).height); height2 = (float)Math.sqrt(wg.getPoint((int)(xx+adj2), (int)yy, (int)(zz)).height * wg.getPoint((int)(xx+adj2), (int)yy, (int)(zz)).height + wg.getPoint((int)(xx), (int)yy, (int)(zz+adj2)).height * wg.getPoint((int)(xx), (int)yy, (int)(zz+adj2)).height); height3 = (float)Math.sqrt(wg.getPoint((int)(xx+adj2), (int)yy, (int)(zz)).height * wg.getPoint((int)(xx+adj2), (int)yy, (int)(zz)).height + wg.getPoint((int)(xx), (int)yy, (int)(zz-adj2)).height * wg.getPoint((int)(xx), (int)yy, (int)(zz-adj2)).height);*/ bdp = wg.getPoint((int) (xx), (int) yy, (int) (zz)); // System.out.println(bdp.height); if (wg.getPoint((int) (xx - adj2), (int) yy, (int) (zz)).height == 0 || wg.getPoint((int) (xx), (int) yy, (int) (zz - adj2)).height == 0 || /*wg.getPoint((int)(xx), (int)yy, (int)(zz+adj2)).height == 0 ||*/ wg.getPoint((int) (xx - adj2), (int) yy, (int) (zz - adj2)).height == 0) { if (d) { System.out.print("0 - "); } height0 = 0; } if (d) { System.out.print("xx: " + (xx - adj2) + " - zz: " + (zz - adj2) + " - "); } // height0 = bdp.height; bdp = wg.getPoint((int) (xx - adj2), (int) yy, (int) (zz + adj2)); if (wg.getPoint((int) (xx - adj2), (int) yy, (int) (zz)).height == 0 || wg.getPoint((int) (xx), (int) yy, (int) (zz + adj2)).height == 0 || wg.getPoint((int) (xx - adj2), (int) yy, (int) (zz + adj2)).height == 0) { if (d) { System.out.print("1 - "); } height1 = 0; } bdp = WeatherMod.weatherMan.waterGrid.getPoint((int) (xx + adj2), (int) yy, (int) (zz + adj2)); if (wg.getPoint((int) (xx + adj2), (int) yy, (int) (zz)).height == 0 || wg.getPoint((int) (xx), (int) yy, (int) (zz + adj2)).height == 0 || wg.getPoint((int) (xx + adj2), (int) yy, (int) (zz + adj2)).height == 0) { if (d) { System.out.print("2 - "); } height2 = 0; } bdp = WeatherMod.weatherMan.waterGrid.getPoint((int) (xx + adj2), (int) yy, (int) (zz - adj2)); if (wg.getPoint((int) (xx + adj2), (int) yy, (int) (zz)).height == 0 || wg.getPoint((int) (xx), (int) yy, (int) (zz - adj2)).height == 0 || wg.getPoint((int) (xx + adj2), (int) yy, (int) (zz - adj2)).height == 0) { if (d) { System.out.print("3 - "); } height3 = 0; } if (d) { System.out.print("| "); } // height0 = ((float)Math.sin(vecX*vecZ)) * magnitude * maxheight; // height0 = ((float)Math.sin(waveTime-xx*vecX-(zz*vecZ)) + 1F) * magnitude * maxheight; // height0 = height1 = height2 = height3 = 0F; if (ModLoader.getMinecraftInstance().objectMouseOver != null) { // System.out.println(ModLoader.getMinecraftInstance().objectMouseOver.blockX + " - " + // ModLoader.getMinecraftInstance().objectMouseOver.blockZ); } // var1.setColorOpaque_F(this.red * var16, this.green * var16, this.blue * var16); var1.setColorRGBA_F( this.red * var16, this.green * var16, this.blue * var16, Math.max(0F, particleAlpha)); /*var1.addVertexWithUV((double)(var13 - var3 * var12 - var6 * var12), (double)(height0 + var14 - var4 * var12), (double)(var15 - var5 * var12 - var7 * var12), (double)var9, (double)var11); var1.addVertexWithUV((double)(var13 - var3 * var12 + var6 * var12), (double)(height1 + var14 + var4 * var12), (double)(var15 - var5 * var12 + var7 * var12), (double)var9, (double)var10); var1.addVertexWithUV((double)(var13 + var3 * var12 + var6 * var12), (double)(height2 + var14 + var4 * var12), (double)(var15 + var5 * var12 + var7 * var12), (double)var8, (double)var10); var1.addVertexWithUV((double)(var13 + var3 * var12 - var6 * var12), (double)(height3 + var14 - var4 * var12), (double)(var15 + var5 * var12 - var7 * var12), (double)var8, (double)var11);*/ float f3 = icon.getMinU(); float f4 = icon.getMaxU(); float f5 = icon.getMinV(); float f6 = icon.getMaxV(); var1.addVertexWithUV( (double) (var13 - var3 * var12 - var6 * var12), (double) (height0 + var14 - var4 * var12), (double) (var15 - var5 * var12 - var7 * var12), (double) f3, (double) f6); var1.addVertexWithUV( (double) (var13 - var3 * var12 + var6 * var12), (double) (height1 + var14 + var4 * var12), (double) (var15 - var5 * var12 + var7 * var12), (double) f4, (double) f6); var1.addVertexWithUV( (double) (var13 + var3 * var12 + var6 * var12), (double) (height2 + var14 + var4 * var12), (double) (var15 + var5 * var12 + var7 * var12), (double) f4, (double) f5); var1.addVertexWithUV( (double) (var13 + var3 * var12 - var6 * var12), (double) (height3 + var14 - var4 * var12), (double) (var15 + var5 * var12 - var7 * var12), (double) f3, (double) f5); /*} } }*/ }
/** Renders a dropped item */ private void renderDroppedItem( ArrowEntity arrow, Icon par2Icon, int par3, float par4, float par5, float par6, float par7) { Tessellator tessellator = Tessellator.instance; if (par2Icon == null) { par2Icon = this.renderManager.renderEngine.getMissingIcon( arrow.getEntityItem().getItemSpriteNumber()); } float f4 = par2Icon.getMinU(); float f5 = par2Icon.getMaxU(); float f6 = par2Icon.getMinV(); float f7 = par2Icon.getMaxV(); float f8 = 1.0F; float f9 = 0.5F; float f10 = 0.25F; float f11; GL11.glPushMatrix(); /*float rotation = dagger.prevRotationPitch + (dagger.rotationPitch - dagger.prevRotationPitch) * par7; GL11.glRotatef(dagger.rotationYaw + 90, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-rotation * 15, 0.0F, 0.0F, 1.0F);*/ GL11.glRotatef( arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * par4 - 90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef( arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * par4 - 45.0F, 0.0F, 0.0F, 1.0F); float f12 = 0.0625F; f11 = 0.021875F; ItemStack itemstack = arrow.getEntityItem(); int j = itemstack.stackSize; byte b0 = getMiniItemCount(itemstack); GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F)); for (int k = 0; k < b0; ++k) { GL11.glTranslatef(0f, 0f, f12 + f11); if (itemstack.getItemSpriteNumber() == 0) { this.loadTexture("/terrain.png"); } else { this.loadTexture("/gui/items.png"); } GL11.glColor4f(par5, par6, par7, 1.0F); ItemRenderer.renderItemIn2D( tessellator, f5, f6, f4, f7, par2Icon.getSheetWidth(), par2Icon.getSheetHeight(), f12); if (itemstack != null && itemstack.hasEffect()) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); this.renderManager.renderEngine.bindTexture("%blur%/misc/glint.png"); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f13 = 0.76F; GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f14 = 0.125F; GL11.glScalef(f14, f14, f14); float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F; GL11.glTranslatef(f15, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f14, f14, f14); f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F; GL11.glTranslatef(-f15, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } } GL11.glPopMatrix(); }
/** Renders the item stack for being in an entity's hand Args: itemStack */ public void renderItem(EntityLiving par1EntityLiving, ItemStack par2ItemStack, int par3) { GL11.glPushMatrix(); Block block = null; if (par2ItemStack.getItem() instanceof ItemBlock && par2ItemStack.itemID < Block.blocksList.length) { block = Block.blocksList[par2ItemStack.itemID]; } IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(par2ItemStack, EQUIPPED); if (customRenderer != null) { this.mc.renderEngine.bindTexture( par2ItemStack.getItemSpriteNumber() == 0 ? "/terrain.png" : "/gui/items.png"); ForgeHooksClient.renderEquippedItem( customRenderer, renderBlocksInstance, par1EntityLiving, par2ItemStack); } else if (block != null && par2ItemStack.getItemSpriteNumber() == 0 && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType())) { this.mc.renderEngine.bindTexture("/terrain.png"); this.renderBlocksInstance.renderBlockAsItem( Block.blocksList[par2ItemStack.itemID], par2ItemStack.getItemDamage(), 1.0F); } else { Icon icon = par1EntityLiving.getItemIcon(par2ItemStack, par3); if (icon == null) { GL11.glPopMatrix(); return; } if (par2ItemStack.getItemSpriteNumber() == 0) { this.mc.renderEngine.bindTexture("/terrain.png"); } else { this.mc.renderEngine.bindTexture("/gui/items.png"); } Tessellator tessellator = Tessellator.instance; float f = icon.getMinU(); float f1 = icon.getMaxU(); float f2 = icon.getMinV(); float f3 = icon.getMaxV(); float f4 = 0.0F; float f5 = 0.3F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glTranslatef(-f4, -f5, 0.0F); float f6 = 1.5F; GL11.glScalef(f6, f6, f6); GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F); renderItemIn2D( tessellator, f1, f2, f, f3, icon.getSheetWidth(), icon.getSheetHeight(), 0.0625F); if (par2ItemStack != null && par2ItemStack.hasEffect() && par3 == 0) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); this.mc.renderEngine.bindTexture("%blur%/misc/glint.png"); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f7 = 0.76F; GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f8 = 0.125F; GL11.glScalef(f8, f8, f8); float f9 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F; GL11.glTranslatef(f9, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f8, f8, f8); f9 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F; GL11.glTranslatef(-f9, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); } GL11.glPopMatrix(); }
@Override public boolean renderWorldBlock( IBlockAccess world, int par2, int par3, int par4, Block par1Block, int modelId, RenderBlocks renderer) { if (modelId == model) { int l = renderer.blockAccess.getBlockMetadata(par2, par3, par4); int i1 = l & 7; boolean flag = (l & 8) > 0; Tessellator tessellator = Tessellator.instance; boolean flag1 = renderer.hasOverrideBlockTexture(); if (!flag1) { renderer.setOverrideBlockTexture(renderer.getBlockIcon(Block.netherrack)); } float f = 0.25F; float f1 = 0.1875F; float f2 = 0.1875F; if (i1 == 5) { renderer.setRenderBounds( (double) (0.5F - f1), 0.0D, (double) (0.5F - f), (double) (0.5F + f1), (double) f2, (double) (0.5F + f)); } else if (i1 == 6) { renderer.setRenderBounds( (double) (0.5F - f), 0.0D, (double) (0.5F - f1), (double) (0.5F + f), (double) f2, (double) (0.5F + f1)); } else if (i1 == 4) { renderer.setRenderBounds( (double) (0.5F - f1), (double) (0.5F - f), (double) (1.0F - f2), (double) (0.5F + f1), (double) (0.5F + f), 1.0D); } else if (i1 == 3) { renderer.setRenderBounds( (double) (0.5F - f1), (double) (0.5F - f), 0.0D, (double) (0.5F + f1), (double) (0.5F + f), (double) f2); } else if (i1 == 2) { renderer.setRenderBounds( (double) (1.0F - f2), (double) (0.5F - f), (double) (0.5F - f1), 1.0D, (double) (0.5F + f), (double) (0.5F + f1)); } else if (i1 == 1) { renderer.setRenderBounds( 0.0D, (double) (0.5F - f), (double) (0.5F - f1), (double) f2, (double) (0.5F + f), (double) (0.5F + f1)); } else if (i1 == 0) { renderer.setRenderBounds( (double) (0.5F - f), (double) (1.0F - f2), (double) (0.5F - f1), (double) (0.5F + f), 1.0D, (double) (0.5F + f1)); } else if (i1 == 7) { renderer.setRenderBounds( (double) (0.5F - f1), (double) (1.0F - f2), (double) (0.5F - f), (double) (0.5F + f1), 1.0D, (double) (0.5F + f)); } renderer.renderStandardBlock(par1Block, par2, par3, par4); if (!flag1) { renderer.clearOverrideBlockTexture(); } tessellator.setBrightness( par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3, par4)); float f3 = 1.0F; if (Block.lightValue[par1Block.blockID] > 0) { f3 = 1.0F; } tessellator.setColorOpaque_F(f3, f3, f3); Icon icon = renderer.getBlockIconFromSide(par1Block, 0); if (renderer.hasOverrideBlockTexture()) { icon = renderer.overrideBlockTexture; } double d0 = (double) icon.getMinU(); double d1 = (double) icon.getMinV(); double d2 = (double) icon.getMaxU(); double d3 = (double) icon.getMaxV(); Vec3[] avec3 = new Vec3[8]; float f4 = 0.0625F; float f5 = 0.0625F; float f6 = 0.625F; avec3[0] = renderer .blockAccess .getWorldVec3Pool() .getVecFromPool((double) (-f4), 0.0D, (double) (-f5)); avec3[1] = renderer.blockAccess.getWorldVec3Pool().getVecFromPool((double) f4, 0.0D, (double) (-f5)); avec3[2] = renderer.blockAccess.getWorldVec3Pool().getVecFromPool((double) f4, 0.0D, (double) f5); avec3[3] = renderer.blockAccess.getWorldVec3Pool().getVecFromPool((double) (-f4), 0.0D, (double) f5); avec3[4] = renderer .blockAccess .getWorldVec3Pool() .getVecFromPool((double) (-f4), (double) f6, (double) (-f5)); avec3[5] = renderer .blockAccess .getWorldVec3Pool() .getVecFromPool((double) f4, (double) f6, (double) (-f5)); avec3[6] = renderer .blockAccess .getWorldVec3Pool() .getVecFromPool((double) f4, (double) f6, (double) f5); avec3[7] = renderer .blockAccess .getWorldVec3Pool() .getVecFromPool((double) (-f4), (double) f6, (double) f5); for (int j1 = 0; j1 < 8; ++j1) { if (flag) { avec3[j1].zCoord -= 0.0625D; avec3[j1].rotateAroundX(((float) Math.PI * 2F / 9F)); } else { avec3[j1].zCoord += 0.0625D; avec3[j1].rotateAroundX(-((float) Math.PI * 2F / 9F)); } if (i1 == 0 || i1 == 7) { avec3[j1].rotateAroundZ((float) Math.PI); } if (i1 == 6 || i1 == 0) { avec3[j1].rotateAroundY(((float) Math.PI / 2F)); } if (i1 > 0 && i1 < 5) { avec3[j1].yCoord -= 0.375D; avec3[j1].rotateAroundX(((float) Math.PI / 2F)); if (i1 == 4) { avec3[j1].rotateAroundY(0.0F); } if (i1 == 3) { avec3[j1].rotateAroundY((float) Math.PI); } if (i1 == 2) { avec3[j1].rotateAroundY(((float) Math.PI / 2F)); } if (i1 == 1) { avec3[j1].rotateAroundY(-((float) Math.PI / 2F)); } avec3[j1].xCoord += (double) par2 + 0.5D; avec3[j1].yCoord += (double) ((float) par3 + 0.5F); avec3[j1].zCoord += (double) par4 + 0.5D; } else if (i1 != 0 && i1 != 7) { avec3[j1].xCoord += (double) par2 + 0.5D; avec3[j1].yCoord += (double) ((float) par3 + 0.125F); avec3[j1].zCoord += (double) par4 + 0.5D; } else { avec3[j1].xCoord += (double) par2 + 0.5D; avec3[j1].yCoord += (double) ((float) par3 + 0.875F); avec3[j1].zCoord += (double) par4 + 0.5D; } } Vec3 vec3 = null; Vec3 vec31 = null; Vec3 vec32 = null; Vec3 vec33 = null; for (int k1 = 0; k1 < 6; ++k1) { if (k1 == 0) { d0 = (double) icon.getInterpolatedU(7.0D); d1 = (double) icon.getInterpolatedV(6.0D); d2 = (double) icon.getInterpolatedU(9.0D); d3 = (double) icon.getInterpolatedV(8.0D); } else if (k1 == 2) { d0 = (double) icon.getInterpolatedU(7.0D); d1 = (double) icon.getInterpolatedV(6.0D); d2 = (double) icon.getInterpolatedU(9.0D); d3 = (double) icon.getMaxV(); } if (k1 == 0) { vec3 = avec3[0]; vec31 = avec3[1]; vec32 = avec3[2]; vec33 = avec3[3]; } else if (k1 == 1) { vec3 = avec3[7]; vec31 = avec3[6]; vec32 = avec3[5]; vec33 = avec3[4]; } else if (k1 == 2) { vec3 = avec3[1]; vec31 = avec3[0]; vec32 = avec3[4]; vec33 = avec3[5]; } else if (k1 == 3) { vec3 = avec3[2]; vec31 = avec3[1]; vec32 = avec3[5]; vec33 = avec3[6]; } else if (k1 == 4) { vec3 = avec3[3]; vec31 = avec3[2]; vec32 = avec3[6]; vec33 = avec3[7]; } else if (k1 == 5) { vec3 = avec3[0]; vec31 = avec3[3]; vec32 = avec3[7]; vec33 = avec3[4]; } tessellator.addVertexWithUV(vec3.xCoord, vec3.yCoord, vec3.zCoord, d0, d3); tessellator.addVertexWithUV(vec31.xCoord, vec31.yCoord, vec31.zCoord, d2, d3); tessellator.addVertexWithUV(vec32.xCoord, vec32.yCoord, vec32.zCoord, d2, d1); tessellator.addVertexWithUV(vec33.xCoord, vec33.yCoord, vec33.zCoord, d0, d1); } } return true; }