Example #1
0
        public override void OnCollideWithPlayer(net.minecraft.src.EntityPlayer entityplayer)
        {
            if (worldObj.singleplayerWorld)
            {
                return;
            }

            int stackSize = item.stackSize;

            if (delayBeforeCanPickup == 0 && SanityCheckStackSize() && entityplayer.inventory.AddItemStackToInventory(item))
            {
                //SHARP: Do these even matter in MP?
                //if (item.itemID == net.minecraft.src.Block.wood.blockID)
                //{
                //    entityplayer.AddStatistic(net.minecraft.src.AchievementList.aCollectWood);
                //}
                //if (item.itemID == net.minecraft.src.Item.leather.shiftedIndex)
                //{
                //    entityplayer.AddStatistic(net.minecraft.src.AchievementList.aKillCow);
                //}
                worldObj.PlaySoundAtEntity(this, "random.pop", 0.2F, ((rand.NextFloat() - rand.NextFloat()) * 0.7F + 1.0F) * 2.0F);
                entityplayer.OnItemPickup(this, stackSize);
                if (item.stackSize <= 0)
                {
                    SetEntityDead();
                }
            }
        }
Example #2
0
 public override void OnCollideWithPlayer(net.minecraft.src.EntityPlayer entityplayer
                                          )
 {
     if (inGroundSnowball && owner == entityplayer && shakeSnowball <= 0 && entityplayer
         .inventory.AddItemStackToInventory(new net.minecraft.src.ItemStack(net.minecraft.src.Item
                                                                            .ARROW, 1)))
     {
         worldObj.PlaySoundAtEntity(this, "random.pop", 0.2F, ((rand.NextFloat() - rand.NextFloat
                                                                    ()) * 0.7F + 1.0F) * 2.0F);
         entityplayer.OnItemPickup(this, 1);
         SetEntityDead();
     }
 }
Example #3
0
 public override void OnCollideWithPlayer(net.minecraft.src.EntityPlayer entityplayer
                                          )
 {
     if (worldObj.singleplayerWorld)
     {
         return;
     }
     if (inGround && field_28012_a && arrowShake <= 0 && entityplayer.inventory.AddItemStackToInventory
             (new net.minecraft.src.ItemStack(net.minecraft.src.Item.ARROW, 1)))
     {
         worldObj.PlaySoundAtEntity(this, "random.pop", 0.2F, ((rand.NextFloat() - rand.NextFloat
                                                                    ()) * 0.7F + 1.0F) * 2.0F);
         entityplayer.OnItemPickup(this, 1);
         SetEntityDead();
     }
 }