2011-01-08 12:18:05 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
public class ItemHoe extends Item {
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
protected EnumToolMaterial a;
|
|
|
|
|
2013-11-04 14:07:38 +01:00
|
|
|
public ItemHoe(EnumToolMaterial enumtoolmaterial) {
|
2012-07-29 09:33:13 +02:00
|
|
|
this.a = enumtoolmaterial;
|
2011-01-29 22:50:29 +01:00
|
|
|
this.maxStackSize = 1;
|
2012-01-14 21:03:48 +01:00
|
|
|
this.setMaxDurability(enumtoolmaterial.a());
|
2012-07-29 09:33:13 +02:00
|
|
|
this.a(CreativeModeTab.i);
|
2011-01-08 12:18:05 +01:00
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
|
2013-01-27 17:44:32 +01:00
|
|
|
final int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
|
2012-10-25 05:53:23 +02:00
|
|
|
if (!entityhuman.a(i, j, k, l, itemstack)) {
|
2011-01-29 22:50:29 +01:00
|
|
|
return false;
|
|
|
|
} else {
|
2013-11-04 14:07:38 +01:00
|
|
|
Block block = world.getType(i, j, k);
|
2011-01-08 12:18:05 +01:00
|
|
|
|
2013-11-04 14:07:38 +01:00
|
|
|
if (l != 0 && world.getType(i, j + 1, k).getMaterial() == Material.AIR && (block == Blocks.GRASS || block == Blocks.DIRT)) {
|
|
|
|
Block block1 = Blocks.SOIL;
|
2011-01-08 12:18:05 +01:00
|
|
|
|
2013-11-04 14:07:38 +01:00
|
|
|
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block1.stepSound.getStepSound(), (block1.stepSound.getVolume1() + 1.0F) / 2.0F, block1.stepSound.getVolume2() * 0.8F);
|
2011-09-15 02:23:52 +02:00
|
|
|
if (world.isStatic) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
// CraftBukkit start - Hoes - blockface -1 for 'SELF'
|
2013-11-04 14:07:38 +01:00
|
|
|
// world.setTypeUpdate(i, j, k, block1);
|
|
|
|
if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, block1, 0, clickedX, clickedY, clickedZ)) {
|
2011-09-15 02:23:52 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
itemstack.damage(1, entityhuman);
|
|
|
|
return true;
|
|
|
|
}
|
2013-07-01 13:03:00 +02:00
|
|
|
} else {
|
|
|
|
return false;
|
2011-01-08 12:18:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-07-29 09:33:13 +02:00
|
|
|
|
2013-11-04 14:07:38 +01:00
|
|
|
public String i() {
|
2012-07-29 09:33:13 +02:00
|
|
|
return this.a.toString();
|
|
|
|
}
|
2011-01-08 12:18:05 +01:00
|
|
|
}
|