Files
2019-02-24 22:29:41 +08:00

30 lines
1.1 KiB
Diff

--- ../src-base/minecraft/net/minecraft/item/ItemHoe.java
+++ ../src-work/minecraft/net/minecraft/item/ItemHoe.java
@@ -25,9 +25,9 @@
public class ItemHoe extends Item
{
private final float speed;
- protected Item.ToolMaterial toolMaterial;
+ protected ToolMaterial toolMaterial;
- public ItemHoe(Item.ToolMaterial material)
+ public ItemHoe(ToolMaterial material)
{
this.toolMaterial = material;
this.maxStackSize = 1;
@@ -47,10 +47,13 @@
}
else
{
+ int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(itemstack, player, worldIn, pos);
+ if (hook != 0) return hook > 0 ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
+
IBlockState iblockstate = worldIn.getBlockState(pos);
Block block = iblockstate.getBlock();
- if (facing != EnumFacing.DOWN && worldIn.getBlockState(pos.up()).getMaterial() == Material.AIR)
+ if (facing != EnumFacing.DOWN && worldIn.isAirBlock(pos.up()))
{
if (block == Blocks.GRASS || block == Blocks.GRASS_PATH)
{