ForgePatch/patches/minecraft/net/minecraft/src/PlayerControllerMP.java.patch

73 lines
2.8 KiB
Diff

--- ../src_base/minecraft/net/minecraft/src/PlayerControllerMP.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/PlayerControllerMP.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,6 +1,7 @@
package net.minecraft.src;
import net.minecraft.client.Minecraft;
+import net.minecraft.src.forge.ForgeHooks;
public class PlayerControllerMP extends PlayerController
{
@@ -75,6 +76,11 @@
*/
public boolean onPlayerDestroyBlock(int par1, int par2, int par3, int par4)
{
+ ItemStack stack = mc.thePlayer.getCurrentEquippedItem();
+ if (stack != null && stack.getItem().onBlockStartBreak(stack, par1, par2, par3, mc.thePlayer))
+ {
+ return false;
+ }
if (this.creativeMode)
{
return super.onPlayerDestroyBlock(par1, par2, par3, par4);
@@ -121,7 +127,7 @@
Block.blocksList[var5].onBlockClicked(this.mc.theWorld, par1, par2, par3, this.mc.thePlayer);
}
- if (var5 > 0 && Block.blocksList[var5].blockStrength(this.mc.thePlayer) >= 1.0F)
+ if (var5 > 0 && Block.blocksList[var5].blockStrength(mc.theWorld, mc.thePlayer, par1, par2, par3) >= 1.0F)
{
this.onPlayerDestroyBlock(par1, par2, par3, par4);
}
@@ -177,7 +183,7 @@
}
Block var6 = Block.blocksList[var5];
- this.curBlockDamageMP += var6.blockStrength(this.mc.thePlayer);
+ this.curBlockDamageMP += var6.blockStrength(mc.theWorld, mc.thePlayer, par1, par2, par3);
if (this.stepSoundTickCounter % 4.0F == 0.0F && var6 != null)
{
@@ -263,6 +269,14 @@
{
this.syncCurrentPlayItem();
this.netClientHandler.addToSendQueue(new Packet15Place(par4, par5, par6, par7, par1EntityPlayer.inventory.getCurrentItem()));
+
+ if (par3ItemStack != null &&
+ par3ItemStack.getItem() != null &&
+ par3ItemStack.getItem().onItemUseFirst(par3ItemStack, par1EntityPlayer, par2World, par4, par5, par6, par7))
+ {
+ return true;
+ }
+
int var8 = par2World.getBlockId(par4, par5, par6);
if (var8 > 0 && Block.blocksList[var8].blockActivated(par2World, par4, par5, par6, par1EntityPlayer))
@@ -284,7 +298,15 @@
}
else
{
- return par3ItemStack.useItem(par1EntityPlayer, par2World, par4, par5, par6, par7);
+ if (!par3ItemStack.useItem(par1EntityPlayer, par2World, par4, par5, par6, par7))
+ {
+ return false;
+ }
+ if (par3ItemStack.stackSize <= 0)
+ {
+ ForgeHooks.onDestroyCurrentItem(par1EntityPlayer, par3ItemStack);
+ }
+ return true;
}
}