コード例 #1
0
 /*
  * This method has been stolen from BuildCraft
  */
 private void drawCutIcon(IIcon icon, int x, int y, int width, int height, int cut) {
   Tessellator tess = Tessellator.instance;
   tess.startDrawingQuads();
   tess.addVertexWithUV(x, y + height, zLevel, icon.getMinU(), icon.getInterpolatedV(height));
   tess.addVertexWithUV(
       x + width, y + height, zLevel, icon.getInterpolatedU(width), icon.getInterpolatedV(height));
   tess.addVertexWithUV(
       x + width, y + cut, zLevel, icon.getInterpolatedU(width), icon.getInterpolatedV(cut));
   tess.addVertexWithUV(x, y + cut, zLevel, icon.getMinU(), icon.getInterpolatedV(cut));
   tess.draw();
 }
コード例 #2
0
  void rebindUVsToIcon(WavefrontObject model, IIcon icon) {
    float minU = icon.getInterpolatedU(0);
    float sizeU = icon.getInterpolatedU(16) - minU;
    float minV = icon.getInterpolatedV(0);
    float sizeV = icon.getInterpolatedV(16) - minV;

    for (GroupObject groupObject : model.groupObjects)
      for (Face face : groupObject.faces)
        for (int i = 0; i < face.vertices.length; ++i) {
          TextureCoordinate textureCoordinate = face.textureCoordinates[i];
          face.textureCoordinates[i] =
              new TextureCoordinate(
                  minU + sizeU * textureCoordinate.u, minV + sizeV * textureCoordinate.v);
        }
  }
コード例 #3
0
  public void renderLiquids(TileEntity tile) {
    if (tile != null && tile instanceof TileInjector) {
      TileInjector t = (TileInjector) tile;
      List<FluidTank> l = t.getFluidTanks();

      GL11.glPushMatrix();

      if (l.get(0) != null && l.get(0).getFluid() != null && l.get(0).getFluidAmount() > 0) {
        IIcon ic = l.get(0).getFluid().getFluid().getStillIcon();
        int amount = l.get(0).getFluidAmount() > 0 ? l.get(0).getFluidAmount() : 1;
        float ratio = (float) amount / (float) l.get(0).getCapacity();
        Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
        Tessellator tessellator = Tessellator.instance;
        double ts = 16.0D;
        double minU = (double) ic.getInterpolatedU(0 * ts);
        double maxU = (double) ic.getInterpolatedU(1 * ts);
        double minV = (double) ic.getInterpolatedV(0 * ts);
        double maxV = (double) ic.getInterpolatedV(1 * ts);
        double d7 = maxU;
        double d8 = minU;
        double d9 = minV;
        double d10 = maxV;
        double rt = 0.001953125D;
        tessellator.startDrawingQuads();
        tessellator.setNormal(0.0F, 1.0F, 0.0F);
        tessellator.addVertexWithUV(
            0.48, -0.133 + 0.3 * ratio, 0.18, maxU - ts * 0.64 * rt, maxV - ts * 0.64 * rt);
        tessellator.addVertexWithUV(0.48, -0.133 + 0.3 * ratio, -0.18, d7 - ts * 0.64 * rt, d9);
        tessellator.addVertexWithUV(0.12, -0.133 + 0.3 * ratio, -0.18, minU, minV);
        tessellator.addVertexWithUV(0.12, -0.133 + 0.3 * ratio, 0.18, d8, d10 - ts * 0.64 * rt);
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(
            0.48, -0.133, -0.18, maxU - ts * 0.64 * rt, maxV - ts * (1 - 0.3 * ratio) * rt);
        tessellator.addVertexWithUV(0.48, -0.133 + 0.3 * ratio, -0.18, d7 - ts * 0.64 * rt, d9);
        tessellator.addVertexWithUV(0.48, -0.133 + 0.3 * ratio, 0.18, minU, minV);
        tessellator.addVertexWithUV(0.48, -0.133, 0.18, d8, d10 - ts * (1 - 0.3 * ratio) * rt);
        tessellator.draw();

        GL11.glRotatef(180, 0F, 1F, 0F);
        tessellator.startDrawingQuads();
        tessellator.setNormal(0.0F, 1.0F, 0.0F);
        tessellator.addVertexWithUV(
            0.435, -0.41 + 0.4 * ratio, 0.40, maxU - ts * 0.465 * rt, maxV - ts * 0.20 * rt);
        tessellator.addVertexWithUV(0.435, -0.41 + 0.4 * ratio, -0.40, d7 - ts * 0.465 * rt, d9);
        tessellator.addVertexWithUV(-0.1, -0.41 + 0.4 * ratio, -0.40, minU, minV);
        tessellator.addVertexWithUV(-0.1, -0.41 + 0.4 * ratio, 0.40, d8, d10 - ts * 0.20 * rt);
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(
            0.435, -0.41, -0.40, maxU - ts * 0.20 * rt, maxV - ts * (1 - 0.4 * ratio) * rt);
        tessellator.addVertexWithUV(0.435, -0.41 + 0.4 * ratio, -0.40, d7 - ts * 0.20 * rt, d9);
        tessellator.addVertexWithUV(0.435, -0.41 + 0.4 * ratio, 0.40, minU, minV);
        tessellator.addVertexWithUV(0.435, -0.41, 0.40, d8, d10 - ts * (1 - 0.4 * ratio) * rt);
        tessellator.draw();
      }
      GL11.glPopMatrix();
    }
  }
コード例 #4
0
 /**
  * Adds a vertex to the tessellator scaled to the unit size of a block. Same as {@link
  * #addScaledVertexWithUV(Tessellator, float, float, float, float, float)}, but does not require
  * the correct texture to be bound.
  *
  * @param tessellator
  * @param x the x position, from 0 to {@value Constants.WHOLE}.
  * @param y the y position, from 0 to {@value Constants.WHOLE}.
  * @param z the z position, from 0 to {@value Constants.WHOLE}.
  * @param u ???
  * @param v ???
  * @param icon the texture of the point.
  */
 public static void addScaledVertexWithUV(
     Tessellator tessellator, float x, float y, float z, float u, float v, IIcon icon) {
   tessellator.addVertexWithUV(
       x * Constants.UNIT,
       y * Constants.UNIT,
       z * Constants.UNIT,
       icon.getInterpolatedU(u),
       icon.getInterpolatedV(v));
 }
コード例 #5
0
	@Override
	public void doRender(Entity entity, double x, double y, double z, float _, float partialTickTime) {
		bindEntityTexture(entity);
		GL11.glPushMatrix();
		float yaw = RenderUtils.interpolateYaw(entity, partialTickTime);
		float pitch = RenderUtils.interpolatePitch(entity, partialTickTime);

		GL11.glTranslated(x, y, z);
		GL11.glRotatef(yaw, 0, 1, 0);
		GL11.glRotatef(pitch, 1, 0, 0);
		final IIcon icon = Items.goldenEye.getIconFromDamage(0);

		GL11.glScaled(1.0 / 6.0, 1.0 / 6.0, 1.0 / 6.0);
		Tessellator tes = new Tessellator();
		tes.setTranslation(-0.5, -0.5, 0);
		ItemRenderer.renderItemIn2D(
				tes,
				icon.getInterpolatedU(15), icon.getInterpolatedV(2),
				icon.getInterpolatedU(2), icon.getInterpolatedV(15),
				13, 13,
				1.0f / 16.0f
				);
		GL11.glPopMatrix();
	}
コード例 #6
0
    void set(double x, double y, double z, IIcon icon, IIcon icon1, IIcon icon2) {
      tessellator = Tessellator.instance;

      i0u0 = icon.getMinU();
      i0uh = icon.getInterpolatedU(8.0D);
      i0u1 = icon.getMaxU();
      i0v0 = icon.getMinV();
      i0v1 = icon.getMaxV();

      i1u0 = icon1.getInterpolatedU(7.0D);
      i1u1 = icon1.getInterpolatedU(9.0D);
      i1v0 = icon1.getMinV();
      i1vh = icon1.getInterpolatedV(8.0D);
      i1v1 = icon1.getMaxV();
      i1v = i1v1 - i1v0;

      i2u0 = icon2.getInterpolatedU(7.0D);
      i2u1 = icon2.getInterpolatedU(9.0D);
      i2v0 = icon2.getMinV();
      i2v1 = icon2.getMaxV();
      i2v = i2v1 - i2v0;

      x0 = x;
      xh = x0 + 0.5D;
      x1 = x + 1;
      xp0 = x0 + 0.5D - 0.0625D;
      xp1 = x0 + 0.5D + 0.0625D;

      z0 = z;
      zh = z0 + 0.5D;
      z1 = z + 1;
      zp0 = z0 + 0.5D - 0.0625D;
      zp1 = z0 + 0.5D + 0.0625D;

      y0 = y;
      y1 = y + 1;
    }
