Exemplo n.º 1
0
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block b, int modelId, RenderBlocks rb) {
    Tessellator v5 = Tessellator.instance;
    int meta = world.getBlockMetadata(x, y, z);
    /*
    float f1 = 0.5F;
    float f2 = 1;
    float f3 = 0.8F;
    float f4 = 0.8F;
    float f5 = 0.6F;
    float f6 = 0.6F;


    v5.setBrightness(rb.renderMinY > 0.0D ? l : b.getMixedBrightnessForBlock(world, x, y - 1, z));
    v5.setColorOpaque_F(f1, f1, f1);
    rb.renderFaceYNeg(b, x, y, z, ico);

    v5.setBrightness(rb.renderMaxY < 1.0D ? l : b.getMixedBrightnessForBlock(world, x, y + 1, z));
    v5.setColorOpaque_F(f2, f2, f2);
    rb.renderFaceYPos(b, x, y, z, ico);

    v5.setBrightness(rb.renderMinZ > 0.0D ? l : b.getMixedBrightnessForBlock(world, x, y, z - 1));
    v5.setColorOpaque_F(f3, f3, f3);
    rb.renderFaceZNeg(b, x, y, z, ico);

    v5.setBrightness(rb.renderMaxZ < 1.0D ? l : b.getMixedBrightnessForBlock(world, x, y, z + 1));
    v5.setColorOpaque_F(f4, f4, f4);
    rb.renderFaceZPos(b, x, y, z, ico);

    v5.setBrightness(rb.renderMinX > 0.0D ? l : b.getMixedBrightnessForBlock(world, x - 1, y, z));
    v5.setColorOpaque_F(f5, f5, f5);
    rb.renderFaceXNeg(b, x, y, z, ico);

    v5.setBrightness(rb.renderMaxX < 1.0D ? l : b.getMixedBrightnessForBlock(world, x + 1, y, z));
    v5.setColorOpaque_F(f6, f6, f6);
    rb.renderFaceXPos(b, x, y, z, ico);
     */
    rb.renderStandardBlockWithAmbientOcclusion(b, x, y, z, 1, 1, 1);

    IIcon ico = CrystalElement.elements[meta].getFaceRune();
    v5.setBrightness(240);
    v5.setColorOpaque_F(255, 255, 255);
    if (b.shouldSideBeRendered(world, x, y - 1, z, ForgeDirection.DOWN.ordinal()))
      rb.renderFaceYNeg(b, x, y, z, ico);
    if (b.shouldSideBeRendered(world, x, y + 1, z, ForgeDirection.UP.ordinal()))
      rb.renderFaceYPos(b, x, y, z, ico);
    if (b.shouldSideBeRendered(world, x, y, z - 1, ForgeDirection.NORTH.ordinal()))
      rb.renderFaceZNeg(b, x, y, z, ico);
    if (b.shouldSideBeRendered(world, x, y, z + 1, ForgeDirection.SOUTH.ordinal()))
      rb.renderFaceZPos(b, x, y, z, ico);
    if (b.shouldSideBeRendered(world, x - 1, y, z, ForgeDirection.WEST.ordinal()))
      rb.renderFaceXNeg(b, x, y, z, ico);
    if (b.shouldSideBeRendered(world, x + 1, y, z, ForgeDirection.EAST.ordinal()))
      rb.renderFaceXPos(b, x, y, z, ico);
    return true;
  }
