/** Called by a player entity when they collide with an entity */ public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) { if (!this.m_bNotPlayerOwned) { if (!this.worldObj.isRemote) { if (this.field_70532_c == 0 && par1EntityPlayer.xpCooldown == 0) { par1EntityPlayer.xpCooldown = 2; this.worldObj.playSoundAtEntity( this, "random.orb", 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F)); par1EntityPlayer.onItemPickup(this, 1); par1EntityPlayer.addExperience(this.xpValue); this.setDead(); } } } }
/** Called whenever an item is picked up from walking over it. Args: pickedUpEntity, stackSize */ public void onItemPickup(Entity p_71001_1_, int p_71001_2_) { super.onItemPickup(p_71001_1_, p_71001_2_); this.openContainer.detectAndSendChanges(); }