コード例 #7
0
  public void renderTexturedCuboid(AxisAlignedBB aabb, IIcon icon) {

    Tessellator t = Tessellator.instance;

    if (aabb.minZ != 0 && (!connections[3] || aabb.minZ != 0.75)) {
      if (aabb.maxY == 1 || aabb.minY == 0) {
        double minX = icon.getInterpolatedU(aabb.minX * 16);
        double maxX = icon.getInterpolatedU(aabb.maxX * 16);
        double minY = icon.getInterpolatedV(aabb.minY * 16);
        double maxY = icon.getInterpolatedV(aabb.maxY * 16);
        t.setNormal(0, 0, -1);

        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, maxX, maxY); // minZ
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, minX, maxY);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, minX, minY);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, maxX, minY);

        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, maxX, maxY); // minZ
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, maxX, minY);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, minX, minY);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, minX, maxY);

      } else {
        double minX = icon.getInterpolatedU(aabb.minY * 16);
        double maxX = icon.getInterpolatedU(aabb.maxY * 16);
        double minY = icon.getInterpolatedV(aabb.minX * 16);
        double maxY = icon.getInterpolatedV(aabb.maxX * 16);
        t.setNormal(0, 0, -1);

        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, maxX, maxY); // minZ
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, minX, maxY);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, minX, minY);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, maxX, minY);

        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, maxX, maxY); // minZ
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, maxX, minY);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, minX, minY);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, minX, maxY);
      }
    }

    if (aabb.maxZ != 1 && (!connections[2] || aabb.maxZ != 0.25)) {
      if (aabb.minY == 0 || aabb.maxY == 1) {
        double minX = icon.getInterpolatedU(aabb.minX * 16);
        double maxX = icon.getInterpolatedU(aabb.maxX * 16);
        double minY = icon.getInterpolatedV(aabb.minY * 16);
        double maxY = icon.getInterpolatedV(aabb.maxY * 16);
        t.setNormal(0, 0, 1);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, minX, minY);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, minX, maxY); // maxZ
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxZ, maxX, maxY);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, maxX, minY);

        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, minX, minY);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, maxX, minY);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxZ, maxX, maxY);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, minX, maxY); // maxZ

      } else {
        double minX = icon.getInterpolatedU(aabb.minY * 16);
        double maxX = icon.getInterpolatedU(aabb.maxY * 16);
        double minY = icon.getInterpolatedV(aabb.minX * 16);
        double maxY = icon.getInterpolatedV(aabb.maxX * 16);
        t.setNormal(0, 0, 1);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxZ, minX, minY);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, minX, maxY); // maxZ
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, maxX, maxY);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, maxX, minY);

        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxZ, minX, minY);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, maxX, minY);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, maxX, maxY);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, minX, maxY); // maxZ
      }
    }

    if (aabb.minY != 0 && (!connections[1] || aabb.minY != 0.75)) {
      if (aabb.minX == 0 || aabb.maxX == 1) {
        double minX = icon.getInterpolatedU(aabb.minZ * 16);
        double maxX = icon.getInterpolatedU(aabb.maxZ * 16);
        double minZ = icon.getInterpolatedV(aabb.minX * 16);
        double maxZ = icon.getInterpolatedV(aabb.maxX * 16);
        t.setNormal(0, -1, 0);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, minX, maxZ); // bottom
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, maxX, maxZ);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, maxX, minZ);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, minX, minZ);

        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, minX, maxZ); // bottom
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, minX, minZ);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, maxX, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, maxX, maxZ);
      } else {
        double minX = icon.getInterpolatedU(aabb.minX * 16);
        double maxX = icon.getInterpolatedU(aabb.maxX * 16);
        double minZ = icon.getInterpolatedV(aabb.minZ * 16);
        double maxZ = icon.getInterpolatedV(aabb.maxZ * 16);
        t.setNormal(0, -1, 0);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, minX, maxZ); // bottom
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, maxX, maxZ);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, maxX, minZ);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, minX, minZ);

        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, minX, maxZ); // bottom
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, minX, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, maxX, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, maxX, maxZ);
      }
    }

    if (aabb.maxY != 1 && (!connections[0] || aabb.maxY != 0.25)) {
      if (aabb.minX == 0 || aabb.maxX == 1) {
        double minX = icon.getInterpolatedU(aabb.minZ * 16);
        double maxX = icon.getInterpolatedU(aabb.maxZ * 16);
        double minZ = icon.getInterpolatedV(aabb.minX * 16);
        double maxZ = icon.getInterpolatedV(aabb.maxX * 16);
        t.setNormal(0, 1, 0);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, minX, minZ); // top
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, maxX, minZ);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxZ, maxX, maxZ);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, minX, maxZ);

        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, minX, minZ); // top
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, minX, maxZ);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxZ, maxX, maxZ);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, maxX, minZ);
      } else {
        double minX = icon.getInterpolatedU(aabb.minX * 16);
        double maxX = icon.getInterpolatedU(aabb.maxX * 16);
        double minZ = icon.getInterpolatedV(aabb.minZ * 16);
        double maxZ = icon.getInterpolatedV(aabb.maxZ * 16);
        t.setNormal(0, 1, 0);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxZ, minX, minZ); // top
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, maxX, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, maxX, maxZ);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, minX, maxZ);

        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxZ, minX, minZ); // top
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, minX, maxZ);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, maxX, maxZ);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, maxX, minZ);
      }
    }

    if (aabb.minX != 0 && (!connections[5] || aabb.minX != 0.75)) {
      if (aabb.minY == 0 || aabb.maxY == 1) {
        double minY = icon.getInterpolatedU(aabb.minZ * 16);
        double maxY = icon.getInterpolatedU(aabb.maxZ * 16);
        double minZ = icon.getInterpolatedV(aabb.minY * 16);
        double maxZ = icon.getInterpolatedV(aabb.maxY * 16);

        t.setNormal(-1, 0, 0);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, minY, minZ); // minX
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, minY, maxZ);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, maxY, maxZ);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxZ, maxY, minZ);

        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, minY, minZ); // minX
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxZ, maxY, minZ);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, maxY, maxZ);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, minY, maxZ);
      } else {
        double minY = icon.getInterpolatedU(aabb.minY * 16);
        double maxY = icon.getInterpolatedU(aabb.maxY * 16);
        double minZ = icon.getInterpolatedV(aabb.minZ * 16);
        double maxZ = icon.getInterpolatedV(aabb.maxZ * 16);

        t.setNormal(-1, 0, 0);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, minY, minZ); // minX
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxZ, minY, maxZ);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, maxY, maxZ);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, maxY, minZ);

        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, minY, minZ); // minX
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, maxY, minZ);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, maxY, maxZ);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxZ, minY, maxZ);
      }
    }

    if (aabb.maxX != 1 && (!connections[4] || aabb.maxX != 0.25)) {
      if (aabb.minY == 0 || aabb.maxY == 1) {

        double minY = icon.getInterpolatedU(aabb.minZ * 16);
        double maxY = icon.getInterpolatedU(aabb.maxZ * 16);
        double minZ = icon.getInterpolatedV(aabb.minY * 16);
        double maxZ = icon.getInterpolatedV(aabb.maxY * 16);
        t.setNormal(1, 0, 0);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, minY, maxZ); // maxX
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, maxY, maxZ);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, maxY, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, minY, minZ);

        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, minY, maxZ); // maxX
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, minY, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, maxY, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, maxY, maxZ);
      } else {
        double minY = icon.getInterpolatedU(aabb.minY * 16);
        double maxY = icon.getInterpolatedU(aabb.maxY * 16);
        double minZ = icon.getInterpolatedV(aabb.minZ * 16);
        double maxZ = icon.getInterpolatedV(aabb.maxZ * 16);
        t.setNormal(1, 0, 0);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, minY, maxZ); // maxX
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, maxY, maxZ);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, maxY, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, minY, minZ);

        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, minY, maxZ); // maxX
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, minY, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, maxY, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, maxY, maxZ);
      }
    }
  }
