Files
MinecraftForge/forge/patches/minecraft/net/minecraft/src/EntityItem.java.patch
T

34 lines
1.3 KiB
Diff

--- ../src_base/minecraft/net/minecraft/src/EntityItem.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/EntityItem.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,5 +1,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
+
public class EntityItem extends Entity
{
/** The item stack of this EntityItem. */
@@ -170,7 +172,21 @@
if (!this.worldObj.isRemote)
{
int var2 = this.item.stackSize;
-
+
+ if (delayBeforeCanPickup == 0 && !ForgeHooks.onItemPickup(par1EntityPlayer, this))
+ {
+ ModLoader.onItemPickup(par1EntityPlayer, item);
+ this.worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
+ par1EntityPlayer.onItemPickup(this, var2);
+ if (item.stackSize <= 0)
+ {
+ setEntityDead();
+ }
+ return;
+ }
+
+ var2 = item.stackSize;
+
if (this.delayBeforeCanPickup == 0 && par1EntityPlayer.inventory.addItemStackToInventory(this.item))
{
if (this.item.itemID == Block.wood.blockID)