Exemplo n.º 2
0
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block b, int modelId, RenderBlocks rb) {
    Tessellator v5 = Tessellator.instance;
    int meta = world.getBlockMetadata(x, y, z);

    BlockTieredOre t = (BlockTieredOre) b;
    if (t.isPlayerSufficientTier(world, x, y, z, Minecraft.getMinecraft().thePlayer)) {
      if (TieredOres.list[meta].renderAsGeode()) {
        this.renderGeode(world, x, y, z, b, meta, rb);
        // this.renderSimpleGeode(world, x, y, z, b, meta, rb);
      } else {
        rb.renderStandardBlockWithAmbientOcclusion(b, x, y, z, 1, 1, 1);

        IIcon ico = t.getOverlay(meta);
        v5.setBrightness(240);
        v5.setColorOpaque(255, 255, 255);
        if (b.shouldSideBeRendered(world, x, y - 1, z, ForgeDirection.DOWN.ordinal()))
          rb.renderFaceYNeg(b, x, y, z, ico);
        if (b.shouldSideBeRendered(world, x, y + 1, z, ForgeDirection.UP.ordinal()))
          rb.renderFaceYPos(b, x, y, z, ico);
        if (b.shouldSideBeRendered(world, x, y, z - 1, ForgeDirection.NORTH.ordinal()))
          rb.renderFaceZNeg(b, x, y, z, ico);
        if (b.shouldSideBeRendered(world, x, y, z + 1, ForgeDirection.SOUTH.ordinal()))
          rb.renderFaceZPos(b, x, y, z, ico);
        if (b.shouldSideBeRendered(world, x - 1, y, z, ForgeDirection.WEST.ordinal()))
          rb.renderFaceXNeg(b, x, y, z, ico);
        if (b.shouldSideBeRendered(world, x + 1, y, z, ForgeDirection.EAST.ordinal()))
          rb.renderFaceXPos(b, x, y, z, ico);
      }
    } else {
      rb.renderBlockAllFaces(t.getDisguise(meta), x, y, z);
      // rb.renderStandardBlockWithAmbientOcclusion(t.getDisguise(), x, y, z, 1, 1, 1);
    }
    return true;
  }