コード例 #8
0
  private void renderMiddle(AxisAlignedBB aabb, IIcon icon) {

    Tessellator t = Tessellator.instance;

    if (!connections[2]) {
      double minX = icon.getInterpolatedU(aabb.minX * 16);
      double maxX = icon.getInterpolatedU(aabb.maxX * 16);
      double minY = icon.getInterpolatedV(aabb.minY * 16);
      double maxY = icon.getInterpolatedV(aabb.maxY * 16);

      t.setNormal(0, 0, -1);
      if (connections[4]) { // or 5
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, minX, maxY); // minZ
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, minX, minY);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, maxX, minY);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, maxX, maxY);

        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, minX, maxY); // minZ
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, maxX, maxY);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, maxX, minY);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, minX, minY);
      } else {
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, minX, maxY); // minZ
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, maxX, maxY);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, maxX, minY);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, minX, minY);

        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, minX, maxY); // minZ
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, minX, minY);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, maxX, minY);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, maxX, maxY);
      }
    }

    if (!connections[3]) {
      double minX = icon.getInterpolatedU(aabb.minX * 16);
      double maxX = icon.getInterpolatedU(aabb.maxX * 16);
      double minY = icon.getInterpolatedV(aabb.minY * 16);
      double maxY = icon.getInterpolatedV(aabb.maxY * 16);
      t.setNormal(0, 0, 1);
      if (connections[4]) { // or 5
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxZ, maxX, maxY);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, minX, maxY); // maxZ
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, minX, minY);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, maxX, minY);

        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxZ, maxX, maxY);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, maxX, minY);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, minX, minY);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, minX, maxY); // maxZ
      } else {
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxZ, minX, minY);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, minX, maxY); // maxZ
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, maxX, maxY);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, maxX, minY);

        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxZ, minX, minY);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, maxX, minY);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, maxX, maxY);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, minX, maxY); // maxZ
      }
    }

    if (!connections[0]) {
      double minX = icon.getInterpolatedU(aabb.minX * 16);
      double maxX = icon.getInterpolatedU(aabb.maxX * 16);
      double minZ = icon.getInterpolatedV(aabb.minZ * 16);
      double maxZ = icon.getInterpolatedV(aabb.maxZ * 16);
      t.setNormal(0, -1, 0);
      if (connections[4]) { // or 5
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, maxX, maxZ); // bottom
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, minX, maxZ);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, minX, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, maxX, minZ);

        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, maxX, maxZ); // bottom
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, maxX, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, minX, minZ);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, minX, maxZ);
      } else {
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, maxX, maxZ); // bottom
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, minX, maxZ);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, minX, minZ);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, maxX, minZ);

        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, maxX, maxZ); // bottom
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, maxX, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, minX, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, minX, maxZ);
      }
    }

    if (!connections[1]) {
      double minX = icon.getInterpolatedU(aabb.minX * 16);
      double maxX = icon.getInterpolatedU(aabb.maxX * 16);
      double minZ = icon.getInterpolatedV(aabb.minZ * 16);
      double maxZ = icon.getInterpolatedV(aabb.maxZ * 16);
      t.setNormal(0, 1, 0);
      if (connections[4]) { // or 5
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, maxX, maxZ); // top
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, maxX, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, minX, minZ);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxZ, minX, maxZ);

        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, maxX, maxZ); // top
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxZ, minX, maxZ);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, minX, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, maxX, minZ);
      } else {
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, maxX, minZ); // top
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, minX, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, minX, maxZ);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxZ, maxX, maxZ);

        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, maxX, minZ); // top
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxZ, maxX, maxZ);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, minX, maxZ);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, minX, minZ);
      }
    }

    if (!connections[4]) {
      double minY = icon.getInterpolatedU(aabb.minY * 16);
      double maxY = icon.getInterpolatedU(aabb.maxY * 16);
      double minZ = icon.getInterpolatedV(aabb.minZ * 16);
      double maxZ = icon.getInterpolatedV(aabb.maxZ * 16);
      t.setNormal(-1, 0, 0);
      if (connections[0]) {
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, maxY, maxZ); // minX
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, minY, maxZ);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxX, minY, minZ);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, maxY, minZ);

        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, maxY, maxZ); // minX
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, maxY, minZ);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxX, minY, minZ);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, minY, maxZ);
      } else {
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, minY, minZ); // minX
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, maxY, minZ);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxX, maxY, maxZ);
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, minY, maxZ);

        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.minZ, minY, minZ); // minX
        t.addVertexWithUV(aabb.minX, aabb.minY, aabb.maxZ, minY, maxZ);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.maxX, maxY, maxZ);
        t.addVertexWithUV(aabb.minX, aabb.maxY, aabb.minZ, maxY, minZ);
      }
    }

    if (!connections[5]) {
      double minY = icon.getInterpolatedU(aabb.minY * 16);
      double maxY = icon.getInterpolatedU(aabb.maxY * 16);
      double minZ = icon.getInterpolatedV(aabb.minZ * 16);
      double maxZ = icon.getInterpolatedV(aabb.maxZ * 16);
      t.setNormal(1, 0, 0);
      if (connections[0]) {
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, minY, maxZ); // maxX
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, minY, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, maxY, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, maxY, maxZ);

        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, minY, maxZ); // maxX
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, maxY, maxZ);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, maxY, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, minY, minZ);
      } else {
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, minY, maxZ); // maxX
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, maxY, maxZ);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, maxY, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, minY, minZ);

        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.minZ, minY, maxZ); // maxX
        t.addVertexWithUV(aabb.maxX, aabb.minY, aabb.maxZ, minY, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.maxZ, maxY, minZ);
        t.addVertexWithUV(aabb.maxX, aabb.maxY, aabb.minZ, maxY, maxZ);
      }
    }
  }
