@Override
 public boolean onItemUse(
     ItemStack item,
     EntityPlayer player,
     World world,
     int x,
     int y,
     int z,
     int side,
     float par8,
     float par9,
     float par10) {
   if (!ReikaWorldHelper.softBlocks(world.getBlock(x, y, z))) {
     if (side == 0) --y;
     if (side == 1) ++y;
     if (side == 2) --z;
     if (side == 3) ++z;
     if (side == 4) --x;
     if (side == 5) ++x;
   }
   Block idbelow = world.getBlock(x, y - 1, z);
   if ((!ReikaWorldHelper.softBlocks(world.getBlock(x, y, z)))
       || !ReikaPlantHelper.SAPLING.canPlantAt(world, x, y, z)) return false;
   if (!player.canPlayerEdit(x, y, z, 0, item)) return false;
   else {
     if (!player.capabilities.isCreativeMode) --item.stackSize;
     world.setBlock(x, y, z, ChromaBlocks.PLANT.getBlockInstance(), item.getItemDamage() % 16, 3);
     ReikaSoundHelper.playPlaceSound(world, x, y, z, Blocks.grass);
     return true;
   }
 }
 private boolean checkAndBuildWorktable(World world, int x, int y, int z) {
   if (!ReikaWorldHelper.matchWithItemStack(world, x, y - 1, z, ItemStacks.steelblock))
     return false;
   if (world.getBlock(x, y - 2, z) != Blocks.redstone_block) return false;
   for (int i = -1; i <= 1; i++) {
     for (int k = -1; k <= 1; k++) {
       if (i != 0 || k != 0) {
         if (world.getBlock(x + i, y - 1, z + k) != Blocks.brick_block) return false;
         if (!ReikaWorldHelper.matchWithItemStack(
             world, x + i, y - 2, z + k, ReikaItemHelper.stoneDoubleSlab)) return false;
       }
     }
   }
   for (int i = -1; i <= 1; i++) {
     for (int k = -1; k <= 1; k++) {
       world.setBlock(x + i, y - 1, z + k, Blocks.air);
       world.setBlock(x + i, y - 2, z + k, Blocks.air);
     }
   }
   world.setBlock(x, y, z, Blocks.air);
   SoundRegistry.CRAFT.playSoundAtBlock(world, x, y, z);
   world.setBlock(
       x,
       y - 2,
       z,
       MachineRegistry.WORKTABLE.getBlock(),
       MachineRegistry.WORKTABLE.getMachineMetadata(),
       3);
   return true;
 }
 public void destroy(World world, int x, int y, int z) {
   tickcount++;
   int n = 8;
   int count = 32;
   double rx = x + 0.5 + rand.nextInt(2 * n + 1) - n;
   double ry = y + 0.5 + rand.nextInt(2 * n + 1) - n;
   double rz = z + 0.5 + rand.nextInt(2 * n + 1) - n;
   world.createExplosion(null, rx, ry, rz, 4F, tickcount > count);
   for (int i = 0; i < 32; i++)
     world.spawnParticle(
         "lava",
         rx + rand.nextInt(7) - 3,
         ry + rand.nextInt(7) - 3,
         rz + rand.nextInt(7) - 3,
         0,
         0,
         0);
   if (tickcount > count) {
     world.newExplosion(null, x + 0.5, y + 0.5, z + 0.5, 12F, true, true);
     ReikaWorldHelper.temperatureEnvironment(world, x, y, z, 1000);
   } /*
     EntityCreeper e = new EntityCreeper(world);
     e.posX = rx;
     e.posZ = rz;
     e.posY = world.getTopSolidOrLiquidBlock((int)rx, (int)rz)+1;
     e.addPotionEffect(new PotionEffect(Potion.resistance.id, 10, 10));
     world.spawnEntityInWorld(e);*/
 }
 private Block getAffectedID(Block id, int meta) {
   if (id == Blocks.air) return Blocks.air;
   if (id == Blocks.sand) return Blocks.glass;
   if (id == Blocks.stone || id == Blocks.stonebrick || id == Blocks.sandstone)
     return Blocks.flowing_lava;
   if (id == Blocks.grass || id == Blocks.mycelium) return Blocks.dirt;
   if (id == Blocks.dirt || id == Blocks.farmland) return Blocks.sand;
   if (id == Blocks.cobblestone) return Blocks.flowing_lava;
   if (id == Blocks.gravel) return Blocks.cobblestone;
   if (id == Blocks.gravel) return Blocks.cobblestone;
   if (id == Blocks.tallgrass
       || id == Blocks.web
       || id == Blocks.yellow_flower
       || id == Blocks.snow
       || id == Blocks.red_flower
       || id == Blocks.red_mushroom
       || id == Blocks.brown_mushroom
       || id == Blocks.deadbush
       || id == Blocks.wheat
       || id == Blocks.carrots
       || id == Blocks.potatoes
       || id == Blocks.vine
       || id == Blocks.melon_stem
       || id == Blocks.pumpkin_stem
       || id == Blocks.waterlily) return Blocks.air;
   if (ReikaWorldHelper.flammable(id)) return Blocks.fire;
   if (id == Blocks.ice || id == Blocks.snow) return Blocks.flowing_water;
   return id;
 }
  public boolean canConnect(int x, int y, int z) {
    int dx = x - xCoord;
    int dy = y - yCoord;
    int dz = z - zCoord;

    // ReikaJavaLibrary.pConsole(isEmitting ? Arrays.toString(source) : Arrays.toString(target));

    if (!ReikaMathLibrary.nBoolsAreTrue(1, dx != 0, dy != 0, dz != 0)) return false;

    ForgeDirection dir = ForgeDirection.UNKNOWN;

    if (dx > 0) dir = ForgeDirection.EAST;
    if (dx < 0) dir = ForgeDirection.WEST;
    if (dy > 0) dir = ForgeDirection.UP;
    if (dy < 0) dir = ForgeDirection.DOWN;
    if (dz > 0) dir = ForgeDirection.SOUTH;
    if (dz < 0) dir = ForgeDirection.NORTH;

    if (dir == null) return false;
    if (!this.isValidDirection(dir)) return false;

    for (int i = 1; i < Math.abs(dx + dy + dz); i++) {
      int xi = xCoord + dir.offsetX * i;
      int yi = yCoord + dir.offsetY * i;
      int zi = zCoord + dir.offsetZ * i;
      int id = worldObj.getBlockId(xi, yi, zi);
      // ReikaJavaLibrary.pConsole(xi+", "+yi+", "+zi+" -> "+id, Side.SERVER);
      if (!ReikaWorldHelper.softBlocks(worldObj, xi, yi, zi)) {
        return false;
      }
    }
    return true;
  }
  @Override
  public void updateEntity(World world, int x, int y, int z, int meta) {
    super.updateTileEntity();
    this.getIOSides(world, x, y, z, meta);

    if ((world.getWorldTime() & 31) == 0) ReikaWorldHelper.causeAdjacentUpdates(world, x, y, z);

    // ReikaJavaLibrary.pConsole(storedEnergy+":"+this.getConsumedUnitsPerTick(), Side.SERVER);
    if (!this.hasEnoughEnergy()) {
      torque = 0;
      omega = 0;
      power = 0;
      // storedEnergy = 0;
    } else {
      if (!world.isRemote) {
        torque = this.getTorque();
        omega = this.getSpeed();

        power = (long) torque * (long) omega;

        storedEnergy -= this.getConsumedUnitsPerTick();

        tickcount++;
        if (power > 0) {
          if (tickcount >= 85) {
            tickcount = 0;
            SoundRegistry.DYNAMO.playSoundAtBlock(world, x, y, z, 0.5F, 1F);
          }
        }
      }
    }
    this.basicPowerReceiver();
  }
 @Override
 protected double[] getTarget(World world, int x, int y, int z) {
   double[] xyzb = new double[4];
   int r = this.getRange();
   AxisAlignedBB box =
       AxisAlignedBB.getBoundingBox(x - r, y - r, z - r, x + 1 + r, y + 1 + r, z + 1 + r);
   List<Entity> inrange = world.getEntitiesWithinAABB(Entity.class, box);
   double mindist = this.getRange() + 2;
   Entity i_at_min = null;
   for (Entity ent : inrange) {
     double dist =
         ReikaMathLibrary.py3d(ent.posX - x - 0.5, ent.posY - y - 0.5, ent.posZ - z - 0.5);
     if (this.isValidTarget(ent)) {
       if (ReikaWorldHelper.canBlockSee(
           world, x, y, z, ent.posX, ent.posY, ent.posZ, this.getRange())) {
         double dy = -(ent.posY - y);
         double reqtheta = -90 + Math.toDegrees(Math.abs(Math.acos(dy / dist)));
         if ((reqtheta <= dir * MAXLOWANGLE && dir == -1)
             || (reqtheta >= dir * MAXLOWANGLE && dir == 1)) {
           if (dist < mindist) {
             mindist = dist;
             i_at_min = ent;
           }
         }
       }
     }
   }
   if (i_at_min == null) return xyzb;
   closestMob = i_at_min;
   xyzb[0] = closestMob.posX + this.randomOffset();
   xyzb[1] = closestMob.posY + closestMob.getEyeHeight() * 0.25 + this.randomOffset();
   xyzb[2] = closestMob.posZ + this.randomOffset();
   xyzb[3] = 1;
   return xyzb;
 }
 private void fire(ItemStack is, World world, EntityPlayer ep, Entity ent) {
   Vec3 look = ep.getLookVec();
   double[] looks = ReikaVectorHelper.getPlayerLookCoords(ep, 2);
   if (!(ent instanceof EntityPlayer) && ReikaWorldHelper.lineOfSight(world, ep, ent)) {
     ItemStack fl = new ItemStack(Item.flint.itemID, 0, 0);
     EntityItem ei =
         new EntityItem(
             world,
             looks[0] / look.lengthVector(),
             looks[1] / look.lengthVector(),
             looks[2] / look.lengthVector(),
             fl);
     ei.delayBeforeCanPickup = 100;
     ei.motionX = look.xCoord / look.lengthVector();
     ei.motionY = look.yCoord / look.lengthVector();
     ei.motionZ = look.zCoord / look.lengthVector();
     if (!world.isRemote) ei.velocityChanged = true;
     if (!world.isRemote) world.playSoundAtEntity(ep, "dig.gravel", 1.5F, 2F);
     world.spawnEntityInWorld(ei);
     if (is.getItemDamage() > 4096) { // approx the 1-hit kill of a 10-heart mob
       ReikaParticleHelper.EXPLODE.spawnAt(world, ent.posX, ent.posY, ent.posZ);
       world.playSoundAtEntity(ent, "random.explode", 1, 1);
     }
     ent.attackEntityFrom(DamageSource.causePlayerDamage(ep), this.getAttackDamage(is));
     ReikaEntityHelper.knockbackEntity(ep, ent, 0.4);
     // ent.setRevengeTarget(ep);
   }
 }
  @Override
  public void updateTemperature(World world, int x, int y, int z, int meta) {
    int Tamb = ReikaWorldHelper.getAmbientTemperatureAt(world, x, y, z);
    if (ReikaWorldHelper.checkForAdjBlock(world, x, y, z, Blocks.snow) != null) Tamb -= 5;
    if (RotaryAux.isNextToWater(world, x, y, z)) Tamb -= 15;
    if (RotaryAux.isNextToIce(world, x, y, z)) Tamb -= 30;

    ItemStack cryo =
        GameRegistry.findItemStack(ModList.THERMALFOUNDATION.modLabel, "dustCryotheum", 1);
    if (ReikaItemHelper.matchStacks(ItemStacks.dryice, inv[1])
        || (cryo != null && ReikaItemHelper.matchStacks(cryo, inv[1]))) {
      Tamb -= 40;
      if (temperature > Tamb + 4 || rand.nextInt(20) == 0) ReikaInventoryHelper.decrStack(1, inv);
    }

    int dT = Tamb - temperature;
    temperature += dT / 4;
  }
  @Override
  public void updateEntity(World world, int x, int y, int z, int meta) {
    super.updateTileEntity();
    int temp = (int) (15 * this.getArraySize() * this.getArrayOverallBrightness());
    for (int i = -3; i <= 3; i++) {
      for (int j = -3; j <= 3; j++) {
        if (ConfigRegistry.BLOCKDAMAGE.getState()) {
          ReikaWorldHelper.temperatureEnvironment(world, x + i, y + 1, z + j, Math.min(temp, 1750));
          if (temp >= 1500) {
            this.delete();
            world.setBlock(x, y, z, Blocks.flowing_lava);
          }
        }
        AxisAlignedBB above =
            AxisAlignedBB.getBoundingBox(x + i, y + 1, z + j, x + i + 1, y + 2, z + j + 1);
        List<EntityLivingBase> in = world.getEntitiesWithinAABB(EntityLivingBase.class, above);
        for (EntityLivingBase e : in) {
          if (temp > 400) e.setFire(3);
        }
      }
    }
    if (world.getBlock(x, y - 1, z) == Blocks.air
        || MachineRegistry.getMachine(world, x, y - 1, z) != this.getMachine()) {
      // ReikaJavaLibrary.pConsole("TOWER: "+this.getTowerHeight()+";  SIZE: "+this.getArraySize());
      this.generatePower(world, x, y, z);
    } else {
      write = null;
    }
    if (world.getBlock(x, y + 1, z) != Blocks.air) return;

    mirrorTimer.update();
    if (mirrorTimer.checkCap()) {
      if (solarBlocks.isEmpty()) {
        lightMultiplier = 0;
        solarBlocks.recursiveAdd(world, x, y, z, this.getTileEntityBlockID());
        numberMirrors = solarBlocks.getSize();
        while (solarBlocks.getSize() > 0) {
          Coordinate c = solarBlocks.getNextAndMoveOn();
          MachineRegistry m = MachineRegistry.getMachine(world, c.xCoord, c.yCoord, c.zCoord);
          if (m == MachineRegistry.MIRROR) {
            TileEntityMirror te =
                (TileEntityMirror) world.getTileEntity(c.xCoord, c.yCoord, c.zCoord);
            te.targetloc = new Coordinate(x, y, z);
            float light = te.getLightLevel();
            lightMultiplier += light;
          } else numberMirrors--;
        }
        lightMultiplier /= 15F;
        lightMultiplier /= numberMirrors;
      }
    }

    if (write != null) {
      this.basicPowerReceiver();
    }
  }
  @Override
  protected void updateTemperature(World world, int x, int y, int z) {
    super.updateTemperature(world, x, y, z);
    int Tamb = ReikaBiomeHelper.getBiomeTemp(world, x, z);
    int dT = temperature - Tamb;

    if (dT != 0 && ReikaWorldHelper.checkForAdjBlock(world, x, y, z, 0) != null)
      temperature -= (1 + dT / 32);

    if (dT > 0) {
      for (int i = 2; i < 6; i++) {
        ForgeDirection dir = dirs[i];
        int dx = x + dir.offsetX;
        int dy = y + dir.offsetY;
        int dz = z + dir.offsetZ;
        int id = world.getBlockId(dx, dy, dz);
        int meta = world.getBlockMetadata(dx, dy, dz);
        if (id == ReactorTiles.COOLANT.getBlockID()
            && meta == ReactorTiles.COOLANT.getBlockMetadata()) {
          TileEntityWaterCell te = (TileEntityWaterCell) world.getBlockTileEntity(dx, dy, dz);
          if (te.getLiquidState().isWater()
              && temperature >= 100
              && ReikaRandomHelper.doWithChance(40)) {
            te.setLiquidState(LiquidStates.EMPTY);
            temperature -= 20;
          }
        }
        if (id == this.getTileEntityBlockID()
            && meta == ReactorTiles.TEList[this.getIndex()].getBlockMetadata()) {
          TileEntityNuclearCore te = (TileEntityNuclearCore) world.getBlockTileEntity(dx, dy, dz);
          int dTemp = temperature - te.temperature;
          if (dTemp > 0) {
            temperature -= dTemp / 16;
            te.temperature += dTemp / 16;
          }
        }
      }
    }

    if (hydrogen > 0) hydrogen--;

    if (temperature >= 500) {
      ReactorAchievements.HOTCORE.triggerAchievement(this.getPlacer());
    }

    if (temperature > this.getMaxTemperature()) {
      this.onMeltdown(world, x, y, z);
      ReactorAchievements.MELTDOWN.triggerAchievement(this.getPlacer());
    }
    if (temperature > HYDROGEN) {
      hydrogen += 1;
      if (hydrogen > 200) {
        this.onMeltdown(world, x, y, z);
      }
    }
  }
 private Extraction getExtraction(World world, int x, int y, int z) {
   Fluid f = null;
   int c = 0;
   for (int i = 2; i < 6; i++) {
     ForgeDirection dir = dirs[i];
     int dx = x + dir.offsetX;
     int dz = z + dir.offsetZ;
     Fluid f2 = ReikaWorldHelper.getFluid(world, dx, y, dz);
     if (f2 != null && ReikaWorldHelper.isLiquidSourceBlock(world, dx, y, dz)) {
       if (f == null || f2 == f) {
         c++;
         f = f2;
       } else {
         return null;
       }
     }
   }
   return f != null && c >= 3 ? extractions.get(f) : null;
 }
 @Override
 public ArrayList<ItemStack> getDrops(
     World world, int x, int y, int z, int metadata, int fortune) {
   ArrayList<ItemStack> li = new ArrayList<ItemStack>();
   int count = this.getNumberDrops(fortune);
   for (int i = 0; i < count; i++)
     li.add(ReactorItems.FLUORITE.getStackOfMetadata(this.getMetaDropped(metadata)));
   ReikaWorldHelper.splitAndSpawnXP(world, x + 0.5F, y + 0.5F, z + 0.5F, this.droppedXP());
   return li;
 }
 private void dropSpecialOreBlock(
     World world, int x, int y, int z, int dx, int dy, int dz, SpecialOreBlock id, int meta2) {
   if (this.silkTouch()) {
     this.dropItems(
         world, x, y, z, ReikaJavaLibrary.makeListFrom(id.getSilkTouchVersion(world, dx, dy, dz)));
   } else {
     this.dropItems(world, x, y, z, id.getDrops(world, dx, dy, dz, 0));
   }
   ReikaWorldHelper.setBlock(world, dx, dy, dz, id.getReplacementBlock(world, dx, dy, dz));
 }