Exemplo n.º 3
0
  @Override
  public void rebuildChunk(
      final float x, final float y, final float z, final ChunkCompileTaskGenerator generator) {
    final CompiledOverlay compiledOverlay = new CompiledOverlay();
    final BlockPos from = getPosition();
    final BlockPos to = from.add(15, 15, 15);
    generator.getLock().lock();
    RegionRenderCache regionRenderCache;
    final SchematicWorld schematic = (SchematicWorld) this.world;

    try {
      if (generator.getStatus() != ChunkCompileTaskGenerator.Status.COMPILING) {
        return;
      }

      if (from.getX() < 0
          || from.getZ() < 0
          || from.getX() >= schematic.getWidth()
          || from.getZ() >= schematic.getLength()) {
        generator.setCompiledChunk(CompiledChunk.DUMMY);
        return;
      }

      regionRenderCache =
          new RegionRenderCache(this.world, from.add(-1, -1, -1), to.add(1, 1, 1), 1);
      generator.setCompiledChunk(compiledOverlay);
    } finally {
      generator.getLock().unlock();
    }

    final VisGraph visgraph = new VisGraph();

    if (!regionRenderCache.extendedLevelsInChunkCache()) {
      ++renderChunksUpdated;

      final World mcWorld = Minecraft.getMinecraft().theWorld;

      final EnumWorldBlockLayer layer = EnumWorldBlockLayer.TRANSLUCENT;
      final WorldRenderer worldRenderer =
          generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(layer);

      GeometryTessellator.setStaticDelta(ConfigurationHandler.blockDelta);

      for (final BlockPos pos : BlockPos.getAllInBox(from, to)) {
        if (schematic.isRenderingLayer && schematic.renderingLayer != pos.getY()
            || !schematic.isInside(pos)) {
          continue;
        }

        boolean render = false;
        int sides = 0;
        int color = 0;

        final IBlockState schBlockState = schematic.getBlockState(pos);
        final Block schBlock = schBlockState.getBlock();

        if (schBlock.isOpaqueCube()) {
          visgraph.func_178606_a(pos);
        }

        final BlockPos mcPos = pos.add(schematic.position);
        final IBlockState mcBlockState = mcWorld.getBlockState(mcPos);
        final Block mcBlock = mcBlockState.getBlock();

        final boolean isSchAirBlock = schematic.isAirBlock(pos);
        final boolean isMcAirBlock =
            mcWorld.isAirBlock(mcPos) || ConfigurationHandler.isExtraAirBlock(mcBlock);

        if (!isMcAirBlock) {
          if (isSchAirBlock && ConfigurationHandler.highlightAir) {
            render = true;
            sides = GeometryMasks.Quad.ALL;
            color = 0xBF00BF;
          }
        }

        if (!render) {
          if (ConfigurationHandler.highlight) {
            if (!isMcAirBlock) {
              if (schBlock != mcBlock) {
                render = true;
                color = 0xFF0000;
              } else if (schBlock.getMetaFromState(schBlockState)
                  != mcBlock.getMetaFromState(mcBlockState)) {
                render = true;
                color = 0xBF5F00;
              }
            } else if (!isSchAirBlock) {
              render = true;
              color = 0x00BFFF;
            }
          }

          if (render) {
            if (schBlock.shouldSideBeRendered(
                schematic, pos.offset(EnumFacing.DOWN), EnumFacing.DOWN)) {
              sides |= GeometryMasks.Quad.DOWN;
            }

            if (schBlock.shouldSideBeRendered(
                schematic, pos.offset(EnumFacing.UP), EnumFacing.UP)) {
              sides |= GeometryMasks.Quad.UP;
            }

            if (schBlock.shouldSideBeRendered(
                schematic, pos.offset(EnumFacing.NORTH), EnumFacing.NORTH)) {
              sides |= GeometryMasks.Quad.NORTH;
            }

            if (schBlock.shouldSideBeRendered(
                schematic, pos.offset(EnumFacing.SOUTH), EnumFacing.SOUTH)) {
              sides |= GeometryMasks.Quad.SOUTH;
            }

            if (schBlock.shouldSideBeRendered(
                schematic, pos.offset(EnumFacing.WEST), EnumFacing.WEST)) {
              sides |= GeometryMasks.Quad.WEST;
            }

            if (schBlock.shouldSideBeRendered(
                schematic, pos.offset(EnumFacing.EAST), EnumFacing.EAST)) {
              sides |= GeometryMasks.Quad.EAST;
            }
          }
        }

        if (render && sides != 0) {
          if (!compiledOverlay.isLayerStarted(layer)) {
            compiledOverlay.setLayerStarted(layer);
            preRenderBlocks(worldRenderer, from);
          }

          GeometryTessellator.drawCuboid(worldRenderer, pos, sides, 0x3F000000 | color);
          compiledOverlay.setLayerUsed(layer);
        }
      }

      if (compiledOverlay.isLayerStarted(layer)) {
        postRenderBlocks(layer, x, y, z, worldRenderer, compiledOverlay);
      }
    }

    compiledOverlay.setVisibility(visgraph.computeVisibility());
  }
Exemplo n.º 4
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;
    }
  }
  @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);
    }
  }