コード例 #9
0
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
    if (!(block instanceof BlockFluidBase)) {
      return false;
    }

    Tessellator tessellator = Tessellator.instance;
    int color = block.colorMultiplier(world, x, y, z);
    float red = (color >> 16 & 255) / 255.0F;
    float green = (color >> 8 & 255) / 255.0F;
    float blue = (color & 255) / 255.0F;

    BlockFluidBase theFluid = (BlockFluidBase) block;
    int bMeta = world.getBlockMetadata(x, y, z);

    boolean renderTop = world.getBlock(x, y - theFluid.densityDir, z) != theFluid;

    boolean renderBottom =
        block.shouldSideBeRendered(world, x, y + theFluid.densityDir, z, 0)
            && world.getBlock(x, y + theFluid.densityDir, z) != theFluid;

    boolean[] renderSides =
        new boolean[] {
          block.shouldSideBeRendered(world, x, y, z - 1, 2),
          block.shouldSideBeRendered(world, x, y, z + 1, 3),
          block.shouldSideBeRendered(world, x - 1, y, z, 4),
          block.shouldSideBeRendered(world, x + 1, y, z, 5)
        };

    if (!renderTop
        && !renderBottom
        && !renderSides[0]
        && !renderSides[1]
        && !renderSides[2]
        && !renderSides[3]) {
      return false;
    } else {
      boolean rendered = false;
      double heightNW, heightSW, heightSE, heightNE;
      float flow11 = getFluidHeightForRender(world, x, y, z, theFluid);

      if (flow11 != 1) {
        float flow00 = getFluidHeightForRender(world, x - 1, y, z - 1, theFluid);
        float flow01 = getFluidHeightForRender(world, x - 1, y, z, theFluid);
        float flow02 = getFluidHeightForRender(world, x - 1, y, z + 1, theFluid);
        float flow10 = getFluidHeightForRender(world, x, y, z - 1, theFluid);
        float flow12 = getFluidHeightForRender(world, x, y, z + 1, theFluid);
        float flow20 = getFluidHeightForRender(world, x + 1, y, z - 1, theFluid);
        float flow21 = getFluidHeightForRender(world, x + 1, y, z, theFluid);
        float flow22 = getFluidHeightForRender(world, x + 1, y, z + 1, theFluid);

        heightNW = getFluidHeightAverage(new float[] {flow00, flow01, flow10, flow11});
        heightSW = getFluidHeightAverage(new float[] {flow01, flow02, flow12, flow11});
        heightSE = getFluidHeightAverage(new float[] {flow12, flow21, flow22, flow11});
        heightNE = getFluidHeightAverage(new float[] {flow10, flow20, flow21, flow11});
      } else {
        heightNW = flow11;
        heightSW = flow11;
        heightSE = flow11;
        heightNE = flow11;
      }

      boolean rises = theFluid.densityDir == 1;
      if (renderer.renderAllFaces || renderTop) {
        rendered = true;
        IIcon iconStill = getIcon(block.getIcon(1, bMeta));
        float flowDir = (float) BlockFluidBase.getFlowDirection(world, x, y, z);

        if (flowDir > -999.0F) {
          iconStill = getIcon(block.getIcon(2, bMeta));
        }

        heightNW -= RENDER_OFFSET;
        heightSW -= RENDER_OFFSET;
        heightSE -= RENDER_OFFSET;
        heightNE -= RENDER_OFFSET;

        double u1, u2, u3, u4, v1, v2, v3, v4;

        if (flowDir < -999.0F) {
          u2 = iconStill.getInterpolatedU(0.0D);
          v2 = iconStill.getInterpolatedV(0.0D);
          u1 = u2;
          v1 = iconStill.getInterpolatedV(16.0D);
          u4 = iconStill.getInterpolatedU(16.0D);
          v4 = v1;
          u3 = u4;
          v3 = v2;
        } else {
          float xFlow = MathHelper.sin(flowDir) * 0.25F;
          float zFlow = MathHelper.cos(flowDir) * 0.25F;
          u2 = iconStill.getInterpolatedU(8.0F + (-zFlow - xFlow) * 16.0F);
          v2 = iconStill.getInterpolatedV(8.0F + (-zFlow + xFlow) * 16.0F);
          u1 = iconStill.getInterpolatedU(8.0F + (-zFlow + xFlow) * 16.0F);
          v1 = iconStill.getInterpolatedV(8.0F + (zFlow + xFlow) * 16.0F);
          u4 = iconStill.getInterpolatedU(8.0F + (zFlow + xFlow) * 16.0F);
          v4 = iconStill.getInterpolatedV(8.0F + (zFlow - xFlow) * 16.0F);
          u3 = iconStill.getInterpolatedU(8.0F + (zFlow - xFlow) * 16.0F);
          v3 = iconStill.getInterpolatedV(8.0F + (-zFlow - xFlow) * 16.0F);
        }

        tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
        tessellator.setColorOpaque_F(LIGHT_Y_POS * red, LIGHT_Y_POS * green, LIGHT_Y_POS * blue);

        if (!rises) {
          tessellator.addVertexWithUV(x + 0, y + heightNW, z + 0, u2, v2);
          tessellator.addVertexWithUV(x + 0, y + heightSW, z + 1, u1, v1);
          tessellator.addVertexWithUV(x + 1, y + heightSE, z + 1, u4, v4);
          tessellator.addVertexWithUV(x + 1, y + heightNE, z + 0, u3, v3);
        } else {
          tessellator.addVertexWithUV(x + 1, y + 1 - heightNE, z + 0, u3, v3);
          tessellator.addVertexWithUV(x + 1, y + 1 - heightSE, z + 1, u4, v4);
          tessellator.addVertexWithUV(x + 0, y + 1 - heightSW, z + 1, u1, v1);
          tessellator.addVertexWithUV(x + 0, y + 1 - heightNW, z + 0, u2, v2);
        }
      }

      if (renderer.renderAllFaces || renderBottom) {
        rendered = true;
        tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y - 1, z));
        if (!rises) {
          tessellator.setColorOpaque_F(LIGHT_Y_NEG * red, LIGHT_Y_NEG * green, LIGHT_Y_NEG * blue);
          renderer.renderFaceYNeg(block, x, y + RENDER_OFFSET, z, getIcon(block.getIcon(0, bMeta)));
        } else {
          tessellator.setColorOpaque_F(LIGHT_Y_POS * red, LIGHT_Y_POS * green, LIGHT_Y_POS * blue);
          renderer.renderFaceYPos(block, x, y + RENDER_OFFSET, z, getIcon(block.getIcon(1, bMeta)));
        }
      }

      for (int side = 0; side < 4; ++side) {
        int x2 = x;
        int z2 = z;

        switch (side) {
          case 0:
            --z2;
            break;
          case 1:
            ++z2;
            break;
          case 2:
            --x2;
            break;
          case 3:
            ++x2;
            break;
        }

        IIcon iconFlow = getIcon(block.getIcon(side + 2, bMeta));
        if (renderer.renderAllFaces || renderSides[side]) {
          rendered = true;

          double ty1;
          double tx1;
          double ty2;
          double tx2;
          double tz1;
          double tz2;

          if (side == 0) {
            ty1 = heightNW;
            ty2 = heightNE;
            tx1 = x;
            tx2 = x + 1;
            tz1 = z + RENDER_OFFSET;
            tz2 = z + RENDER_OFFSET;
          } else if (side == 1) {
            ty1 = heightSE;
            ty2 = heightSW;
            tx1 = x + 1;
            tx2 = x;
            tz1 = z + 1 - RENDER_OFFSET;
            tz2 = z + 1 - RENDER_OFFSET;
          } else if (side == 2) {
            ty1 = heightSW;
            ty2 = heightNW;
            tx1 = x + RENDER_OFFSET;
            tx2 = x + RENDER_OFFSET;
            tz1 = z + 1;
            tz2 = z;
          } else {
            ty1 = heightNE;
            ty2 = heightSE;
            tx1 = x + 1 - RENDER_OFFSET;
            tx2 = x + 1 - RENDER_OFFSET;
            tz1 = z;
            tz2 = z + 1;
          }

          float u1Flow = iconFlow.getInterpolatedU(0.0D);
          float u2Flow = iconFlow.getInterpolatedU(8.0D);
          float v1Flow = iconFlow.getInterpolatedV((1.0D - ty1) * 16.0D * 0.5D);
          float v2Flow = iconFlow.getInterpolatedV((1.0D - ty2) * 16.0D * 0.5D);
          float v3Flow = iconFlow.getInterpolatedV(8.0D);
          tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x2, y, z2));
          float sideLighting = 1.0F;

          if (side < 2) {
            sideLighting = LIGHT_XZ_NEG;
          } else {
            sideLighting = LIGHT_XZ_POS;
          }

          tessellator.setColorOpaque_F(
              LIGHT_Y_POS * sideLighting * red,
              LIGHT_Y_POS * sideLighting * green,
              LIGHT_Y_POS * sideLighting * blue);

          if (!rises) {
            tessellator.addVertexWithUV(tx1, y + ty1, tz1, u1Flow, v1Flow);
            tessellator.addVertexWithUV(tx2, y + ty2, tz2, u2Flow, v2Flow);
            tessellator.addVertexWithUV(tx2, y + 0, tz2, u2Flow, v3Flow);
            tessellator.addVertexWithUV(tx1, y + 0, tz1, u1Flow, v3Flow);
          } else {
            tessellator.addVertexWithUV(tx1, y + 1 - 0, tz1, u1Flow, v3Flow);
            tessellator.addVertexWithUV(tx2, y + 1 - 0, tz2, u2Flow, v3Flow);
            tessellator.addVertexWithUV(tx2, y + 1 - ty2, tz2, u2Flow, v2Flow);
            tessellator.addVertexWithUV(tx1, y + 1 - ty1, tz1, u1Flow, v1Flow);
          }
        }
      }
      renderer.renderMinY = 0;
      renderer.renderMaxY = 1;
      return rendered;
    }
  }
