2012-03-07 04:42:58 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
2012-03-05 20:21:43 +01:00
|
|
|
import java.util.ArrayList; // CraftBukkit
|
2012-03-07 04:42:58 +01:00
|
|
|
import java.util.Random;
|
|
|
|
|
|
|
|
public class BlockLongGrass extends BlockFlower {
|
|
|
|
|
|
|
|
protected BlockLongGrass(int i, int j) {
|
|
|
|
super(i, j, Material.REPLACEABLE_PLANT);
|
|
|
|
float f = 0.4F;
|
|
|
|
|
|
|
|
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.8F, 0.5F + f);
|
|
|
|
}
|
|
|
|
|
|
|
|
public int a(int i, int j) {
|
|
|
|
return j == 1 ? this.textureId : (j == 2 ? this.textureId + 16 + 1 : (j == 0 ? this.textureId + 16 : this.textureId));
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getDropType(int i, Random random, int j) {
|
|
|
|
return random.nextInt(8) == 0 ? Item.SEEDS.id : -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getDropCount(int i, Random random) {
|
|
|
|
return 1 + random.nextInt(i * 2 + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
|
2012-03-22 21:39:39 +01:00
|
|
|
if (!world.isStatic && entityhuman.U() != null && entityhuman.U().id == Item.SHEARS.id) {
|
2012-03-07 04:42:58 +01:00
|
|
|
entityhuman.a(StatisticList.C[this.id], 1);
|
2012-03-05 20:21:43 +01:00
|
|
|
/* CraftBukkit start - moved this line into calculateDrops
|
2012-03-07 04:42:58 +01:00
|
|
|
this.a(world, i, j, k, new ItemStack(Block.LONG_GRASS, 1, l));
|
2012-03-05 20:21:43 +01:00
|
|
|
*/
|
|
|
|
this.doActualDrop(world, entityhuman, i, j, k, l);
|
|
|
|
// CraftBukkit end
|
2012-03-07 04:42:58 +01:00
|
|
|
} else {
|
|
|
|
super.a(world, entityhuman, i, j, k, l);
|
|
|
|
}
|
|
|
|
}
|
2012-03-05 20:21:43 +01:00
|
|
|
|
|
|
|
// CraftBukkit start - Calculate drops
|
|
|
|
public ArrayList<ItemStack> calculateDrops(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
|
2012-03-22 21:39:39 +01:00
|
|
|
if (!world.isStatic && entityhuman.U() != null && entityhuman.U().id == Item.SHEARS.id) {
|
2012-03-05 20:21:43 +01:00
|
|
|
super.dropList = new ArrayList<ItemStack>();
|
|
|
|
this.a(world, i, j, k, new ItemStack(Block.LONG_GRASS, 1, l));
|
|
|
|
return super.dropList;
|
|
|
|
} else {
|
|
|
|
return super.calculateDrops(world, entityhuman, i, j, k, l);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2012-03-07 04:42:58 +01:00
|
|
|
}
|