Exemplo n.º 6
0
  private void renderGeode(
      IBlockAccess world, int x, int y, int z, Block b, int meta, RenderBlocks rb) {
    /*
    Coordinate c = new Coordinate(x, y, z);
    Long val = renderMap.get(c);
    if (val != null)
    	ReikaJavaLibrary.pConsole("Rerendering "+TieredOres.list[meta]+" geode at "+x+", "+y+", "+z+"; "+(System.currentTimeMillis()-val.longValue())+" ms since last render here.");
    else
    	ReikaJavaLibrary.pConsole("Rerendering "+TieredOres.list[meta]+" geode at "+x+", "+y+", "+z+"; Has not rendered before.");
    renderMap.put(c, System.currentTimeMillis());
     */
    TessellatorVertexList v5 = new TessellatorVertexList();
    Tessellator.instance.setColorOpaque_I(0xffffff);
    Tessellator.instance.addTranslation(x, y, z);
    IIcon stone = ((BlockTieredOre) b).getDisguise(meta).getIcon(0, 0);
    float us = stone.getMinU();
    float vs = stone.getMinV();
    float dus = stone.getMaxU();
    float dvs = stone.getMaxV();

    IIcon obsidian = Blocks.obsidian.getIcon(0, 0);
    float ub = obsidian.getMinU();
    float vb = obsidian.getMinV();
    float dub = obsidian.getMaxU();
    float dvb = obsidian.getMaxV();

    IIcon ico = ((BlockTieredOre) b).getGeodeIcon(meta);
    float uo = ico.getMinU();
    float vo = ico.getMinV();
    float duo = ico.getMaxU();
    float dvo = ico.getMaxV();

    double s = 1D / numSections;
    int da = offsetArray[(x % 16 + 16) % 16][(y % 16 + 16) % 16][(z % 16 + 16) % 16];

    for (int i = 0; i < numSections; i++) {
      double d = i * s;
      for (int k = 0; k < numSections; k++) {
        double d2 = k * s;
        boolean center = false; // ReikaMathLibrary.isValueInsideBoundsIncl(2, numSections-3, i) &&
        // ReikaMathLibrary.isValueInsideBoundsIncl(2, numSections-3, k);
        // center |= ReikaMathLibrary.isValueInsideBoundsIncl(1, numSections-2, i) &&
        // ReikaMathLibrary.isValueInsideBoundsIncl(2, numSections-3, k);
        // center |= ReikaMathLibrary.isValueInsideBoundsIncl(2, numSections-3, i) &&
        // ReikaMathLibrary.isValueInsideBoundsIncl(1, numSections-2, k);
        float us1 = center ? (float) (ub + (dub - ub) * d) : (float) (us + (dus - us) * d);
        float vs1 = center ? (float) (vb + (dvb - vb) * d2) : (float) (vs + (dvs - vs) * d2);
        float us2 =
            center ? (float) (ub + (dub - ub) * (d + s)) : (float) (us + (dus - us) * (d + s));
        float vs2 =
            center ? (float) (vb + (dvb - vb) * (d2 + s)) : (float) (vs + (dvs - vs) * (d2 + s));
        v5.addVertexWithUV(d, stoneOffsets[da][(i) * numSections + (k + 1)], d2 + s, us1, vs1);
        v5.addVertexWithUV(
            d + s, stoneOffsets[da][(i + 1) * numSections + (k + 1)], d2 + s, us2, vs1);
        v5.addVertexWithUV(d + s, stoneOffsets[da][(i + 1) * numSections + (k)], d2, us2, vs2);
        v5.addVertexWithUV(d, stoneOffsets[da][(i) * numSections + (k)], d2, us1, vs2);
      }
    }

    /*
    if (world != null) {
    	ReikaJavaLibrary.pConsole("*************************************");
    	for (int i = 0; i < 6; i++) {
    		ForgeDirection dir = ForgeDirection.VALID_DIRECTIONS[i];
    		ReikaJavaLibrary.pConsole(dir+" > "+b.shouldSideBeRendered(world, x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ, dir.ordinal()));
    	}
    	ReikaJavaLibrary.pConsole("---------------------------------------");
    }
     */
    if (world == null || b.shouldSideBeRendered(world, x, y + 1, z, ForgeDirection.UP.ordinal())) {
      if (world != null) {
        Tessellator.instance.setBrightness(b.getMixedBrightnessForBlock(world, x, y + 1, z));
        Tessellator.instance.setColorOpaque_F(1F, 1F, 1F);
      }
      Tessellator.instance.setNormal(0, 1, 0);
      v5.render();
    }

    v5.invertY();
    if (world == null
        || b.shouldSideBeRendered(world, x, y - 1, z, ForgeDirection.DOWN.ordinal())) {
      if (world != null) {
        Tessellator.instance.setBrightness(b.getMixedBrightnessForBlock(world, x, y - 1, z));
        Tessellator.instance.setColorOpaque_F(0.5F, 0.5F, 0.5F);
      }
      Tessellator.instance.setNormal(0, -1, 0);
      v5.render();
    }

    v5.rotateYtoX();
    if (world == null
        || b.shouldSideBeRendered(world, x - 1, y, z, ForgeDirection.WEST.ordinal())) {
      if (world != null) {
        Tessellator.instance.setBrightness(b.getMixedBrightnessForBlock(world, x - 1, y, z));
        Tessellator.instance.setColorOpaque_F(0.8F, 0.8F, 0.8F);
      }
      Tessellator.instance.setNormal(-1, 0, 0);
      v5.render();
    }

    v5.invertX();
    if (world == null
        || b.shouldSideBeRendered(world, x + 1, y, z, ForgeDirection.EAST.ordinal())) {
      if (world != null) {
        Tessellator.instance.setBrightness(b.getMixedBrightnessForBlock(world, x + 1, y, z));
        Tessellator.instance.setColorOpaque_F(0.8F, 0.8F, 0.8F);
      }
      Tessellator.instance.setNormal(1, 0, 0);
      v5.render();
    }

    v5.rotateXtoZ();
    if (world == null
        || b.shouldSideBeRendered(world, x, y, z + 1, ForgeDirection.SOUTH.ordinal())) {
      if (world != null) {
        Tessellator.instance.setBrightness(b.getMixedBrightnessForBlock(world, x, y, z + 1));
        Tessellator.instance.setColorOpaque_F(0.7F, 0.7F, 0.7F);
      }
      Tessellator.instance.setNormal(0, 0, -1);
      v5.render();
    }

    v5.invertZ();
    if (world == null
        || b.shouldSideBeRendered(world, x, y, z - 1, ForgeDirection.NORTH.ordinal())) {
      if (world != null) {
        Tessellator.instance.setBrightness(b.getMixedBrightnessForBlock(world, x, y, z - 1));
        Tessellator.instance.setColorOpaque_F(0.7F, 0.7F, 0.7F);
      }
      Tessellator.instance.setNormal(0, 0, 1);
      v5.render();
    }

    v5.clear();
    if (world != null) Tessellator.instance.setBrightness(240);
    for (int i = 0; i < numSections; i++) {
      double d = i * s;
      double db = d + s;
      for (int k = 0; k < numSections; k++) {
        double d2 = k * s;
        double d2b = d2 + s;
        float uo1 = (float) (uo + (duo - uo) * d);
        float vo1 = (float) (vo + (dvo - vo) * d2);
        float uo2 = (float) (uo + (duo - uo) * (d + s));
        float vo2 = (float) (vo + (dvo - vo) * (d2 + s));

        if (i == 0) {
          d = 0.2;
        } else if (i == numSections - 1) {
          db = 0.8;
        }

        if (k == 0) {
          d2 = 0.2;
        } else if (k == numSections - 1) {
          d2b = 0.8;
        }

        v5.addVertexWithUV(d, oreOffsets[da][(i) * numSections + (k + 1)], d2b, uo1, vo1);
        v5.addVertexWithUV(db, oreOffsets[da][(i + 1) * numSections + (k + 1)], d2b, uo2, vo1);
        v5.addVertexWithUV(db, oreOffsets[da][(i + 1) * numSections + (k)], d2, uo2, vo2);
        v5.addVertexWithUV(d, oreOffsets[da][(i) * numSections + (k)], d2, uo1, vo2);
      }
    }
    if (world == null || b.shouldSideBeRendered(world, x, y + 1, z, ForgeDirection.UP.ordinal())) {
      Tessellator.instance.setNormal(0, 1, 0);
      v5.render();
    }

    v5.invertY();
    if (world == null
        || b.shouldSideBeRendered(world, x, y - 1, z, ForgeDirection.DOWN.ordinal())) {
      Tessellator.instance.setNormal(0, -1, 0);
      v5.render();
    }

    v5.rotateYtoX();
    if (world == null
        || b.shouldSideBeRendered(world, x - 1, y, z, ForgeDirection.WEST.ordinal())) {
      Tessellator.instance.setNormal(-1, 0, 0);
      v5.render();
    }

    v5.invertX();
    if (world == null
        || b.shouldSideBeRendered(world, x + 1, y, z, ForgeDirection.EAST.ordinal())) {
      Tessellator.instance.setNormal(1, 0, 0);
      v5.render();
    }

    v5.rotateXtoZ();
    if (world == null
        || b.shouldSideBeRendered(world, x, y, z + 1, ForgeDirection.SOUTH.ordinal())) {
      Tessellator.instance.setNormal(0, 0, -1);
      v5.render();
    }

    v5.invertZ();
    if (world == null
        || b.shouldSideBeRendered(world, x, y, z - 1, ForgeDirection.NORTH.ordinal())) {
      Tessellator.instance.setNormal(0, 0, 1);
      v5.render();
    }

    Tessellator.instance.addTranslation(-x, -y, -z);
  }
