diff --git a/forge/patches/minecraft/net/minecraft/src/EntityPlayer.java.patch b/forge/patches/minecraft/net/minecraft/src/EntityPlayer.java.patch index 3e10b58eb..c79b15d3d 100644 --- a/forge/patches/minecraft/net/minecraft/src/EntityPlayer.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/EntityPlayer.java.patch @@ -11,7 +11,25 @@ import java.util.*; // Referenced classes of package net.minecraft.src: -@@ -548,6 +552,8 @@ +@@ -502,7 +506,16 @@ + + public void dropCurrentItem() + { +- dropPlayerItemWithRandomChoice(inventory.decrStackSize(inventory.currentItem, 1), false); ++ ItemStack stack = inventory.getCurrentItem(); ++ if (stack == null) ++ { ++ return; ++ } ++ ++ if (stack.getItem().onDroppedByPlayer(stack, this)) ++ { ++ dropPlayerItemWithRandomChoice(inventory.decrStackSize(inventory.currentItem, 1), false); ++ } + } + + public void dropPlayerItem(ItemStack itemstack) +@@ -548,6 +561,8 @@ worldObj.entityJoinedWorld(entityitem); } @@ -20,7 +38,7 @@ public float getCurrentPlayerStrVsBlock(Block block) { float f = inventory.getStrVsBlock(block); -@@ -576,6 +582,45 @@ +@@ -576,6 +591,45 @@ return f1; } @@ -66,7 +84,7 @@ public boolean canHarvestBlock(Block block) { return inventory.canHarvestBlock(block); -@@ -774,6 +819,25 @@ +@@ -774,6 +828,25 @@ protected void damageEntity(DamageSource damagesource, int i) { @@ -92,7 +110,7 @@ if(!damagesource.unblockable() && func_35162_ad()) { i = 1 + i >> 1; -@@ -825,7 +889,9 @@ +@@ -825,7 +898,9 @@ public void destroyCurrentEquippedItem() { @@ -102,7 +120,7 @@ } public double getYOffset() -@@ -957,6 +1023,10 @@ +@@ -957,6 +1032,10 @@ public EnumStatus sleepInBedAt(int i, int j, int k) { diff --git a/forge/patches/minecraft/net/minecraft/src/Item.java.patch b/forge/patches/minecraft/net/minecraft/src/Item.java.patch index fe293965a..2277b4b8f 100644 --- a/forge/patches/minecraft/net/minecraft/src/Item.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/Item.java.patch @@ -77,7 +77,7 @@ public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1) { return false; -@@ -473,6 +515,18 @@ +@@ -473,6 +515,32 @@ { return 0; } @@ -92,6 +92,20 @@ + { + itemList.add(new ItemStack(this, 1)); + } ++ } ++ ++ /** ++ * Called when a player drops the item into the world, ++ * returning false from this will prevent the item from ++ * being removed from the players inventory and spawning ++ * in the world ++ * ++ * @param player The player that dropped the item ++ * @param item The item stack, before the item is removed. ++ */ ++ public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) ++ { ++ return true; + } static diff --git a/forge/patches/minecraft_server/net/minecraft/src/EntityPlayer.java.patch b/forge/patches/minecraft_server/net/minecraft/src/EntityPlayer.java.patch index 65619dad6..55399e4b0 100644 --- a/forge/patches/minecraft_server/net/minecraft/src/EntityPlayer.java.patch +++ b/forge/patches/minecraft_server/net/minecraft/src/EntityPlayer.java.patch @@ -11,7 +11,25 @@ // Referenced classes of package net.minecraft.src: // EntityLiving, InventoryPlayer, FoodStats, PlayerCapabilities, // ContainerPlayer, World, ChunkCoordinates, DataWatcher, -@@ -493,6 +497,8 @@ +@@ -447,7 +451,16 @@ + + public void dropCurrentItem() + { +- dropPlayerItemWithRandomChoice(inventory.decrStackSize(inventory.currentItem, 1), false); ++ ItemStack stack = inventory.getCurrentItem(); ++ if (stack == null) ++ { ++ return; ++ } ++ ++ if (stack.getItem().onDroppedByPlayer(stack, this)) ++ { ++ dropPlayerItemWithRandomChoice(inventory.decrStackSize(inventory.currentItem, 1), false); ++ } + } + + public void dropPlayerItem(ItemStack itemstack) +@@ -493,6 +506,8 @@ worldObj.entityJoinedWorld(entityitem); } @@ -20,7 +38,7 @@ public float getCurrentPlayerStrVsBlock(Block block) { float f = inventory.getStrVsBlock(block); -@@ -521,6 +527,45 @@ +@@ -521,6 +536,45 @@ return f1; } @@ -66,7 +84,7 @@ public boolean canHarvestBlock(Block block) { return inventory.canHarvestBlock(block); -@@ -718,7 +763,26 @@ +@@ -718,7 +772,26 @@ } protected void damageEntity(DamageSource damagesource, int i) @@ -94,7 +112,7 @@ if(!damagesource.unblockable() && func_35180_G()) { i = 1 + i >> 1; -@@ -770,7 +834,9 @@ +@@ -770,7 +843,9 @@ public void destroyCurrentEquippedItem() { @@ -104,7 +122,7 @@ } public double getYOffset() -@@ -896,6 +962,10 @@ +@@ -896,6 +971,10 @@ public EnumStatus sleepInBedAt(int i, int j, int k) { diff --git a/forge/patches/minecraft_server/net/minecraft/src/Item.java.patch b/forge/patches/minecraft_server/net/minecraft/src/Item.java.patch index 9d03b0204..937d440b8 100644 --- a/forge/patches/minecraft_server/net/minecraft/src/Item.java.patch +++ b/forge/patches/minecraft_server/net/minecraft/src/Item.java.patch @@ -77,7 +77,7 @@ public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1) { return false; -@@ -414,6 +456,12 @@ +@@ -414,6 +456,26 @@ return 0; } @@ -86,6 +86,20 @@ + public void addCreativeItems(ArrayList itemList) + { + } ++ ++ /** ++ * Called when a player drops the item into the world, ++ * returning false from this will prevent the item from ++ * being removed from the players inventory and spawning ++ * in the world ++ * ++ * @param player The player that dropped the item ++ * @param item The item stack, before the item is removed. ++ */ ++ public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) ++ { ++ return true; ++ } + static {