Exemple #15
0
  @Override
  public final void updateEntity(World world, int x, int y, int z, int meta) {
    super.updateEntity(world, x, y, z, meta);

    // if (ModList.BCFACTORY.isLoaded() && ModList.REACTORCRAFT.isLoaded()) { //Only if, since need
    // a way to pipe it
    if (this.contains(FluidRegistry.getFluid("uranium hexafluoride"))
        || this.contains(FluidRegistry.getFluid("hydrofluoric acid"))) {
      ReikaSoundHelper.playSoundAtBlock(world, x, y, z, "random.fizz");
      for (int i = 0; i < 6; i++) {
        ForgeDirection dir = dirs[i];
        int dx = x + dir.offsetX;
        int dy = y + dir.offsetY;
        int dz = z + dir.offsetZ;
        MachineRegistry m = MachineRegistry.getMachine(world, dx, dy, dz);
        if (m == MachineRegistry.PIPE) {
          TileEntityPipe p = (TileEntityPipe) world.getTileEntity(dx, dy, dz);
          p.setFluid(liquid);
          p.addFluid(5);
          // ReikaParticleHelper.SMOKE.spawnAroundBlock(world, dx, dy, dz, 8);
        }
      }
      world.setBlockToAir(x, y, z);
      ReikaParticleHelper.SMOKE.spawnAroundBlock(world, x, y, z, 8);
    }
    // }

    if (rand.nextInt(60) == 0) {
      ReikaWorldHelper.temperatureEnvironment(world, x, y, z, this.getTemperature());
    }

    if (liquid != null) {
      int temp = liquid.getTemperature(worldObj, xCoord, yCoord, zCoord);
      temperature = temp > 750 ? temp - 425 : temp - 273;
      if (temperature > this.getMaxTemperature()) {
        this.overheat(worldObj, xCoord, yCoord, zCoord);
      }
    } else {
      temperature = ReikaWorldHelper.getAmbientTemperatureAt(world, x, y, z);
    }
  }
 private Coordinate getRandomPosition(World world, int x, int y, int z) {
   ForgeDirection dir = this.getFacing();
   ForgeDirection left = ReikaDirectionHelper.getLeftBy90(dir);
   int r = rand.nextInt(16);
   int sp = ReikaRandomHelper.getRandomPlusMinus(0, r); // r/2
   int dx = x + r * dir.offsetX + sp * left.offsetX; // ReikaRandomHelper.getRandomPlusMinus(x, r);
   int dz = z + r * dir.offsetZ + sp * left.offsetZ; // ReikaRandomHelper.getRandomPlusMinus(z, r);
   int dy =
       ReikaWorldHelper.findTopBlockBelowY(
           world, dx, y, dz); // Math.min(y, world.getTopSolidOrLiquidBlock(x, z));
   return new Coordinate(dx, dy, dz);
 }
  private void fightEerie(World world, int x, int y, int z) {
    int rx = ReikaRandomHelper.getRandomPlusMinus(x, 32);
    int rz = ReikaRandomHelper.getRandomPlusMinus(z, 32);

    if (world.checkChunksExist(rx, 0, rz, rx, 255, rz)) {
      int r = 3;
      for (int i = -r; i <= r; i++) {
        for (int k = -r; k <= r; k++) {
          int dx = rx + i;
          int dz = rz + k;
          BiomeGenBase biome = world.getBiomeGenForCoords(dx, dz);
          int id = biome.biomeID;
          if (id == ThaumBlockHandler.getInstance().eerieBiomeID) {
            BiomeGenBase natural = ReikaWorldHelper.getNaturalGennedBiomeAt(world, dx, dz);
            if (natural != null) {
              ReikaWorldHelper.setBiomeForXZ(world, dx, dz, natural);
            }
          }
        }
      }
    }
  }
  private void convertPureNodeMagic(World world, int x, int y, int z) {
    int rx = ReikaRandomHelper.getRandomPlusMinus(x, 64);
    int rz = ReikaRandomHelper.getRandomPlusMinus(z, 64);

    if (world.checkChunksExist(rx, 0, rz, rx, 255, rz)) {
      int r = 3;
      for (int i = -r; i <= r; i++) {
        for (int k = -r; k <= r; k++) {
          int dx = rx + i;
          int dz = rz + k;
          BiomeGenBase biome = world.getBiomeGenForCoords(dx, dz);
          int id = biome.biomeID;
          if (id == ThaumBlockHandler.getInstance().magicBiomeID) {
            BiomeGenBase natural = ReikaWorldHelper.getNaturalGennedBiomeAt(world, dx, dz);
            if (natural != null && DyeTrees.isRainbowForest(natural)) {
              ReikaWorldHelper.setBiomeForXZ(world, dx, dz, natural);
            }
          }
        }
      }
    }
  }
 private void sickenMobs(World world, int x, int y, int z) {
   int r = this.getRange();
   AxisAlignedBB box = ReikaAABBHelper.getBlockAABB(x, y, z).expand(r, r, r);
   List<EntityLivingBase> li = world.getEntitiesWithinAABB(EntityLivingBase.class, box);
   for (EntityLivingBase e : li) {
     if (!RadiationEffects.instance.hasHazmatSuit(e)) {
       double dd = ReikaMathLibrary.py3d(e.posX - x - 0.5, e.posY - y - 0.5, e.posZ - z - 0.5);
       if (ReikaWorldHelper.canBlockSee(world, x, y, z, e.posX, e.posY, e.posZ, dd)) {
         RadiationEffects.instance.applyEffects(e, RadiationIntensity.LOWLEVEL);
       }
     }
   }
 }
 private void incrementStep(World world, int x, int y, int z) {
   int max = step + 1;
   for (int i = 1; i < max; i++) {
     int dx = x + i * facing.offsetX;
     int dy = y + i * facing.offsetY;
     int dz = z + i * facing.offsetZ;
     // ReikaJavaLibrary.pConsole(step+"; "+i+" @ "+dx+","+dy+","+dz+" : "+world.getBlock(dx, dy,
     // dz), Side.SERVER);
     if (!ReikaWorldHelper.softBlocks(world, dx, dy, dz)) {
       step = i;
       return;
     }
   }
   step = max;
 }
 @Override
 public void updateTemperature(World world, int x, int y, int z, int meta) {
   int Tamb = ReikaWorldHelper.getAmbientTemperatureAt(world, x, y, z);
   if (power > 0) {
     temperature += ReikaMathLibrary.logbase(power, 2);
   }
   if (temperature > Tamb) {
     temperature -= (temperature - Tamb) / 64;
   } else {
     temperature += (temperature - Tamb) / 64;
   }
   if (temperature - Tamb <= 64 && temperature > Tamb) temperature--;
   if (temperature > MAXTEMP) {
     temperature = MAXTEMP;
     this.overheat(world, x, y, z);
   }
   if (temperature > 50) {
     ForgeDirection side = ReikaWorldHelper.checkForAdjBlock(world, x, y, z, Blocks.snow);
     if (side != null) ReikaWorldHelper.changeAdjBlock(world, x, y, z, side, Blocks.air, 0);
     side = ReikaWorldHelper.checkForAdjBlock(world, x, y, z, Blocks.ice);
     if (side != null)
       ReikaWorldHelper.changeAdjBlock(world, x, y, z, side, Blocks.flowing_water, 0);
   }
 }
  private void convertToRainbowForest(World world, int x, int y, int z) {
    int rx = ReikaRandomHelper.getRandomPlusMinus(x, 32);
    int rz = ReikaRandomHelper.getRandomPlusMinus(z, 32);

    if (world.checkChunksExist(rx, 0, rz, rx, 255, rz)) {
      int r = 3;
      for (int i = -r; i <= r; i++) {
        for (int k = -r; k <= r; k++) {
          int dx = rx + i;
          int dz = rz + k;
          BiomeGenBase biome = world.getBiomeGenForCoords(dx, dz);
          int id = biome.biomeID;
          if (id != DyeTrees.forest.biomeID) {
            ReikaWorldHelper.setBiomeForXZ(world, dx, dz, DyeTrees.forest);
          }
        }
      }
    }
  }
  @Override
  public void updateEntity(World world, int x, int y, int z, int meta) {
    if (rand.nextInt(20) == 0) this.sickenMobs(world, x, y, z);

    this.decayWaste(this.getAccelerationFactor(world, x, y, z));

    if (!world.isRemote) this.feed();

    if (world.provider.isHellWorld
        || ReikaWorldHelper.getAmbientTemperatureAt(world, x, y, z) > 100) {
      if (this.hasWaste()) {
        ReikaParticleHelper.SMOKE.spawnAroundBlock(world, x, y, z, 3);
        if (rand.nextInt(4) == 0) ReikaSoundHelper.playSoundAtBlock(world, x, y, z, "random.fizz");
        if (rand.nextInt(200) == 0) {
          world.setBlockToAir(x, y, z);
          world.newExplosion(null, x + 0.5, y + 0.5, y + 0.5, 4F, true, true);
        }
      }
    }
  }
  @Override
  public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer ep) {
    if (!world.isRemote && this.getWater(is) < CAPACITY) {
      MovingObjectPosition mov = ReikaPlayerAPI.getLookedAtBlock(ep, 5, true);
      if (mov != null) {
        int x = mov.blockX;
        int y = mov.blockY;
        int z = mov.blockZ;
        Block id = world.getBlock(x, y, z);
        if (id == Blocks.water && ReikaWorldHelper.isLiquidSourceBlock(world, x, y, z)) {
          this.addWater(is, 1000);
          world.setBlock(x, y, z, Blocks.air);
          return is;
        }
      }
    }

    ep.setItemInUse(is, this.getMaxItemUseDuration(is));

    return is;
  }
  protected void updateTemperature(World world, int x, int y, int z) {
    // ReikaJavaLibrary.pConsole(temperature, Side.SERVER);
    int Tamb = ReikaWorldHelper.getAmbientTemperatureAt(world, x, y, z);
    int dT = Tamb - temperature;
    if (dT != 0) {
      int d = ReikaWorldHelper.isExposedToAir(world, x, y, z) ? 32 : 64;
      int diff = (1 + dT / d);
      if (diff <= 1) diff = dT / Math.abs(dT);
      temperature += diff;
    }

    ReikaWorldHelper.temperatureEnvironment(world, x, y, z, Math.min(temperature, 1000));

    if (this instanceof TileEntityReactorBoiler && temperature >= 300 && Tamb > 100) {
      if (!((TileEntityReactorBoiler) this).tank.isEmpty()) {
        world.setBlockToAir(x, y, z);
        world.createExplosion(null, x + 0.5, y + 0.5, z + 0.5, 3F, true);
      }
    }

    ReactorTiles src = this.getMachine();
    for (int i = 0; i < 6; i++) {
      ForgeDirection dir = dirs[i];
      int dx = x + dir.offsetX;
      int dy = y + dir.offsetY;
      int dz = z + dir.offsetZ;
      ReactorTiles r = ReactorTiles.getTE(world, dx, dy, dz);
      if (r != null) {
        TileEntityReactorBase te = (TileEntityReactorBase) world.getTileEntity(dx, dy, dz);
        if (te instanceof Temperatured) {
          int Tamb_loc = ReikaWorldHelper.getAmbientTemperatureAt(world, dx, dy, dz);

          Temperatured tr = (Temperatured) te;
          boolean flag = true; /*
					if (src == ReactorTiles.COOLANT) {
						TileEntityWaterCell wc = (TileEntityWaterCell)this;
						flag = tr.canDumpHeatInto(wc.getLiquidState());
					}*/
          if (tr instanceof TileEntityNuclearCore) flag = true;
          if (flag) {
            int T = tr.getTemperature();
            dT =
                (T - temperature)
                    - Math.max(
                        0,
                        (Tamb
                            - Tamb_loc)); // if Tamb here is > Tamb there, subtract that difference
            // to avoid exploits
            if (dT > 0) {
              int newT = T - dT / 4;
              // ReikaJavaLibrary.pConsole(temperature+":"+T+"
              // "+this.getTEName()+":"+te.getTEName()+"->"+(temperature+dT/4D)+":"+newT, this
              // instanceof TileEntityWaterCell &&
              // FMLCommonHandler.instance().getEffectiveSide()==Side.SERVER);
              temperature += dT / 4;
              tr.setTemperature(newT);
            }
          }
        }
        if (r == ReactorTiles.CO2HEATER || r == ReactorTiles.PEBBLEBED) {
          if (src.getReactorType() != ReactorType.HTGR && temperature > Tamb) {
            temperature -= Math.max(1, (temperature - Tamb) / 2);
          }
        }
      }
    }
  }
 public boolean makeBeam(
     World world, int x, int y, int z, int metadata, int step, int id, int maxdist) {
   boolean value = false;
   if (ConfigRegistry.BLOCKDAMAGE.getState()) {
     if (id == Block.stone.blockID
         || id == Block.cobblestone.blockID
         || id == Block.stoneBrick.blockID
         || id == Block.sandStone.blockID) {
       int chance = (int) ((power - MINPOWER) / (1024 * step * 32));
       chance = ReikaMathLibrary.extrema(chance, 1, "max");
       if (rand.nextInt(chance) != 0)
         if (rand.nextInt(step) == 0)
           ReikaWorldHelper.legacySetBlockWithNotify(
               world,
               x + step * xstep,
               y + step * ystep,
               z + step * zstep,
               Block.lavaMoving.blockID);
       world.spawnParticle(
           "lava",
           x + step * xstep + rand.nextFloat(),
           y + step * ystep + rand.nextFloat(),
           z + step * zstep + rand.nextFloat(),
           0,
           0,
           0);
     }
     if (id == Block.sand.blockID) {
       int chance = (int) ((power - MINPOWER) / (1024 * step * 16));
       chance = ReikaMathLibrary.extrema(chance, 1, "max");
       if (rand.nextInt(chance) != 0)
         if (rand.nextInt(step) == 0)
           ReikaWorldHelper.legacySetBlockWithNotify(
               world, x + step * xstep, y + step * ystep, z + step * zstep, Block.glass.blockID);
     }
     if (id == Block.gravel.blockID) {
       int chance = (int) ((power - MINPOWER) / (1024 * step * 16));
       chance = ReikaMathLibrary.extrema(chance, 1, "max");
       if (rand.nextInt(chance) != 0)
         if (rand.nextInt(step) == 0)
           ReikaWorldHelper.legacySetBlockWithNotify(
               world,
               x + step * xstep,
               y + step * ystep,
               z + step * zstep,
               Block.cobblestone.blockID);
     } /*
       if (id == Block.netherrack.blockID) {
       	if (world.getBlockId(x+step*xstep, 1+y+step*ystep, z+step*zstep) == 0) {
       		ReikaWorldHelper.legacySetBlockWithNotify(world, x+step*xstep, 1+y+step*ystep, z+step*zstep, Block.fire.blockID);
       	}
       }*/
     if (id == Block.netherrack.blockID && tickcount >= 6) {
       world.newExplosion(
           null,
           x + step * xstep + 0.5,
           y + step * ystep + 0.5,
           z + step * zstep + 0.5,
           3F,
           true,
           true);
       if (step >= 500) RotaryAchievements.NETHERHEATRAY.triggerAchievement(this.getPlacer());
       step = maxdist;
       value = true;
     }
     if (id == Block.dirt.blockID || id == Block.tilledField.blockID) {
       int chance = (int) ((power - MINPOWER) / (1024 * step * 16));
       chance = ReikaMathLibrary.extrema(chance, 1, "max");
       if (rand.nextInt(chance) != 0)
         if (rand.nextInt(step) == 0)
           ReikaWorldHelper.legacySetBlockWithNotify(
               world, x + step * xstep, y + step * ystep, z + step * zstep, Block.sand.blockID);
     }
     if (id == Block.grass.blockID || id == Block.mycelium.blockID) {
       int chance = (int) ((power - MINPOWER) / (1024 * step * 16));
       chance = ReikaMathLibrary.extrema(chance, 1, "max");
       if (rand.nextInt(chance) != 0)
         if (rand.nextInt(step) == 0)
           ReikaWorldHelper.legacySetBlockWithNotify(
               world, x + step * xstep, y + step * ystep, z + step * zstep, Block.dirt.blockID);
     }
     if (id == Block.ice.blockID || id == Block.blockSnow.blockID) {
       int chance = (int) ((power - MINPOWER) / (1024 * step * 4));
       chance = ReikaMathLibrary.extrema(chance, 1, "max");
       if (rand.nextInt(chance) != 0)
         if (rand.nextInt(step) == 0)
           ReikaWorldHelper.legacySetBlockWithNotify(
               world,
               x + step * xstep,
               y + step * ystep,
               z + step * zstep,
               Block.waterMoving.blockID);
     }
     if (id == Block.tallGrass.blockID
         || id == Block.web.blockID
         || id == Block.plantYellow.blockID
         || id == Block.snow.blockID
         || id == Block.plantRed.blockID
         || id == Block.mushroomRed.blockID
         || id == Block.mushroomBrown.blockID
         || id == Block.deadBush.blockID
         || id == Block.crops.blockID
         || id == 142
         || id == 141
         || id == Block.vine.blockID
         || id == Block.melonStem.blockID
         || id == Block.pumpkinStem.blockID
         || id == Block.waterlily.blockID) {
       int chance = (int) ((power - MINPOWER) / (1024 * step * 2));
       chance = ReikaMathLibrary.extrema(chance, 1, "max");
       if (rand.nextInt(chance) != 0)
         if (rand.nextInt(step) == 0) {
           ReikaWorldHelper.legacySetBlockWithNotify(
               world, x + step * xstep, y + step * ystep, z + step * zstep, 0);
           if (id == Block.snow.blockID)
             world.playSoundEffect(
                 x + step * xstep + 0.5D,
                 y + step * ystep + 0.5D,
                 z + step * zstep + 0.5D,
                 "random.fizz",
                 0.5F,
                 2.6F + (rand.nextFloat() - rand.nextFloat()) * 0.8F);
         }
     }
     if (id == Block.waterMoving.blockID || id == Block.waterStill.blockID) {
       // ModLoader.getMinecraftInstance().thePlayer.addChatMessage(String.format("%d", id));
       int chance = (int) ((power - MINPOWER) / (1024 * step * 2));
       chance = ReikaMathLibrary.extrema(chance, 1, "max");
       if (rand.nextInt(chance) != 0)
         if (rand.nextInt(step) == 0) {
           ReikaWorldHelper.legacySetBlockWithNotify(
               world, x + step * xstep, y + step * ystep, z + step * zstep, 0);
           world.playSoundEffect(
               x + step * xstep + 0.5D,
               y + step * ystep + 0.5D,
               z + step * zstep + 0.5D,
               "random.fizz",
               0.5F,
               2.6F + (rand.nextFloat() - rand.nextFloat()) * 0.8F);
         }
     }
     if (id == Block.tnt.blockID) {
       ReikaWorldHelper.legacySetBlockWithNotify(
           world, x + step * xstep, y + step * ystep, z + step * zstep, 0);
       EntityTNTPrimed var6 =
           new EntityTNTPrimed(
               world,
               x + step * xstep + 0.5D,
               y + step * ystep + 0.5D,
               z + step * zstep + 0.5D,
               null);
       world.spawnEntityInWorld(var6);
       world.playSoundAtEntity(var6, "random.fuse", 1.0F, 1.0F);
       world.spawnParticle(
           "lava",
           x + step * xstep + rand.nextFloat(),
           y + step * ystep + rand.nextFloat(),
           z + step * zstep + rand.nextFloat(),
           0,
           0,
           0);
     } /*
       if (id == 0) {
       	if (world.getBlockId(x+step*xstep, -1+y+step*ystep, z+step*zstep) == Block.netherrack.blockID) {
       		ReikaWorldHelper.legacySetBlockWithNotify(world, x+step*xstep, y+step*ystep, z+step*zstep, Block.fire.blockID);
       	}
       }*/
   }
   return value;
 }
 protected boolean canPlaceBlockAt(World world, int x, int y, int z) {
   if (ReikaWorldHelper.softBlocks(world, x, y, z)) return true;
   int id = world.getBlockId(x, y, z);
   return overrides.contains(id);
 }
 @Override
 protected void makeBeam(World world, int x, int y, int z, int metadata) {
   int animstep = 0;
   boolean blocked = false;
   int dir = 0;
   switch (metadata) {
     case 0:
       dir = 3;
       break;
     case 1:
       dir = 1;
       break;
     case 2:
       dir = 2;
       break;
     case 3:
       dir = 0;
       break;
   }
   // Make punch thru snow, tall grass, etc!
   // if (world.getBlock(x+facing.offsetX, y+facing.offsetY, z+facing.offsetZ) ==
   // BlockRegistry.BRIDGE.getBlockInstance().blockID)
   //	blocked = true;
   int range = this.getRange();
   // ReikaJavaLibrary.pConsole(power+":"+distancelimit+":"+(PowerReceivers.LIGHTBRIDGE.getMinPower()/distancelimit)+":"+range, Side.SERVER);
   if (range > 0
       && world.getBlockLightValue(x, y + 1, z)
           >= 13) { // 1 kW - configured so light level 15 (sun) requires approx power of sun on
     // Earth's surface
     if (!world.isRemote) {
       // if (!Blocks.opaqueCubeLookup[world.getBlock(x+facing.offsetX, y+facing.offsetY,
       // z+facing.offsetZ)]) {
       for (int i = 1;
           (i <= range || range == -1)
               && i <= animtick
               && !blocked
               && (ReikaWorldHelper.softBlocks(
                       world.getBlock(x + facing.offsetX, y + facing.offsetY, z + facing.offsetZ))
                   || world.getBlock(x + facing.offsetX, y + facing.offsetY, z + facing.offsetZ)
                       == Blocks.air
                   || world.getBlock(x + facing.offsetX, y + facing.offsetY, z + facing.offsetZ)
                       == BlockRegistry.BRIDGE.getBlockInstance());
           i++) { // && world.getBlock(x+facing.offsetX, y+facing.offsetY, z+facing.offsetZ) !=
         // BlockRegistry.BRIDGE.getBlockInstance().blockID; i++) {
         // ModLoader.getMinecraftInstance().ingameGUI.addChatMessage(String.format("%d %d %d", x,
         // y, z));
         Block idview =
             world.getBlock(
                 x + facing.offsetX * i, y + facing.offsetY * i, z + facing.offsetZ * i);
         int metaview =
             world.getBlockMetadata(
                 x + facing.offsetX * i, y + facing.offsetY * i, z + facing.offsetZ * i);
         if (idview == Blocks.air
             || ReikaWorldHelper.softBlocks(idview)
             || idview == BlockRegistry.LIGHT.getBlockInstance()
             || idview == BlockRegistry.BEAM.getBlockInstance()
             || idview == BlockRegistry.BRIDGE.getBlockInstance()) { // Only overwrite air blocks
           // ModLoader.getMinecraftInstance().ingameGUI.addChatMessage(String.format("%d", idview,
           // world.getBlockMetadata(x+facing.offsetX*i, y+facing.offsetY*i, z+facing.offsetZ*i)));
           world.setBlock(
               x + facing.offsetX * i,
               y + facing.offsetY * i,
               z + facing.offsetZ * i,
               BlockRegistry.BRIDGE.getBlockInstance(),
               dir,
               3);
           // ModLoader.getMinecraftInstance().ingameGUI.addChatMessage(String.format("%d @ %d",
           // idview, world.getBlockMetadata(x+facing.offsetX*i, y+facing.offsetY*i,
           // z+facing.offsetZ*i)));
           // world.markBlockForUpdate(x+facing.offsetX*i, y+facing.offsetY*i, z+facing.offsetZ*i);
           // world.notifyBlockOfNeighborChange(x+facing.offsetX*i, y+facing.offsetY*i,
           // z+facing.offsetZ*i, this.getTileEntityBlockID());
         }
         if (idview != Blocks.air
                 && !ReikaWorldHelper.softBlocks(idview)
                 && idview != BlockRegistry.LIGHT.getBlockInstance()
                 && idview != BlockRegistry.BEAM.getBlockInstance()
                 && (idview != BlockRegistry.BRIDGE.getBlockInstance())
             || animtick > range + 1) {
           animtick--;
           blocked = true;
         }
       }
     }
   }
   // }
   else {
     MinecraftForge.EVENT_BUS.post(new LightBridgePowerLossEvent(this));
     this.lightsOut(world, x, y, z);
   }
 }
 @Override
 public boolean onItemUse(
     ItemStack is,
     EntityPlayer ep,
     World world,
     int x,
     int y,
     int z,
     int side,
     float par8,
     float par9,
     float par10) {
   if (!ReikaWorldHelper.softBlocks(world, x, y, z)
       && world.getBlockMaterial(x, y, z) != Material.water
       && world.getBlockMaterial(x, y, z) != Material.lava) {
     if (side == 0) --y;
     if (side == 1) ++y;
     if (side == 2) --z;
     if (side == 3) ++z;
     if (side == 4) --x;
     if (side == 5) ++x;
     this.clearBlocks(world, x, y, z);
     int id = world.getBlockId(x, y, z);
     if (ReikaBlockHelper.isPortalBlock(world, x, y, z)) {
       TileEntityShaft sha = new TileEntityShaft();
       sha.setBlockMetadata(RotaryAux.get6SidedMetadataFromPlayerLook(ep));
       sha.getIOSides(world, x, y, z, sha.getBlockMetadata());
       sha.xCoord = x;
       sha.yCoord = y;
       sha.zCoord = z;
       int dx = sha.getReadDirection().offsetX;
       int dy = sha.getReadDirection().offsetY;
       int dz = sha.getReadDirection().offsetZ;
       MachineRegistry m = MachineRegistry.getMachine(world, dx, dy, dz);
       if (m == MachineRegistry.SHAFT) {
         TileEntityShaft te = (TileEntityShaft) world.getBlockTileEntity(dx, dy, dz);
         if (te.isWritingToCoordinate(x, y, z)) {
           world.setBlock(
               dx,
               dy,
               dz,
               MachineRegistry.PORTALSHAFT.getBlockID(),
               MachineRegistry.PORTALSHAFT.getMachineMetadata(),
               3);
           TileEntityPortalShaft ps = new TileEntityPortalShaft();
           world.setBlockTileEntity(dx, dy, dz, ps);
           ps.setBlockMetadata(te.getBlockMetadata());
           ps.setPortalType(world, x, y, z);
           ps.material = te.getShaftType();
         }
       }
     }
     if (!ReikaWorldHelper.softBlocks(world, x, y, z)
         && world.getBlockMaterial(x, y, z) != Material.water
         && world.getBlockMaterial(x, y, z) != Material.lava) return false;
   }
   this.clearBlocks(world, x, y, z);
   AxisAlignedBB box = AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
   List inblock = world.getEntitiesWithinAABB(EntityLivingBase.class, box);
   if (inblock.size() > 0) return false;
   if (!ep.canPlayerEdit(x, y, z, 0, is)) return false;
   else {
     if (!ep.capabilities.isCreativeMode) --is.stackSize;
     world.setBlock(x, y, z, MachineRegistry.SHAFT.getBlockID(), is.getItemDamage(), 3);
     if (is.getItemDamage() == RotaryNames.getNumberShaftTypes() - 1) {
       TileEntityShaft sha = (TileEntityShaft) world.getBlockTileEntity(x, y, z);
       if (sha != null) {
         // sha.type = MaterialRegistry.STEEL;
         sha.setBlockMetadata(6 + RotaryAux.get4SidedMetadataFromPlayerLook(ep));
       }
       return true;
     }
     TileEntityShaft sha = (TileEntityShaft) world.getBlockTileEntity(x, y, z);
     if (sha != null) {
       world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "step.stone", 1F, 1.5F);
       // sha.type = MaterialRegistry.setType(is.getItemDamage());
     }
   }
   TileEntityShaft sha = (TileEntityShaft) world.getBlockTileEntity(x, y, z);
   sha.setBlockMetadata(RotaryAux.get6SidedMetadataFromPlayerLook(ep));
   sha.placer = ep.getEntityName();
   if (RotaryAux.shouldSetFlipped(world, x, y, z)) {
     sha.isFlipped = true;
   }
   return true;
 }
 @Override
 public void updateEntity(World world, int x, int y, int z, int meta) {
   if (!world.isRemote) {
     if (dropFlag) {
       if (this.getTicksExisted() % 20 == 0) {
         this.doDropWarning(world, x, y, z);
       }
     } else {
       int n = this.hasSpeed() ? 4 : 1;
       for (int k = 0; k < n; k++) {
         if (digging && !coords.isEmpty()) {
           // this.prepareChunkloading();
           if (this.hasEnergy(required)) {
             Coordinate c = coords.get(index);
             int dx = c.xCoord;
             int dy = c.yCoord;
             int dz = c.zCoord;
             Block id = this.parseBlock(world.getBlock(dx, dy, dz));
             int meta2 = world.getBlockMetadata(dx, dy, dz);
             // ReikaJavaLibrary.pConsole(readX+":"+dx+", "+dy+", "+readZ+":"+dz+" >
             // "+ores.getSize(), Side.SERVER);
             this.removeFound(world, dx, dy, dz, id, meta2);
             if (id instanceof SpecialOreBlock) {
               this.dropSpecialOreBlock(world, x, y, z, dx, dy, dz, (SpecialOreBlock) id, meta2);
             } else if (ReikaBlockHelper.isOre(id, meta2)) {
               // ores.addBlockCoordinate(dx, dy, dz);
               this.dropBlock(world, x, y, z, dx, dy, dz, id, meta2);
             } else if (this.shouldMine(id, meta2)) {
               this.dropBlock(world, x, y, z, dx, dy, dz, id, meta2);
             } else if (this.isTieredResource(world, dx, dy, dz, id, meta2)) {
               this.dropTieredResource(world, x, y, z, dx, dy, dz, id, meta2);
             } else if (id instanceof MinerBlock) {
               this.dropMineableBlock(world, x, y, z, dx, dy, dz, id, meta2);
             }
             this.useEnergy(required.copy().scale(this.hasEfficiency() ? 0.25F : 1));
             // ReikaJavaLibrary.pConsole("Mining "+id+":"+meta2+" @ "+dx+","+dy+","+dz+";
             // index="+index);
             index++;
             if (index >= coords.size()) {
               this.finishDigging();
               k = n;
             }
           }
         } else if (!digReady && !finishedDigging) {
           this.prepareChunkloading();
           for (int i = 0; i < TICKSTEP; i++) {
             int dx = x + readX;
             int dy = readY;
             int dz = z + readZ;
             ReikaWorldHelper.forceGenAndPopulate(world, dx, dz);
             Block id = this.parseBlock(world.getBlock(dx, dy, dz));
             int meta2 = world.getBlockMetadata(dx, dy, dz);
             // ReikaJavaLibrary.pConsole(readX+":"+dx+", "+dy+", "+readZ+":"+dz+" >
             // "+ores.getSize(), Side.SERVER);
             boolean add = false;
             if (ReikaBlockHelper.isOre(id, meta2)) {
               // ores.addBlockCoordinate(dx, dy, dz);
               add = coords.add(new Coordinate(dx, dy, dz));
             } else if (this.isTieredResource(world, dx, dy, dz, id, meta2)) {
               add = coords.add(new Coordinate(dx, dy, dz));
             } else if (id instanceof MinerBlock && ((MinerBlock) id).isMineable(meta2)) {
               add = coords.add(new Coordinate(dx, dy, dz));
             } else if (this.shouldMine(id, meta2)) {
               add = coords.add(new Coordinate(dx, dy, dz));
             }
             if (add) {
               this.addFound(world, dx, dy, dz, id, meta2);
             }
             this.updateReadPosition();
             if (readY >= worldObj.getActualHeight()) {
               this.prepareDigging();
             }
           }
         }
       }
       progress = readY;
     }
   }
   if (world.isRemote) this.spawnParticles(world, x, y, z);
 }