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;
|
|
|
|
|
2011-01-14 14:31:10 +01:00
|
|
|
public ItemHoe(int i, EnumToolMaterial enumtoolmaterial) {
|
2011-01-08 12:18:05 +01:00
|
|
|
super(i);
|
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 {
|
2011-09-15 02:23:52 +02:00
|
|
|
int i1 = world.getTypeId(i, j, k);
|
|
|
|
int j1 = world.getTypeId(i, j + 1, k);
|
2011-01-08 12:18:05 +01:00
|
|
|
|
2011-09-15 02:23:52 +02:00
|
|
|
if ((l == 0 || j1 != 0 || i1 != Block.GRASS.id) && i1 != Block.DIRT.id) {
|
|
|
|
return false;
|
2011-01-29 22:50:29 +01:00
|
|
|
} else {
|
2011-09-15 02:23:52 +02:00
|
|
|
Block block = Block.SOIL;
|
2011-01-08 12:18:05 +01:00
|
|
|
|
2012-11-06 13:05:28 +01:00
|
|
|
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.getStepSound(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.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-03-13 23:33:27 +01:00
|
|
|
// world.setTypeIdUpdate(i, j, k, block.id);
|
2013-01-27 17:44:32 +01:00
|
|
|
if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, block.id, 0, clickedX, clickedY, clickedZ)) {
|
2011-09-15 02:23:52 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
itemstack.damage(1, entityhuman);
|
|
|
|
return true;
|
|
|
|
}
|
2011-01-08 12:18:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-07-29 09:33:13 +02:00
|
|
|
|
2012-10-25 05:53:23 +02:00
|
|
|
public String g() {
|
2012-07-29 09:33:13 +02:00
|
|
|
return this.a.toString();
|
|
|
|
}
|
2011-01-08 12:18:05 +01:00
|
|
|
}
|