@Override
  public void updateEntity(World world, int x, int y, int z, int meta) {
    super.updateEntity(world, x, y, z, meta);

    if (!world.isRemote && this.getEnergy(CrystalElement.GREEN) >= 200) {
      int n = this.getNumberAttempts();
      for (int i = 0; i < n; i++) {
        Coordinate c = this.getRandomPosition(world, x, y, z);
        CropType crop = this.getCropAt(world, c);
        if (crop != null && crop.isRipe(world, c.xCoord, c.yCoord, c.zCoord)) {
          int fortune = this.getFortune();
          ArrayList<ItemStack> li = crop.getDrops(world, c.xCoord, c.yCoord, c.zCoord, fortune);
          if (fortune < 3) {
            CropMethods.removeOneSeed(crop, li);
          }
          ReikaItemHelper.dropItems(world, c.xCoord + 0.5, c.yCoord + 0.5, c.zCoord + 0.5, li);
          crop.setHarvested(world, c.xCoord, c.yCoord, c.zCoord);
          ReikaSoundHelper.playBreakSound(world, x, y, z, c.getBlock(world));
          this.drainEnergy(CrystalElement.GREEN, 200);
          this.drainEnergy(CrystalElement.PURPLE, 50);
          this.sendParticles(c);
          break;
        }
      }
    }
  }
 @Override
 public void overload(int current) {
   overloaded = true;
   ReikaSoundHelper.playBreakSound(worldObj, xCoord, yCoord, zCoord, Blocks.glass);
   ReikaSoundHelper.playSoundAtBlock(worldObj, xCoord, yCoord, zCoord, "random.fizz", 2, 1);
   ReikaPacketHelper.sendDataPacketWithRadius(
       DragonAPIInit.packetChannel, PacketIDs.COLOREDPARTICLE.ordinal(), this, 24, 1, 1, 1, 32, 0);
 }
 private void dropTieredResource(
     World world, int x, int y, int z, int dx, int dy, int dz, Block id, int meta2) {
   Collection<ItemStack> li =
       ((BlockTieredResource) id).getHarvestResources(world, dx, dy, dz, 10, this.getPlacer());
   this.dropItems(world, x, y, z, li);
   this.getFillerBlock(world, dx, dy, dz, id, meta2).place(world, dx, dy, dz);
   ReikaSoundHelper.playBreakSound(world, dx, dy, dz, id);
   ReikaPacketHelper.sendDataPacket(
       DragonAPIInit.packetChannel,
       PacketIDs.BREAKPARTICLES.ordinal(),
       world,
       dx,
       dy,
       dz,
       Block.getIdFromBlock(id),
       meta2);
 }
 private void dropBlock(
     World world, int x, int y, int z, int dx, int dy, int dz, Block id, int meta2) {
   if (this.silkTouch()) {
     this.dropItems(world, x, y, z, ReikaJavaLibrary.makeListFrom(new ItemStack(id, 1, meta2)));
   } else {
     this.dropItems(world, x, y, z, id.getDrops(world, dx, dy, dz, meta2, 0));
   }
   this.getFillerBlock(world, dx, dy, dz, id, meta2).place(world, dx, dy, dz);
   ReikaSoundHelper.playBreakSound(world, dx, dy, dz, id);
   ReikaPacketHelper.sendDataPacket(
       DragonAPIInit.packetChannel,
       PacketIDs.BREAKPARTICLES.ordinal(),
       world,
       dx,
       dy,
       dz,
       Block.getIdFromBlock(id),
       meta2);
 }
  private void cutBlock(World world, int x, int y, int z, Coordinate c, Material mat) {
    // ReikaItemHelper.dropItems(world, dropx, y-0.25, dropz, dropBlocks.getDrops(world, c.xCoord,
    // c.yCoord, c.zCoord, dropmeta, 0));
    this.dropBlocks(world, c.xCoord, c.yCoord, c.zCoord);
    c.setBlock(world, Blocks.air);
    ReikaSoundHelper.playBreakSound(world, c.xCoord, c.yCoord, c.zCoord, Blocks.log);

    if (mat == Material.leaves)
      world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "dig.grass", 0.5F + rand.nextFloat(), 1F);
    else world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "dig.wood", 0.5F + rand.nextFloat(), 1F);
    if (tree.getTreeType() == ModWoodList.SLIME
        && c.getBlock(world) == tree.getTreeType().getLogID()) {
      jam++;
      jamColor =
          0xff000000
              | ReikaColorAPI.mixColors(
                  ModWoodList.SLIME.logColor, 0xffffff, (float) jam / MAX_JAM);
    }
  }
 @Override
 public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int meta) {
   ForgeDirection dir = this.getDirectionFromMeta(meta);
   ForgeDirection left = ReikaDirectionHelper.getLeftBy90(dir);
   int r = 0; // some way to make bigger on demand...?
   int d = 64;
   for (int i = -r; i <= r; i++) {
     for (int j = -r; j <= r; j++) {
       for (int k = -d; k <= d; k++) {
         int dx = x + left.offsetX * i + dir.offsetX * k;
         int dy = y + j;
         int dz = z + left.offsetZ * i + dir.offsetZ * k;
         Block id = world.getBlock(dx, dy, dz);
         if (id == this) {
           ReikaSoundHelper.playBreakSound(world, dx, dy, dz, this);
           world.setBlockToAir(dx, dy, dz);
           world.markBlockForUpdate(dx, dy, dz);
         }
       }
     }
   }
 }
 public void grind(World world, int mx, int my, int mz, int x, int y, int z, int meta) {
   if (this.processBlock(world, x, y, z)) {
     if (this.isBedrock(world, x, y, z)) {
       world.playSoundEffect(
           x + 0.5D, y + 0.5D, z + 0.5D, "dig.stone", 0.5F, rand.nextFloat() * 0.4F + 0.8F);
       world.setBlock(x, y, z, BlockRegistry.BEDROCKSLICE.getBlockInstance(), 0, 3);
     } else {
       int rockmetadata = world.getBlockMetadata(x, y, z);
       if (rockmetadata < 15) {
         world.playSoundEffect(
             x + 0.5D, y + 0.5D, z + 0.5D, "dig.stone", 0.5F, rand.nextFloat() * 0.4F + 0.8F);
         world.setBlockMetadataWithNotify(x, y, z, rockmetadata + 1, 3);
       } else {
         world.playSoundEffect(
             x + 0.5D, y + 0.5D, z + 0.5D, "mob.blaze.hit", 0.5F, rand.nextFloat() * 0.4F + 0.8F);
         ItemStack is = this.getDrops(world, x, y, z);
         world.setBlockToAir(x, y, z);
         if (!this.chestCheck(world, x, y, z, is)) {
           if (this.isInventoryFull()) ReikaItemHelper.dropItem(world, dropx, dropy, dropz, is);
           else ReikaInventoryHelper.addOrSetStack(is, inv, 0);
         }
         RotaryAchievements.BEDROCKBREAKER.triggerAchievement(this.getPlacer());
         MinecraftForge.EVENT_BUS.post(new BedrockDigEvent(this, x, y, z));
         if (!world.isRemote) this.incrementStep(world, mx, my, mz);
       }
     }
   } else {
     Block b = world.getBlock(x, y, z);
     if (b != Blocks.air && b.getBlockHardness(world, x, y, z) >= 0) {
       ReikaSoundHelper.playBreakSound(world, x, y, z, b);
       if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
         ReikaRenderHelper.spawnDropParticles(world, x, y, z, b, world.getBlockMetadata(x, y, z));
       world.setBlockToAir(x, y, z);
     }
     if (!world.isRemote) this.incrementStep(world, mx, my, mz);
   }
 }