Ejemplo n.º 1
0
        public override bool OnItemUse(net.minecraft.src.ItemStack itemstack, net.minecraft.src.EntityPlayer
                                       entityplayer, net.minecraft.src.World world, int i, int j, int k, int l)
        {
            int i1 = world.GetBlockId(i, j, k);
            int j1 = world.GetBlockId(i, j + 1, k);

            if (l != 0 && j1 == 0 && i1 == net.minecraft.src.Block.GRASS.ID || i1 == net.minecraft.src.Block
                .DIRT.ID)
            {
                net.minecraft.src.Block block = net.minecraft.src.Block.SOIL;
                world.PlaySoundEffect((float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, block.stepSound
                                      .Func_737_c(), (block.stepSound.GetVolume() + 1.0F) / 2.0F, block.stepSound.GetPitch
                                          () * 0.8F);
                if (world.singleplayerWorld)
                {
                    return(true);
                }
                else
                {
                    world.SetBlockWithNotify(i, j, k, block.ID);
                    itemstack.DamageItem(1, entityplayer);
                    return(true);
                }
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
 public override bool Func_25007_a(net.minecraft.src.ItemStack itemstack, int i, int
                                   j, int k, int l, net.minecraft.src.EntityLiving entityliving)
 {
     if (i == net.minecraft.src.Block.LEAVES.ID || i == net.minecraft.src.Block.WEB
         .ID)
     {
         itemstack.DamageItem(1, entityliving);
     }
     return(base.Func_25007_a(itemstack, i, j, k, l, entityliving));
 }
Ejemplo n.º 3
0
 public override net.minecraft.src.ItemStack OnItemRightClick(net.minecraft.src.ItemStack
                                                              itemstack, net.minecraft.src.World world, net.minecraft.src.EntityPlayer entityplayer
                                                              )
 {
     if (entityplayer.fishEntity != null)
     {
         int i = entityplayer.fishEntity.CatchFish();
         itemstack.DamageItem(i, entityplayer);
         entityplayer.SwingItem();
     }
     else
     {
         world.PlaySoundAtEntity(entityplayer, "random.bow", 0.5F, 0.4F / (itemRand.NextFloat
                                                                               () * 0.4F + 0.8F));
         if (!world.singleplayerWorld)
         {
             world.AddEntity(new net.minecraft.src.EntityFish(world, entityplayer));
         }
         entityplayer.SwingItem();
     }
     return(itemstack);
 }
Ejemplo n.º 4
0
        public override bool OnItemUse(net.minecraft.src.ItemStack itemstack, net.minecraft.src.EntityPlayer
                                       entityplayer, net.minecraft.src.World world, int i, int j, int k, int l)
        {
            if (l == 0)
            {
                j--;
            }
            if (l == 1)
            {
                j++;
            }
            if (l == 2)
            {
                k--;
            }
            if (l == 3)
            {
                k++;
            }
            if (l == 4)
            {
                i--;
            }
            if (l == 5)
            {
                i++;
            }
            int i1 = world.GetBlockId(i, j, k);

            if (i1 == 0)
            {
                world.PlaySoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "fire.ignite"
                                      , 1.0F, itemRand.NextFloat() * 0.4F + 0.8F);
                world.SetBlockWithNotify(i, j, k, net.minecraft.src.Block.FIRE.ID);
            }
            itemstack.DamageItem(1, entityplayer);
            return(true);
        }
Ejemplo n.º 5
0
 public override bool Interact(net.minecraft.src.EntityPlayer entityplayer)
 {
     net.minecraft.src.ItemStack itemstack = entityplayer.inventory.GetCurrentItem();
     if (itemstack != null && itemstack.itemID == net.minecraft.src.Item.SHEARS
         .ID && !Func_21069_f_())
     {
         if (!worldObj.singleplayerWorld)
         {
             SetSheared(true);
             int i = 2 + rand.Next(3);
             for (int j = 0; j < i; j++)
             {
                 net.minecraft.src.EntityItem entityitem = EntityDropItem(new net.minecraft.src.ItemStack
                                                                              (net.minecraft.src.Block.WOOL.ID, 1, GetFleeceColor()), 1.0F);
                 entityitem.motionY += rand.NextFloat() * 0.05F;
                 entityitem.motionX += (rand.NextFloat() - rand.NextFloat()) * 0.1F;
                 entityitem.motionZ += (rand.NextFloat() - rand.NextFloat()) * 0.1F;
             }
         }
         itemstack.DamageItem(1, entityplayer);
     }
     return(false);
 }
Ejemplo n.º 6
0
 public override bool Func_25007_a(net.minecraft.src.ItemStack itemstack, int i, int
                                   j, int k, int l, net.minecraft.src.EntityLiving entityliving)
 {
     itemstack.DamageItem(2, entityliving);
     return(true);
 }
Ejemplo n.º 7
0
 public override bool HitEntity(net.minecraft.src.ItemStack itemstack, net.minecraft.src.EntityLiving
                                entityliving, net.minecraft.src.EntityLiving entityliving1)
 {
     itemstack.DamageItem(1, entityliving1);
     return(true);
 }