コード例 #10
0
  @Override
  public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
    GL11.glPushMatrix();
    try {

      if (metadata == BlockMetalDecoration.META_fence) {
        GL11.glTranslatef(-.5f, -.5f, -.5f);
        renderer.setRenderBounds(0, 0, .375, .25, 1, .625);
        ClientUtils.drawInventoryBlock(block, metadata, renderer);
        renderer.setRenderBounds(.75, 0, .375, 1, 1, .625);
        ClientUtils.drawInventoryBlock(block, metadata, renderer);
        renderer.setRenderBounds(-.125, .8125, .4375, 1.125, .9375, .5625);
        ClientUtils.drawInventoryBlock(block, metadata, renderer);
        renderer.setRenderBounds(-.125, .3125, .4375, 1.125, .4375, .5625);
        ClientUtils.drawInventoryBlock(block, metadata, renderer);
        GL11.glTranslatef(.5f, .5f, .5f);
      } else if (metadata == BlockMetalDecoration.META_scaffolding) {
        block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
        renderer.setRenderBoundsFromBlock(block);
        ClientUtils.drawInventoryBlock(block, metadata, renderer);
      } else if (metadata == BlockMetalDecoration.META_lantern) {
        Tessellator.instance.startDrawingQuads();
        ClientUtils.handleStaticTileRenderer(new TileEntityLantern());
        Tessellator.instance.draw();
      } else if (metadata == BlockMetalDecoration.META_structuralArm) {
        Tessellator tes = ClientUtils.tes();
        IIcon iSide = block.getIcon(2, 3);
        IIcon iTop = block.getIcon(0, 3);

        GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

        tes.startDrawing(6);
        tes.setNormal(0.0F, -1.0F, 0.0F);
        renderer.renderFaceYNeg(block, 0, 0, 0, iTop);
        tes.draw();

        tes.startDrawing(6);
        tes.setNormal(0.0F, 1.0F, 0.0F);
        tes.setBrightness(0xff);
        tes.addVertexWithUV(1, 1, 1, iTop.getMaxU(), iTop.getMaxV());
        tes.addVertexWithUV(1, 1, 0, iTop.getMaxU(), iTop.getMinV());
        tes.addVertexWithUV(0, 0, 0, iTop.getMinU(), iTop.getMinV());
        tes.addVertexWithUV(0, 0, 1, iTop.getMinU(), iTop.getMaxV());
        tes.draw();

        tes.startDrawing(6);
        tes.setNormal(0.0F, 0.0F, -1.0F);
        tes.addVertexWithUV(0, 0, 0, iSide.getMinU(), iSide.getInterpolatedV(0 * 16));
        tes.addVertexWithUV(1, 1, 0, iSide.getMaxU(), iSide.getInterpolatedV(1 * 16));
        tes.addVertexWithUV(1, 0, 0, iSide.getMaxU(), iSide.getMinV());
        tes.addVertexWithUV(0, 0, 0, iSide.getMinU(), iSide.getMinV());
        tes.draw();

        tes.startDrawing(6);
        tes.setNormal(0.0F, 0.0F, 1.0F);
        tes.addVertexWithUV(1, 1, 1, iSide.getMaxU(), iSide.getInterpolatedV(1 * 16));
        tes.addVertexWithUV(0, 0, 1, iSide.getMinU(), iSide.getInterpolatedV(0 * 16));
        tes.addVertexWithUV(0, 0, 1, iSide.getMinU(), iSide.getMinV());
        tes.addVertexWithUV(1, 0, 1, iSide.getMaxU(), iSide.getMinV());
        tes.draw();

        tes.startDrawing(6);
        tes.setNormal(-1.0F, 0.0F, 0.0F);
        tes.addVertexWithUV(0, 0, 1, iSide.getMaxU(), iSide.getInterpolatedV(0 * 16));
        tes.addVertexWithUV(0, 0, 0, iSide.getMinU(), iSide.getInterpolatedV(0 * 16));
        tes.addVertexWithUV(0, 0, 0, iSide.getMinU(), iSide.getMinV());
        tes.addVertexWithUV(0, 0, 1, iSide.getMaxU(), iSide.getMinV());
        tes.draw();

        tes.startDrawing(6);
        tes.setNormal(1.0F, 0.0F, 0.0F);
        tes.addVertexWithUV(1, 1, 0, iSide.getMinU(), iSide.getInterpolatedV(1 * 16));
        tes.addVertexWithUV(1, 1, 1, iSide.getMaxU(), iSide.getInterpolatedV(1 * 16));
        tes.addVertexWithUV(1, 0, 1, iSide.getMaxU(), iSide.getMinV());
        tes.addVertexWithUV(1, 0, 0, iSide.getMinU(), iSide.getMinV());
        tes.draw();
      } else if (metadata == BlockMetalDecoration.META_connectorStructural) {
        Tessellator.instance.startDrawingQuads();
        ClientUtils.handleStaticTileRenderer(new TileEntityConnectorStructural());
        Tessellator.instance.draw();
      } else if (metadata == BlockMetalDecoration.META_wallMount) {
        Tessellator.instance.startDrawingQuads();
        ClientUtils.handleStaticTileRenderer(new TileEntityWallmountMetal());
        Tessellator.instance.draw();
      } else {
        block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
        renderer.setRenderBoundsFromBlock(block);
        ClientUtils.drawInventoryBlock(block, metadata, renderer);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    GL11.glPopMatrix();
  }
コード例 #11
0
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
    if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_fence) {
      renderer.setRenderBounds(.375, 0, .375, .625, 1, .625);
      renderer.renderStandardBlock(block, x, y, z);
      BlockMetalDecoration md = (BlockMetalDecoration) block;

      if (md.canConnectFenceTo(world, x + 1, y, z)) {
        renderer.setRenderBounds(.625, .375, .4375, 1, .5625, .5625);
        renderer.renderStandardBlock(block, x, y, z);
        renderer.setRenderBounds(.625, .75, .4375, 1, .9375, .5625);
        renderer.renderStandardBlock(block, x, y, z);
      }
      if (md.canConnectFenceTo(world, x - 1, y, z)) {
        renderer.setRenderBounds(0, .375, .4375, .375, .5625, .5625);
        renderer.renderStandardBlock(block, x, y, z);
        renderer.setRenderBounds(0, .75, .4375, .375, .9375, .5625);
        renderer.renderStandardBlock(block, x, y, z);
      }
      if (md.canConnectFenceTo(world, x, y, z + 1)) {
        renderer.setRenderBounds(.4375, .375, .625, .5625, .5625, 1);
        renderer.renderStandardBlock(block, x, y, z);
        renderer.setRenderBounds(.4375, .75, .625, .5625, .9375, 1);
        renderer.renderStandardBlock(block, x, y, z);
      }
      if (md.canConnectFenceTo(world, x, y, z - 1)) {
        renderer.setRenderBounds(.4375, .375, 0, .5625, .5625, .375);
        renderer.renderStandardBlock(block, x, y, z);
        renderer.setRenderBounds(.4375, .75, 0, .5625, .9375, .375);
        renderer.renderStandardBlock(block, x, y, z);
      }
      return true;
    } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_scaffolding) {
      renderer.setRenderBoundsFromBlock(block);
      float f = .015625f;
      float f1 = 0;
      renderer.renderFromInside = true;
      renderer.renderMinX += block.shouldSideBeRendered(world, x - 1, y, z, 4) ? f : f1;
      renderer.renderMinY += block.shouldSideBeRendered(world, x, y - 1, z, 0) ? f : f1;
      renderer.renderMinZ += block.shouldSideBeRendered(world, x, y, z - 1, 2) ? f : f1;
      renderer.renderMaxX -= block.shouldSideBeRendered(world, x + 1, y, z, 5) ? f : f1;
      renderer.renderMaxY -= block.shouldSideBeRendered(world, x, y + 1, z, 1) ? f : f1;
      renderer.renderMaxZ -= block.shouldSideBeRendered(world, x, y, z + 1, 3) ? f : f1;
      renderer.renderStandardBlock(block, x, y, z);
      renderer.renderMinX -= block.shouldSideBeRendered(world, x - 1, y, z, 4) ? f : f1;
      renderer.renderMinY -= block.shouldSideBeRendered(world, x, y - 1, z, 0) ? f : f1;
      renderer.renderMinZ -= block.shouldSideBeRendered(world, x, y, z - 1, 2) ? f : f1;
      renderer.renderMaxX += block.shouldSideBeRendered(world, x + 1, y, z, 5) ? f : f1;
      renderer.renderMaxY += block.shouldSideBeRendered(world, x, y + 1, z, 1) ? f : f1;
      renderer.renderMaxZ += block.shouldSideBeRendered(world, x, y, z + 1, 3) ? f : f1;
      renderer.renderFromInside = false;
      return renderer.renderStandardBlock(block, x, y, z);
    } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_lantern)
    //		{
    //			if(world.isAirBlock(x,y-1,z)&&!world.isAirBlock(x,y+1,z))
    //			{
    //				renderer.uvRotateWest = 3;
    //				renderer.uvRotateEast = 3;
    //				renderer.uvRotateNorth = 3;
    //				renderer.uvRotateSouth = 3;
    //				renderer.setRenderBounds(.3125f,.875f,.3125f, .6875f,1,.6875f);
    //				renderer.renderStandardBlock(block, x, y, z);
    //				renderer.setRenderBounds(.25f,.1875f,.25f, .75f,.875f,.75f);
    //				renderer.renderStandardBlock(block, x, y, z);
    //				renderer.uvRotateWest = 0;
    //				renderer.uvRotateEast = 0;
    //				renderer.uvRotateNorth = 0;
    //				renderer.uvRotateSouth = 0;
    //			}
    //			else
    //			{
    //				renderer.setRenderBounds(.3125f,0,.3125f, .6875f,.125f,.6875f);
    //				renderer.renderStandardBlock(block, x, y, z);
    //				renderer.setRenderBounds(.25f,.125f,.25f, .75f,.8125f,.75f);
    //				renderer.renderStandardBlock(block, x, y, z);
    //			}
    //			return true;
    //		}
    {
      TileEntityLantern tile = (TileEntityLantern) world.getTileEntity(x, y, z);
      ClientUtils.handleStaticTileRenderer(tile);
      return true;
    } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_structuralArm) {
      Tessellator tes = ClientUtils.tes();
      IIcon iSide = block.getIcon(2, 3);
      IIcon iTop = block.getIcon(0, 3);

      int f =
          (world.getTileEntity(x, y, z) instanceof TileEntityStructuralArm)
              ? ((TileEntityStructuralArm) world.getTileEntity(x, y, z)).facing
              : 0;
      boolean inv =
          (world.getTileEntity(x, y, z) instanceof TileEntityStructuralArm)
              ? ((TileEntityStructuralArm) world.getTileEntity(x, y, z)).inverted
              : false;
      ForgeDirection fd = ForgeDirection.getOrientation(f);
      int rowTop = 0;
      while (rowTop < 8) {
        if (world.getTileEntity(x - fd.offsetX * (rowTop + 1), y, z - fd.offsetZ * (rowTop + 1))
                instanceof TileEntityStructuralArm
            && ((TileEntityStructuralArm)
                        world.getTileEntity(
                            x - fd.offsetX * (rowTop + 1), y, z - fd.offsetZ * (rowTop + 1)))
                    .facing
                == f
            && ((TileEntityStructuralArm)
                        world.getTileEntity(
                            x - fd.offsetX * (rowTop + 1), y, z - fd.offsetZ * (rowTop + 1)))
                    .inverted
                == inv) rowTop++;
        else break;
      }
      int rowBot = 0;
      while (rowBot < 8) {
        if (world.getTileEntity(x + fd.offsetX * (rowBot + 1), y, z + fd.offsetZ * (rowBot + 1))
                instanceof TileEntityStructuralArm
            && ((TileEntityStructuralArm)
                        world.getTileEntity(
                            x + fd.offsetX * (rowBot + 1), y, z + fd.offsetZ * (rowBot + 1)))
                    .facing
                == f
            && ((TileEntityStructuralArm)
                        world.getTileEntity(
                            x + fd.offsetX * (rowBot + 1), y, z + fd.offsetZ * (rowBot + 1)))
                    .inverted
                == inv) rowBot++;
        else break;
      }
      double rowTotal = rowTop + rowBot + 1;
      double yTop = 1 - rowTop / rowTotal;
      double yBot = rowBot / rowTotal;

      double d3 = iTop.getInterpolatedU(0);
      double d4 = iTop.getInterpolatedU(16);
      double d5 = iTop.getInterpolatedV(0);
      double d6 = iTop.getInterpolatedV(16);
      double d7 = d4;
      double d8 = d3;
      double d9 = d5;
      double d10 = d6;

      double y11 = f == 5 || f == 3 ? yBot : yTop;
      double y10 = f == 5 || f == 2 ? yBot : yTop;
      double y00 = f == 4 || f == 2 ? yBot : yTop;
      double y01 = f == 4 || f == 3 ? yBot : yTop;

      // SIDE 0
      ClientUtils.BlockLightingInfo info =
          ClientUtils.calculateBlockLighting(0, world, block, x, y, z, 1, 1, 1);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 - y01 : 0), z + 1, d8, d10);
      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 - y00 : 0), z + 0, d3, d5);
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 - y10 : 0), z + 0, d7, d9);
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 - y11 : 0), z + 1, d4, d6);

      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 - y00 : 0) + .0001, z + 0, d3, d5);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 - y01 : 0) + .0001, z + 1, d8, d10);
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 - y11 : 0) + .0001, z + 1, d4, d6);
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 - y10 : 0) + .0001, z + 0, d7, d9);

      // SIDE 1
      info = ClientUtils.calculateBlockLighting(1, world, block, x, y, z, 1, 1, 1);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : y11), z + 1, d4, d6);
      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : y10), z + 0, d7, d9);
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : y00), z + 0, d3, d5);
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : y01), z + 1, d8, d10);

      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : y10) - .0001, z + 0, d7, d9);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : y11) - .0001, z + 1, d4, d6);
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : y01) - .0001, z + 1, d8, d10);
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : y00) - .0001, z + 0, d3, d5);

      // SIDE 2
      info = ClientUtils.calculateBlockLighting(2, world, block, x, y, z, 1, 1, 1);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(
          x + 0,
          y + (inv ? 1 - y00 : y00),
          z + 0,
          iSide.getMinU(),
          iSide.getInterpolatedV(y00 * 16));
      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(
          x + 1,
          y + (inv ? 1 - y10 : y10),
          z + 0,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y10 * 16));
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : 0), z + 0, iSide.getMaxU(), iSide.getMinV());
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV());

      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(
          x + 1,
          y + (inv ? 1 - y10 : y10),
          z + 0 + .0001,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y10 * 16));
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(
          x + 0,
          y + (inv ? 1 - y00 : y00),
          z + 0 + .0001,
          iSide.getMinU(),
          iSide.getInterpolatedV(y00 * 16));
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(
          x + 0, y + (inv ? 1 : 0), z + 0 + .0001, iSide.getMinU(), iSide.getMinV());
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(
          x + 1, y + (inv ? 1 : 0), z + 0 + .0001, iSide.getMaxU(), iSide.getMinV());

      // SIDE 3
      info = ClientUtils.calculateBlockLighting(3, world, block, x, y, z, 1, 1, 1);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(
          x + 0,
          y + (inv ? 1 - y01 : y01),
          z + 1,
          iSide.getMinU(),
          iSide.getInterpolatedV(y01 * 16));
      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : 0), z + 1, iSide.getMinU(), iSide.getMinV());
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV());
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(
          x + 1,
          y + (inv ? 1 - y11 : y11),
          z + 1,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y11 * 16));

      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(
          x + 0, y + (inv ? 1 : 0), z + 1 - .0001, iSide.getMinU(), iSide.getMinV());
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(
          x + 0,
          y + (inv ? 1 - y01 : y01),
          z + 1 - .0001,
          iSide.getMinU(),
          iSide.getInterpolatedV(y01 * 16));
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(
          x + 1,
          y + (inv ? 1 - y11 : y11),
          z + 1 - .0001,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y11 * 16));
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(
          x + 1, y + (inv ? 1 : 0), z + 1 - .0001, iSide.getMaxU(), iSide.getMinV());

      // SIDE 4
      info = ClientUtils.calculateBlockLighting(4, world, block, x, y, z, 1, 1, 1);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(
          x + 0,
          y + (inv ? 1 - y01 : y01),
          z + 1,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y01 * 16));
      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(
          x + 0,
          y + (inv ? 1 - y00 : y00),
          z + 0,
          iSide.getMinU(),
          iSide.getInterpolatedV(y00 * 16));
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV());
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV());

      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(
          x + 0 + .0001,
          y + (inv ? 1 - y00 : y00),
          z + 0,
          iSide.getMinU(),
          iSide.getInterpolatedV(y00 * 16));
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(
          x + 0 + .0001,
          y + (inv ? 1 - y01 : y01),
          z + 1,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y01 * 16));
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(
          x + 0 + .0001, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV());
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(
          x + 0 + .0001, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV());

      // SIDE 5
      info = ClientUtils.calculateBlockLighting(5, world, block, x, y, z, 1, 1, 1);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV());
      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV());
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(
          x + 1,
          y + (inv ? 1 - y10 : y10),
          z + 0,
          iSide.getMinU(),
          iSide.getInterpolatedV(y10 * 16));
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(
          x + 1,
          y + (inv ? 1 - y11 : y11),
          z + 1,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y11 * 16));

      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(
          x + 1 - .0001, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV());
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(
          x + 1 - .0001, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV());
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(
          x + 1 - .0001,
          y + (inv ? 1 - y11 : y11),
          z + 1,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y11 * 16));
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(
          x + 1 - .0001,
          y + (inv ? 1 - y10 : y10),
          z + 0,
          iSide.getMinU(),
          iSide.getInterpolatedV(y10 * 16));

      return true;
    } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_connectorStructural) {
      TileEntityConnectorStructural tile =
          (TileEntityConnectorStructural) world.getTileEntity(x, y, z);
      ClientUtils.handleStaticTileRenderer(tile);
      return true;
    } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_wallMount) {
      TileEntityWallmountMetal tile = (TileEntityWallmountMetal) world.getTileEntity(x, y, z);
      ClientUtils.handleStaticTileRenderer(tile);
      return true;
    } else {
      renderer.setRenderBounds(0, 0, 0, 1, 1, 1);
      return renderer.renderStandardBlock(block, x, y, z);
    }
  }
