Example #1
0
 private void sparkle(World world, int i, int j, int k) {
   Random random = world.rand;
   double d = 0.0625D;
   for (int l = 0; l < 6; l++) {
     double d1 = (float) i + random.nextFloat();
     double d2 = (float) j + random.nextFloat();
     double d3 = (float) k + random.nextFloat();
     if (l == 0 && !world.isBlockOpaqueCube(i, j + 1, k)) {
       d2 = (double) (j + 1) + d;
     }
     if (l == 1 && !world.isBlockOpaqueCube(i, j - 1, k)) {
       d2 = (double) (j + 0) - d;
     }
     if (l == 2 && !world.isBlockOpaqueCube(i, j, k + 1)) {
       d3 = (double) (k + 1) + d;
     }
     if (l == 3 && !world.isBlockOpaqueCube(i, j, k - 1)) {
       d3 = (double) (k + 0) - d;
     }
     if (l == 4 && !world.isBlockOpaqueCube(i + 1, j, k)) {
       d1 = (double) (i + 1) + d;
     }
     if (l == 5 && !world.isBlockOpaqueCube(i - 1, j, k)) {
       d1 = (double) (i + 0) - d;
     }
     if (d1 < (double) i
         || d1 > (double) (i + 1)
         || d2 < 0.0D
         || d2 > (double) (j + 1)
         || d3 < (double) k
         || d3 > (double) (k + 1)) {
       world.spawnParticle("reddust", d1, d2, d3, 0.0D, 0.0D, 0.0D);
     }
   }
 }
  @Override
  public void randomDisplayTick(World world, int i, int j, int k, Random random) {
    TileCandyMaker tile = (TileCandyMaker) world.getBlockTileEntity(i, j, k);

    if (!tile.canWork()) return;

    float f = (float) i + 0.5F;
    float f1 = (float) j + 0.0F + (random.nextFloat() * 6F) / 16F;
    float f2 = (float) k + 0.5F;
    float f3 = 0.52F;
    float f4 = random.nextFloat() * 0.6F - 0.3F;

    world.spawnParticle("reddust", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
    world.spawnParticle("reddust", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
    world.spawnParticle("reddust", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
    world.spawnParticle("reddust", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
  }
Example #3
0
  public void randomDisplayTick(World world, int i, int j, int k, Random random) {
    if ((world.isBlockNormalCube(i, j + 1, k) || world.isBlockNormalCube(i, j + 2, k))
        && ((((TileEntityPartial) world.getBlockTileEntity(i, j, k)).extraData >> 24) & 1) == 1
        && random.nextInt(80) == 0) {
      float f = (float) i + 0.5F;
      float f1 = (float) j - 0.08f;
      float f2 = (float) k + 0.5F;
      float f3 = 0.52F;

      float f4 = random.nextFloat() * 0.6F;
      float f5 = random.nextFloat() * -0.6F;
      float f6 = random.nextFloat() * -0.6F;
      world.spawnParticle("dripWater", f + f4 - 0.3F, f1, f2 + f5 + 0.3F, 0.0D, 0.0D, 0.0D);
    }
  }
 @Override
 public void randomDisplayTick(World world, int i, int j, int k, Random random) {
   if (random.nextInt(4) == 1 && mod_NWater.isBoiling(world, i, j, k)) {
     world.spawnParticle(
         "bubble",
         i + random.nextFloat(),
         j + random.nextFloat(),
         k + random.nextFloat(),
         (random.nextFloat() - 0.5F) / 10F,
         random.nextFloat() / 5F,
         (random.nextFloat() - 0.5F) / 10F);
   }
   if (blockMaterial == Material.water) {
     if (random.nextInt(64) != 0) ;
   }
 }
Example #5
0
  @Override
  @SideOnly(Side.CLIENT)
  public void randomDisplayTick(World world, int x, int y, int z, Random random) {
    TileEntityBasicMachine tileEntity = (TileEntityBasicMachine) world.getBlockTileEntity(x, y, z);
    if (isActive(world, x, y, z)) {
      float xRandom = (float) x + 0.5F;
      float yRandom = (float) y + 0.0F + random.nextFloat() * 6.0F / 16.0F;
      float zRandom = (float) z + 0.5F;
      float iRandom = 0.52F;
      float jRandom = random.nextFloat() * 0.6F - 0.3F;

      if (tileEntity.facing == 4) {
        world.spawnParticle(
            "smoke",
            (double) (xRandom - iRandom),
            (double) yRandom,
            (double) (zRandom + jRandom),
            0.0D,
            0.0D,
            0.0D);
        world.spawnParticle(
            "reddust",
            (double) (xRandom - iRandom),
            (double) yRandom,
            (double) (zRandom + jRandom),
            0.0D,
            0.0D,
            0.0D);
      } else if (tileEntity.facing == 5) {
        world.spawnParticle(
            "smoke",
            (double) (xRandom + iRandom),
            (double) yRandom,
            (double) (zRandom + jRandom),
            0.0D,
            0.0D,
            0.0D);
        world.spawnParticle(
            "reddust",
            (double) (xRandom + iRandom),
            (double) yRandom,
            (double) (zRandom + jRandom),
            0.0D,
            0.0D,
            0.0D);
      } else if (tileEntity.facing == 2) {
        world.spawnParticle(
            "smoke",
            (double) (xRandom + jRandom),
            (double) yRandom,
            (double) (zRandom - iRandom),
            0.0D,
            0.0D,
            0.0D);
        world.spawnParticle(
            "reddust",
            (double) (xRandom + jRandom),
            (double) yRandom,
            (double) (zRandom - iRandom),
            0.0D,
            0.0D,
            0.0D);
      } else if (tileEntity.facing == 3) {
        world.spawnParticle(
            "smoke",
            (double) (xRandom + jRandom),
            (double) yRandom,
            (double) (zRandom + iRandom),
            0.0D,
            0.0D,
            0.0D);
        world.spawnParticle(
            "reddust",
            (double) (xRandom + jRandom),
            (double) yRandom,
            (double) (zRandom + iRandom),
            0.0D,
            0.0D,
            0.0D);
      }
    }
  }
Example #6
0
  public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) {
    float var4 = 1.0F;
    double var5 = player.prevPosX + (player.posX - player.prevPosX) * (double) var4;
    double var7 =
        player.prevPosY
            + (player.posY - player.prevPosY) * (double) var4
            + 1.62D
            - (double) player.yOffset;
    double var9 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) var4;
    boolean var11 = this.isFull == 0;
    MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(world, player, var11);

    if (mop == null) {
      return itemstack;
    }
    if (mop.typeOfHit == EnumMovingObjectType.TILE) {
      int x = mop.blockX;
      int y = mop.blockY;
      int z = mop.blockZ;
      if (!world.canMineBlock(player, x, y, z)) {
        return itemstack;
      }
      if (isFull == 0) {
        int bID = world.getBlockId(x, y, z);
        if ((bID == Block.waterMoving.blockID || bID == Block.waterStill.blockID)
            && world.getBlockMetadata(x, y, z) == 0) {
          world.setBlockWithNotify(x, y, z, 0);
          return new ItemStack(mod_InfiTools.goldBucketWater);
        }
        if ((bID == Block.lavaMoving.blockID || bID == Block.lavaStill.blockID)
            && world.getBlockMetadata(x, y, z) == 0) {
          world.setBlockWithNotify(x, y, z, 0);
          return new ItemStack(mod_InfiTools.goldBucketLava);
        }
        if (bID == Block.sand.blockID) {
          world.setBlockWithNotify(x, y, z, 0);
          return new ItemStack(mod_InfiTools.goldBucketSand);
        }
        if (bID == Block.gravel.blockID) {
          world.setBlockWithNotify(x, y, z, 0);
          return new ItemStack(mod_InfiTools.goldBucketGravel);
        }
      } else {
        if (isFull < 0) {
          return new ItemStack(mod_InfiTools.goldBucketEmpty);
        }
        if (mop.sideHit == 0) {
          y--;
        }
        if (mop.sideHit == 1) {
          y++;
        }
        if (mop.sideHit == 2) {
          z--;
        }
        if (mop.sideHit == 3) {
          z++;
        }
        if (mop.sideHit == 4) {
          x--;
        }
        if (mop.sideHit == 5) {
          x++;
        }
        if (world.isAirBlock(x, y, z) || !world.getBlockMaterial(x, y, z).isSolid()) {
          if (world.worldProvider.isHellWorld && isFull == Block.waterMoving.blockID) {
            world.playSoundEffect(
                x + 0.5D,
                y + 0.5D,
                z + 0.5D,
                "random.fizz",
                0.5F,
                2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
            for (int l = 0; l < 8; l++) {
              world.spawnParticle(
                  "largesmoke",
                  (double) x + Math.random(),
                  (double) y + Math.random(),
                  (double) z + Math.random(),
                  0.0D,
                  0.0D,
                  0.0D);
            }
          } else {
            world.setBlockAndMetadataWithNotify(x, y, z, isFull, 0);
          }
          return new ItemStack(mod_InfiTools.goldBucketEmpty);
        }
      }
    } else if (isFull == 0 && (mop.entityHit instanceof EntityCow)) {
      return new ItemStack(mod_InfiTools.goldBucketMilk);
    }
    return itemstack;
  }