Exemplo n.º 7
0
  private void renderSimpleGeode(
      IBlockAccess world, int x, int y, int z, Block b, int meta, RenderBlocks rb) {
    IIcon icos = ((BlockTieredOre) b).getGeodeStoneIcon(Math.abs(x + y * x * z + z) % 16);
    IIcon ico = ((BlockTieredOre) b).getGeodeIcon(meta);

    if (b.shouldSideBeRendered(world, x, y - 1, z, ForgeDirection.DOWN.ordinal()))
      rb.renderFaceYNeg(b, x, y, z, icos);
    if (b.shouldSideBeRendered(world, x, y + 1, z, ForgeDirection.UP.ordinal()))
      rb.renderFaceYPos(b, x, y, z, icos);
    if (b.shouldSideBeRendered(world, x, y, z - 1, ForgeDirection.NORTH.ordinal()))
      rb.renderFaceZNeg(b, x, y, z, icos);
    if (b.shouldSideBeRendered(world, x, y, z + 1, ForgeDirection.SOUTH.ordinal()))
      rb.renderFaceZPos(b, x, y, z, icos);
    if (b.shouldSideBeRendered(world, x - 1, y, z, ForgeDirection.WEST.ordinal()))
      rb.renderFaceXNeg(b, x, y, z, icos);
    if (b.shouldSideBeRendered(world, x + 1, y, z, ForgeDirection.EAST.ordinal()))
      rb.renderFaceXPos(b, x, y, z, icos);

    Tessellator.instance.setBrightness(240);
    Tessellator.instance.setColorOpaque(255, 255, 255);
    double d = 0.0025;

    if (b.shouldSideBeRendered(world, x, y - 1, z, ForgeDirection.DOWN.ordinal()))
      rb.renderFaceYNeg(b, x, y + d, z, ico);
    if (b.shouldSideBeRendered(world, x, y + 1, z, ForgeDirection.UP.ordinal()))
      rb.renderFaceYPos(b, x, y - d, z, ico);
    if (b.shouldSideBeRendered(world, x, y, z - 1, ForgeDirection.NORTH.ordinal()))
      rb.renderFaceZNeg(b, x, y, z + d, ico);
    if (b.shouldSideBeRendered(world, x, y, z + 1, ForgeDirection.SOUTH.ordinal()))
      rb.renderFaceZPos(b, x, y, z - d, ico);
    if (b.shouldSideBeRendered(world, x - 1, y, z, ForgeDirection.WEST.ordinal()))
      rb.renderFaceXNeg(b, x + d, y, z, ico);
    if (b.shouldSideBeRendered(world, x + 1, y, z, ForgeDirection.EAST.ordinal()))
      rb.renderFaceXPos(b, x - d, y, z, ico);
  }