private void dropBlocks(World world, int x, int y, int z) {
    Block drop = world.getBlock(x, y, z);
    if (drop == Blocks.air) return;
    int dropmeta = world.getBlockMetadata(x, y, z);
    ItemStack sapling = tree.getSapling();
    Block logID = tree.getTreeType().getLogID();

    Collection<ItemStack> drops = this.getDrops(world, x, y, z, drop, dropmeta);
    if (drop == logID && logID != null) {
      if (rand.nextInt(3) == 0) {
        drops.add(
            ReikaItemHelper.getSizedItemStack(ItemStacks.sawdust.copy(), 1 + rand.nextInt(4)));
      }
    }

    for (ItemStack todrop : drops) {
      if (ReikaItemHelper.matchStacks(todrop, sapling)) {
        if (inv[0] != null && inv[0].stackSize >= inv[0].getMaxStackSize()) {
          if (!this.chestCheck(todrop))
            ReikaItemHelper.dropItem(world, dropx, yCoord - 0.25, dropz, todrop);
        } else ReikaInventoryHelper.addOrSetStack(todrop, inv, 0);
      } else {
        if (!this.chestCheck(todrop))
          ReikaItemHelper.dropItem(world, dropx, yCoord - 0.25, dropz, todrop);
      }
    }
  }
 public boolean upgrade() {
   if (bedrock) return false;
   bedrock = true;
   if (inv[9] != null)
     ReikaItemHelper.dropItem(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, inv[9]);
   inv[9] = ItemStacks.bedrockdrill.copy();
   return true;
 }
  @Override
  public final void drop() {
    // ReikaItemHelper.dropItem(worldObj, xCoord+0.5, yCoord+0.5, zCoord+0.5,
    // this.getTile().getCraftedProduct());

    ItemStack is = this.getTile().getCraftedProduct();
    is.stackTagCompound = new NBTTagCompound();
    this.getTagsToWriteToStack(is.stackTagCompound);
    ReikaItemHelper.dropItem(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, is);
    this.delete();
  }
  @Override
  public void onDeath(DamageSource src) {
    ChromaSounds.DISCHARGE.playSound(this, 1F, 2F);
    if (!worldObj.isRemote) {
      Entity e = src.getEntity();
      if (e instanceof EntityPlayer) {
        EntityPlayer ep = (EntityPlayer) e;
        if (doDrops && !ReikaPlayerAPI.isFakeOrNotInteractable(ep, posX, posY, posZ, 8)) {
          int looting = EnchantmentHelper.getLootingModifier((EntityPlayer) src.getEntity());
          ReikaItemHelper.dropItem(
              this,
              ReikaItemHelper.getSizedItemStack(
                  ChromaStacks.beaconDust, rand.nextInt(1 + looting * 2)));
          if (looting > 1) {
            if (color.isPrimary()) ReikaItemHelper.dropItem(this, ChromaStacks.purityDust);
            else ReikaItemHelper.dropItem(this, ChromaStacks.auraDust);
          }
        }
        ProgressStage.BALLLIGHTNING.stepPlayerTo(ep);
      }

      this.sendDeathParticles();
    }
  }
 private void dropItems(World world, int x, int y, int z, Collection<ItemStack> li) {
   for (ItemStack is : li) {
     boolean flag = true;
     for (int i = 0; i < 6 && flag; i++) {
       TileEntity te = this.getAdjacentTileEntity(dirs[i]);
       if (te instanceof IInventory) {
         if (ReikaInventoryHelper.addToIInv(is, (IInventory) te)) flag = false;
       }
     }
     if (flag) {
       ReikaItemHelper.dropItem(world, x + 0.5, y + 1.5, z + 0.5, is);
       dropFlag = true;
       this.doDropWarning(world, x, y, z);
     }
   }
 }
 @SubscribeEvent
 public void meatGrinding(LivingDropsEvent ev) {
   if (ev.source instanceof GrinderDamage) {
     ItemStack food = ReikaEntityHelper.getFoodItem(ev.entityLiving);
     ev.drops.clear();
     if (food != null) {
       World world = ev.entityLiving.worldObj;
       Random rand = RotaryCraft.rand;
       int num = 4 + rand.nextInt(4) + rand.nextInt(4) + rand.nextInt(4);
       ItemStack is = ReikaItemHelper.getSizedItemStack(food, num);
       ReikaItemHelper.dropItem(
           world, ev.entityLiving.posX, ev.entityLiving.posY, ev.entityLiving.posZ, is);
     }
     ev.setCanceled(true);
   }
 }
  @Override
  public void harvestBlock(World world, EntityPlayer ep, int x, int y, int z, int meta) {
    ChromaTiles c = ChromaTiles.getTile(world, x, y, z);
    if (c == null) return;
    if (c == ChromaTiles.PYLON) {

    } else {
      boolean silk = EnchantmentHelper.getSilkTouchModifier(ep);
      TileEntity tile = world.getTileEntity(x, y, z);
      if (silk) {
        ItemStack is = c.getCraftedProduct();
        if (tile instanceof TileEntityAccelerator) {
          TileEntityAccelerator te = (TileEntityAccelerator) tile;
          if (is.stackTagCompound == null) is.stackTagCompound = new NBTTagCompound();
          is.stackTagCompound.setInteger("tier", te.getTier());
        }
        ReikaItemHelper.dropItem(world, x + 0.5, y + 0.5, z + 0.5, is);
      } else {
        ReikaItemHelper.dropItems(world, x + 0.5, y + 0.5, z + 0.5, this.getPieces(world, x, y, z));
      }
    }
  }
 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);
   }
 }