コード例 #12
0
  @Override
  public void renderBase(int pass) {

    Tessellator t = Tessellator.instance;
    Vector3Cube vector =
        new Vector3Cube(pixel * 3, 0.0, pixel * 3, 1.0 - (pixel * 3), pixel * 2, 1.0 - pixel * 3);
    IIcon topIcon = IconSupplier.cagedLampFootTop;
    IIcon sideIcon = IconSupplier.cagedLampFootSide;

    double minU = topIcon.getInterpolatedU(vector.getMinX() * 16);
    double maxU = topIcon.getInterpolatedU(vector.getMaxX() * 16);
    double minV = topIcon.getInterpolatedV(vector.getMinZ() * 16);
    double maxV = topIcon.getInterpolatedV(vector.getMaxZ() * 16);

    // Top side
    t.setNormal(0, 1, 0);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), maxU, maxV);

    //        minU = sideIcon.getInterpolatedU(vector.getMinX() * 16);
    //        maxU = sideIcon.getInterpolatedU(vector.getMaxX() * 16);
    //        minV = sideIcon.getInterpolatedV(vector.getMinY() * 16);
    //        maxV = sideIcon.getInterpolatedV(vector.getMaxY() * 16);
    // Draw west side:
    t.setNormal(-1, 0, 0);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), minU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMinZ(), maxU, maxV);

    // Draw east side:
    t.setNormal(1, 0, 0);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMinZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), maxU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMaxZ(), maxU, maxV);

    // Draw north side
    t.setNormal(0, 0, -1);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMinZ(), minU, maxV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMinZ(), maxU, maxV);

    // Draw south side
    t.setNormal(0, 0, 1);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMaxZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), maxU, maxV);

    // And now, the cage itself!
    // No. Not Nicholas Cage. The lamp-cage!
    vector =
        new Vector3Cube(
            pixel * 4, pixel * 2, pixel * 4, 1.0 - (pixel * 4), 1.0 - (pixel * 4), 1.0 - pixel * 4);
    topIcon = IconSupplier.cagedLampCageTop;
    sideIcon = IconSupplier.cagedLampCageSide;

    minU = topIcon.getInterpolatedU(vector.getMinX() * 16);
    maxU = topIcon.getInterpolatedU(vector.getMaxX() * 16);
    minV = topIcon.getInterpolatedV(vector.getMinZ() * 16);
    maxV = topIcon.getInterpolatedV(vector.getMaxZ() * 16);

    // Top side
    t.setNormal(0, 1, 0);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), maxU, maxV);

    minU = sideIcon.getInterpolatedU(vector.getMinX() * 16);
    maxU = sideIcon.getInterpolatedU(vector.getMaxX() * 16);
    minV = sideIcon.getInterpolatedV(vector.getMinY() * 16);
    maxV = sideIcon.getInterpolatedV(vector.getMaxY() * 16);
    // Draw west side:
    t.setNormal(-1, 0, 0);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), minU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMinZ(), maxU, maxV);

    t.setNormal(1, 0, 0);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMinZ(), minU, maxV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), minU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMaxZ(), maxU, maxV);

    // Draw east side:
    t.setNormal(1, 0, 0);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMinZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), maxU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMaxZ(), maxU, maxV);

    t.setNormal(-1, 0, 0);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMinZ(), maxU, maxV);

    // Draw north side
    t.setNormal(0, 0, 1);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMinZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), minU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMinZ(), maxU, maxV);

    t.setNormal(0, 0, -1);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMinZ(), minU, maxV);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMinZ(), maxU, maxV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), minU, minV);

    // Draw south side
    t.setNormal(0, 0, 1);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), minU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMaxZ(), maxU, maxV);

    t.setNormal(0, 0, -1);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMaxZ(), maxU, maxV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), maxU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), minU, minV);
  }
