Ejemplo n.º 1
0
  /** Drops the block items with a specified chance of dropping the specified items */
  public void dropBlockAsItemWithChance(
      World par1World, int par2, int par3, int par4, int par5, float par6, int par7) {
    super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0);

    if (!par1World.isRemote) {
      if (par5 >= 7) {
        int var8 = 3 + par7;

        for (int var9 = 0; var9 < var8; ++var9) {
          if (par1World.rand.nextInt(15) <= par5) {
            this.dropBlockAsItem_do(
                par1World, par2, par3, par4, new ItemStack(this.getSeedItem(), 1, 0));
          }
        }
      }
    }
  }
Ejemplo n.º 2
0
  /** Drops the block items with a specified chance of dropping the specified items */
  public void dropBlockAsItemWithChance(
      World par1World, int par2, int par3, int par4, int par5, float par6, int par7) {
    super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7);

    if (par1World.isRemote) {
      return;
    }

    Item item = null;

    if (fruitType == Block.pumpkin) {
      item = Item.pumpkinSeeds;
    }

    if (fruitType == Block.melon) {
      item = Item.melonSeeds;
    }

    for (int i = 0; i < 3; i++) {
      if (par1World.rand.nextInt(15) <= par5) {
        float f = 0.7F;
        float f1 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F;
        float f2 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F;
        float f3 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F;
        EntityItem entityitem =
            new EntityItem(
                par1World,
                (float) par2 + f1,
                (float) par3 + f2,
                (float) par4 + f3,
                new ItemStack(item));
        entityitem.delayBeforeCanPickup = 10;
        par1World.spawnEntityInWorld(entityitem);
      }
    }
  }