Пример #1
0
  private void func_180549_a(
      Block blockIn,
      double p_180549_2_,
      double p_180549_4_,
      double p_180549_6_,
      BlockPos pos,
      float p_180549_9_,
      float p_180549_10_,
      double p_180549_11_,
      double p_180549_13_,
      double p_180549_15_) {
    if (blockIn.isFullCube()) {
      Tessellator tessellator = Tessellator.getInstance();
      WorldRenderer worldrenderer = tessellator.getWorldRenderer();
      double d0 =
          ((double) p_180549_9_ - (p_180549_4_ - ((double) pos.getY() + p_180549_13_)) / 2.0D)
              * 0.5D
              * (double) this.getWorldFromRenderManager().getLightBrightness(pos);

      if (d0 >= 0.0D) {
        if (d0 > 1.0D) {
          d0 = 1.0D;
        }

        double d1 = (double) pos.getX() + blockIn.getBlockBoundsMinX() + p_180549_11_;
        double d2 = (double) pos.getX() + blockIn.getBlockBoundsMaxX() + p_180549_11_;
        double d3 = (double) pos.getY() + blockIn.getBlockBoundsMinY() + p_180549_13_ + 0.015625D;
        double d4 = (double) pos.getZ() + blockIn.getBlockBoundsMinZ() + p_180549_15_;
        double d5 = (double) pos.getZ() + blockIn.getBlockBoundsMaxZ() + p_180549_15_;
        float f = (float) ((p_180549_2_ - d1) / 2.0D / (double) p_180549_10_ + 0.5D);
        float f1 = (float) ((p_180549_2_ - d2) / 2.0D / (double) p_180549_10_ + 0.5D);
        float f2 = (float) ((p_180549_6_ - d4) / 2.0D / (double) p_180549_10_ + 0.5D);
        float f3 = (float) ((p_180549_6_ - d5) / 2.0D / (double) p_180549_10_ + 0.5D);
        worldrenderer
            .pos(d1, d3, d4)
            .tex((double) f, (double) f2)
            .color(1.0F, 1.0F, 1.0F, (float) d0)
            .endVertex();
        worldrenderer
            .pos(d1, d3, d5)
            .tex((double) f, (double) f3)
            .color(1.0F, 1.0F, 1.0F, (float) d0)
            .endVertex();
        worldrenderer
            .pos(d2, d3, d5)
            .tex((double) f1, (double) f3)
            .color(1.0F, 1.0F, 1.0F, (float) d0)
            .endVertex();
        worldrenderer
            .pos(d2, d3, d4)
            .tex((double) f1, (double) f2)
            .color(1.0F, 1.0F, 1.0F, (float) d0)
            .endVertex();
      }
    }
  }
 private void setBlockBoundsBasedOnSelection(World world, int x, int y, int z) {
   float m = ConfigurationLib.littleBlocksSize;
   if (xSelected == -10) {
     this.setBlockBounds(0f, 0f, 0f, 0f, 0f, 0f);
   } else {
     TileEntityLittleChunk tile = (TileEntityLittleChunk) world.getTileEntity(x, y, z);
     Block block = tile.getBlock(xSelected, ySelected, zSelected);
     // System.out.println("Content: " + content);
     if (block == null) {
       this.setBlockBounds(
           xSelected / m,
           ySelected / m,
           zSelected / m,
           (xSelected + 1) / m,
           (ySelected + 1) / m,
           (zSelected + 1) / m);
     } else {
       if (block != null) {
         if (BlockStairs.func_150148_a /* isBlockStairsID */(block)) {
           block.setBlockBounds(0, 0, 0, 1, 1, 1);
         } else {
           block.setBlockBoundsBasedOnState(
               tile.getLittleWorld(),
               (x << 3) + xSelected,
               (y << 3) + ySelected,
               (z << 3) + zSelected);
         }
         this.setBlockBounds(
             (float) (xSelected + block.getBlockBoundsMinX()) / m,
             (float) (ySelected + block.getBlockBoundsMinY()) / m,
             (float) (zSelected + block.getBlockBoundsMinZ()) / m,
             (float) (xSelected + block.getBlockBoundsMaxX()) / m,
             (float) (ySelected + block.getBlockBoundsMaxY()) / m,
             (float) (zSelected + block.getBlockBoundsMaxZ()) / m);
       }
     }
   }
 }
Пример #3
0
  /**
   * Spawn a digging particle effect in the world, this is a wrapper around
   * EffectRenderer.addBlockHitEffects to allow the block more control over the particles. Useful
   * when you have entirely different texture sheets for different sides/locations in the world.
   *
   * @param world The current world
   * @param target The target the player is looking at {x/y/z/side/sub}
   * @param effectRenderer A reference to the current effect renderer.
   * @return True to prevent vanilla digging particles form spawning.
   */
  @SideOnly(Side.CLIENT)
  @Override
  public boolean addBlockHitEffects(
      World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) {
    int x = target.blockX;
    int y = target.blockY;
    int z = target.blockZ;

    Pipe pipe = getPipe(worldObj, x, y, z);
    if (pipe == null) return false;

    Icon icon = pipe.getIconProvider().getIcon(pipe.getIconIndexForItem());

    int sideHit = target.sideHit;

    Block block = BuildCraftTransport.genericPipeBlock;
    float b = 0.1F;
    double px =
        x
            + rand.nextDouble()
                * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - (b * 2.0F))
            + b
            + block.getBlockBoundsMinX();
    double py =
        y
            + rand.nextDouble()
                * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - (b * 2.0F))
            + b
            + block.getBlockBoundsMinY();
    double pz =
        z
            + rand.nextDouble()
                * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - (b * 2.0F))
            + b
            + block.getBlockBoundsMinZ();

    if (sideHit == 0) {
      py = (double) y + block.getBlockBoundsMinY() - (double) b;
    }

    if (sideHit == 1) {
      py = (double) y + block.getBlockBoundsMaxY() + (double) b;
    }

    if (sideHit == 2) {
      pz = (double) z + block.getBlockBoundsMinZ() - (double) b;
    }

    if (sideHit == 3) {
      pz = (double) z + block.getBlockBoundsMaxZ() + (double) b;
    }

    if (sideHit == 4) {
      px = (double) x + block.getBlockBoundsMinX() - (double) b;
    }

    if (sideHit == 5) {
      px = (double) x + block.getBlockBoundsMaxX() + (double) b;
    }

    EntityDiggingFX fx =
        new EntityDiggingFX(
            worldObj,
            px,
            py,
            pz,
            0.0D,
            0.0D,
            0.0D,
            block,
            sideHit,
            worldObj.getBlockMetadata(x, y, z));
    fx.func_110125_a(icon);
    effectRenderer.addEffect(
        fx.applyColourMultiplier(x, y, z).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
    return true;
  }