コード例 #13
0
  @Override
  public void renderLamp(int pass, int r, int g, int b) {

    Tessellator t = Tessellator.instance;
    IIcon iconToUseTop;
    IIcon iconToUseSide;
    if (power == 0) {
      iconToUseSide = IconSupplier.cagedLampLampInactive;
      iconToUseTop = IconSupplier.cagedLampLampInactiveTop;
    } else {
      iconToUseSide = IconSupplier.cagedLampLampActive;
      iconToUseTop = IconSupplier.cagedLampLampActiveTop;

      t.setColorRGBA(r, g, b, 20);
      // RenderHelper.drawTesselatedCube(new Vector3Cube(pixel * 4.5, pixel * 2, pixel * 4.5, 1.0 -
      // (pixel*4.5), 1.0 - (pixel * 4.5), 1.0 - pixel * 4.5));
      t.setColorRGBA(r, g, b, 255);
    }

    Vector3Cube vector =
        new Vector3Cube(
            pixel * 5, pixel * 2, pixel * 5, 1.0 - (pixel * 5), 1.0 - (pixel * 5), 1.0 - pixel * 5);

    double minU = iconToUseTop.getInterpolatedU(vector.getMinX() * 16);
    double maxU = iconToUseTop.getInterpolatedU(vector.getMaxX() * 16);
    double minV = iconToUseTop.getInterpolatedV(vector.getMinZ() * 16);
    double maxV = iconToUseTop.getInterpolatedV(vector.getMaxZ() * 16);

    // Top side
    t.setNormal(0, 1, 0);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), maxU, maxV);

    minU = iconToUseSide.getInterpolatedU(vector.getMinX() * 16);
    maxU = iconToUseSide.getInterpolatedU(vector.getMaxX() * 16);
    minV = iconToUseSide.getInterpolatedV(vector.getMinZ() * 16);
    maxV = iconToUseSide.getInterpolatedV(vector.getMaxZ() * 16);

    // Draw west side:
    t.setNormal(-1, 0, 0);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), minU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMinZ(), maxU, maxV);

    // Draw east side:
    t.setNormal(1, 0, 0);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMinZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), maxU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMaxZ(), maxU, maxV);

    // Draw north side
    t.setNormal(0, 0, -1);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMinZ(), minU, maxV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMinZ(), maxU, maxV);

    // Draw south side
    t.setNormal(0, 0, 1);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMaxZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), maxU, maxV);
  }
