Ejemplo n.º 1
0
        public virtual bool Func_325_c(int i, int j, int k)
        {
            int l  = thisWorld.GetBlockId(i, j, k);
            int i1 = thisWorld.GetBlockMetadata(i, j, k);

            thisWorld.SendSoundEffectToAllPlayersWithin64(thisPlayer, 2001, i, j, k, l + thisWorld.GetBlockMetadata(
                                                              i, j, k) * 256);
            bool flag = RemoveBlock(i, j, k);

            net.minecraft.src.ItemStack itemstack = thisPlayer.GetCurrentEquippedItem();
            if (itemstack != null)
            {
                itemstack.Func_25124_a(l, i, j, k, thisPlayer);
                if (itemstack.stackSize == 0)
                {
                    itemstack.Func_577_a(thisPlayer);
                    thisPlayer.DestroyCurrentEquippedItem();
                }
            }
            if (flag && thisPlayer.CanHarvestBlock(net.minecraft.src.Block.blocksList[l]))
            {
                net.minecraft.src.Block.blocksList[l].HarvestBlock(thisWorld, thisPlayer, i, j, k
                                                                   , i1);
                ((net.minecraft.src.EntityPlayerMP)thisPlayer).netServerHandler.SendPacket(
                    new net.minecraft.src.Packet53BlockChange(i, j, k, thisWorld));
            }
            return(flag);
        }
Ejemplo n.º 2
0
 public virtual void UseCurrentItemOnEntity(net.minecraft.src.Entity entity)
 {
     if (entity.Interact(this))
     {
         return;
     }
     net.minecraft.src.ItemStack itemstack = GetCurrentEquippedItem();
     if (itemstack != null && (entity is net.minecraft.src.EntityLiving))
     {
         itemstack.UseItemOnEntity((net.minecraft.src.EntityLiving)entity);
         if (itemstack.stackSize <= 0)
         {
             itemstack.Func_577_a(this);
             DestroyCurrentEquippedItem();
         }
     }
 }
Ejemplo n.º 3
0
        public virtual void AttackTargetEntityWithCurrentItem(net.minecraft.src.Entity entity
                                                              )
        {
            int i = inventory.GetDamageVsEntity(entity);

            if (i > 0)
            {
                if (motionY < 0.0D)
                {
                    i++;
                }

                if (!entity.AttackEntityFrom(this, i))
                {
                    return;                                    // CRAFTBUKKIT -- Bypass durability if attack failed
                }
                net.minecraft.src.ItemStack itemstack = GetCurrentEquippedItem();
                if (itemstack != null && (entity is net.minecraft.src.EntityLiving))
                {
                    itemstack.HitEntity((net.minecraft.src.EntityLiving)entity, this);
                    if (itemstack.stackSize <= 0)
                    {
                        itemstack.Func_577_a(this);
                        DestroyCurrentEquippedItem();
                    }
                }
                if (entity is net.minecraft.src.EntityLiving)
                {
                    if (entity.IsEntityAlive())
                    {
                        SetOwnedEntitiesToAttack((net.minecraft.src.EntityLiving)entity, true);
                    }
                    AddStat(net.minecraft.src.StatList.StatDamageDealt, i);
                }
            }
        }