コード例 #14
0
  @Override
  public void renderTileEntityAt(
      TileEntity tile, double par2, double par4, double par6, float par8) {
    TileEntityPageExtractor te = (TileEntityPageExtractor) tile;
    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glTranslated(par2, par4, par6);

    boolean hasBook = te.getStackInSlot(0) != null;
    double t = System.currentTimeMillis() / 10D;
    Tessellator v5 = Tessellator.instance;

    if (!te.isInWorld() || MinecraftForgeClient.getRenderPass() == 0) {
      GL11.glColor4f(1, 1, 1, 1);
      ReikaTextureHelper.bindTerrainTexture();
      v5.startDrawingQuads();
      v5.setBrightness(
          te.isInWorld()
              ? te.getBlockType()
                  .getMixedBrightnessForBlock(te.worldObj, te.xCoord, te.yCoord, te.zCoord)
              : 240);
      v5.setColorOpaque_I(0xffffff);
      IIcon ico = Blocks.stone_slab.getIcon(0, 0);
      double u = ico.getMinU();
      double v = ico.getMinV();
      double du = ico.getMaxU();
      double dv = ico.getMaxV();

      ico = Blocks.stone_slab.getIcon(2, 0);
      double u2 = ico.getMinU();
      double v2 = ico.getMinV();
      double du2 = ico.getMaxU();
      double dv2 = ico.getInterpolatedV(8);

      double h = 0.1875;
      double s = 0.375;

      v5.setNormal(0, 1, 0);
      v5.addVertexWithUV(0.5 - s, h, 0.5 + s, u, dv);
      v5.addVertexWithUV(0.5 + s, h, 0.5 + s, du, dv);
      v5.addVertexWithUV(0.5 + s, h, 0.5 - s, du, v);
      v5.addVertexWithUV(0.5 - s, h, 0.5 - s, u, v);

      v5.setColorOpaque_I(0xa0a0a0);
      v5.addVertexWithUV(1, 0, 0, u2, dv2);
      v5.addVertexWithUV(0.5 + s, h, 0.5 - s, u2, v2);
      v5.addVertexWithUV(0.5 + s, h, 0.5 + s, du2, v2);
      v5.addVertexWithUV(1, 0, 1, du2, dv2);

      v5.addVertexWithUV(0, 0, 1, u2, v2);
      v5.addVertexWithUV(0.5 - s, h, 0.5 + s, u2, dv2);
      v5.addVertexWithUV(0.5 - s, h, 0.5 - s, du2, dv2);
      v5.addVertexWithUV(0, 0, 0, du2, v2);

      v5.setColorOpaque_I(0x909090);
      v5.addVertexWithUV(1, 0, 1, u2, v2);
      v5.addVertexWithUV(0.5 + s, h, 0.5 + s, u2, dv2);
      v5.addVertexWithUV(0.5 - s, h, 0.5 + s, du2, dv2);
      v5.addVertexWithUV(0, 0, 1, du2, v2);

      v5.addVertexWithUV(0, 0, 0, u2, dv2);
      v5.addVertexWithUV(0.5 - s, h, 0.5 - s, u2, v2);
      v5.addVertexWithUV(0.5 + s, h, 0.5 - s, du2, v2);
      v5.addVertexWithUV(1, 0, 0, du2, dv2);

      v5.setColorOpaque_I(0x707070);
      v5.addVertexWithUV(0, 0, 0, u, v);
      v5.addVertexWithUV(1, 0, 0, du, v);
      v5.addVertexWithUV(1, 0, 1, du, dv);
      v5.addVertexWithUV(0, 0, 1, u, dv);
      v5.draw();

      if (hasBook) {
        GL11.glPushMatrix();
        GL11.glTranslated(0.5, 0.5, 0.5);
        GL11.glRotated(90, 0, 0, 1);
        double a = (t / 2D) % 360D;
        double da1 = 5 * Math.sin(t / 32D);
        double da2 = 8 * Math.cos(t / 48D);
        GL11.glRotated(a, 1, 0, 0);
        GL11.glRotated(da1, 0, 1, 0);
        GL11.glRotated(da2, 0, 0, 1);
        this.bindTexture(bookTex);
        book.render(null, 0, 0, 0, 1.05F, 0, 0.0625F);
        GL11.glPopMatrix();
      }
    }

    if (!te.isInWorld() || MinecraftForgeClient.getRenderPass() == 1) {

      GL11.glEnable(GL11.GL_BLEND);
      BlendMode.ADDITIVEDARK.apply();
      GL11.glDisable(GL11.GL_TEXTURE_2D);
      GL11.glDisable(GL11.GL_LIGHTING);
      GL11.glDisable(GL11.GL_ALPHA_TEST);
      GL11.glDepthMask(false);

      for (BasicVariablePoint point : points) {
        double r = 0.75 + 0.25 * Math.sin(t / 50D + Math.toRadians(point.hashCode() / 32D % 360D));
        DecimalPosition pos = point.asPosition();
        if (hasBook) {
          ChromaFX.renderBeam(
              0.5,
              0.5,
              0.5,
              0.5 + r * pos.xCoord,
              0.5 + r * pos.yCoord,
              0.5 + r * pos.zCoord,
              par8,
              255,
              0.125);
        } else {
          r /= 2;
        }
        if (te.isInWorld() && !Minecraft.getMinecraft().isGamePaused()) {
          EntityBlurFX fx =
              new EntityBlurFX(
                  te.worldObj,
                  te.xCoord + 0.5 + pos.xCoord * r,
                  te.yCoord + 0.5 + pos.yCoord * r,
                  te.zCoord + 0.5 + pos.zCoord * r);
          fx.setRapidExpand()
              .setScale(0.625F)
              .setLife(8)
              .setAlphaFading()
              .setIcon(ChromaIcons.FADE_GENTLE);
          Minecraft.getMinecraft().effectRenderer.addEffect(fx);
        }
        point.update();
      }

      GL11.glEnable(GL11.GL_TEXTURE_2D);
      ReikaTextureHelper.bindTerrainTexture();

      GL11.glTranslated(0.5, 0.5, 0.5);

      RenderManager rm = RenderManager.instance;
      if (te.isInWorld()) {
        GL11.glRotatef(-rm.playerViewY, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(rm.playerViewX, 1.0F, 0.0F, 0.0F);
      } else {
        GL11.glTranslated(0, 0.125, 0);
        GL11.glRotated(180 + 45, 0, 1, 0);
        GL11.glRotated(30, 1, 0, 0);
      }

      ChromaIcons[] icons =
          hasBook
              ? new ChromaIcons[] {
                ChromaIcons.HEXFLARE, ChromaIcons.BLURFLARE, ChromaIcons.RADIATE,
              }
              : new ChromaIcons[] {
                ChromaIcons.CONCENTRIC2REV, ChromaIcons.ROSES_WHITE,
              };

      for (int i = 0; i < icons.length; i++) {
        IIcon ico = icons[i].getIcon();

        double sb = hasBook ? 0.75 : 0.5;

        double s = sb - 0.1875 * i;

        double u = ico.getMinU();
        double v = ico.getMinV();
        double du = ico.getMaxU();
        double dv = ico.getMaxV();

        v5.startDrawingQuads();
        v5.setBrightness(240);
        v5.addVertexWithUV(-s, s, 0, u, dv);
        v5.addVertexWithUV(s, s, 0, du, dv);
        v5.addVertexWithUV(s, -s, 0, du, v);
        v5.addVertexWithUV(-s, -s, 0, u, v);
        v5.draw();
      }
    }

    GL11.glPopMatrix();
    GL11.glPopAttrib();
  }
コード例 #15
0
 @Override
 public void apply(UV uv) {
   IIcon icon = icons[uv.tex % icons.length];
   uv.u = icon.getInterpolatedU(uv.u * 16);
   uv.v = icon.getInterpolatedV(uv.v * 16);
 }