2012-02-12 03:03:54 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
import java.util.Random;
|
|
|
|
|
|
|
|
public class BlockReed extends Block {
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
protected BlockReed(int i) {
|
2012-02-12 03:03:54 +01:00
|
|
|
super(i, Material.PLANT);
|
|
|
|
float f = 0.375F;
|
|
|
|
|
|
|
|
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f);
|
2012-07-29 09:33:13 +02:00
|
|
|
this.b(true);
|
2012-02-12 03:03:54 +01:00
|
|
|
}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
public void a(World world, int i, int j, int k, Random random) {
|
2012-02-12 03:03:54 +01:00
|
|
|
if (world.isEmpty(i, j + 1, k)) {
|
|
|
|
int l;
|
|
|
|
|
|
|
|
for (l = 1; world.getTypeId(i, j - l, k) == this.id; ++l) {
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (l < 3) {
|
|
|
|
int i1 = world.getData(i, j, k);
|
|
|
|
|
|
|
|
if (i1 == 15) {
|
2012-02-12 06:32:24 +01:00
|
|
|
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this.id, 0); // CraftBukkit
|
2013-03-13 23:33:27 +01:00
|
|
|
world.setData(i, j, k, 0, 4);
|
2012-02-12 03:03:54 +01:00
|
|
|
} else {
|
2013-03-13 23:33:27 +01:00
|
|
|
world.setData(i, j, k, i1 + 1, 4);
|
2012-02-12 03:03:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean canPlace(World world, int i, int j, int k) {
|
|
|
|
int l = world.getTypeId(i, j - 1, k);
|
|
|
|
|
|
|
|
return l == this.id ? true : (l != Block.GRASS.id && l != Block.DIRT.id && l != Block.SAND.id ? false : (world.getMaterial(i - 1, j - 1, k) == Material.WATER ? true : (world.getMaterial(i + 1, j - 1, k) == Material.WATER ? true : (world.getMaterial(i, j - 1, k - 1) == Material.WATER ? true : world.getMaterial(i, j - 1, k + 1) == Material.WATER))));
|
|
|
|
}
|
|
|
|
|
|
|
|
public void doPhysics(World world, int i, int j, int k, int l) {
|
2013-03-13 23:33:27 +01:00
|
|
|
this.p_(world, i, j, k);
|
2012-02-12 03:03:54 +01:00
|
|
|
}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
protected final void p_(World world, int i, int j, int k) {
|
|
|
|
if (!this.f(world, i, j, k)) {
|
2012-07-29 09:33:13 +02:00
|
|
|
this.c(world, i, j, k, world.getData(i, j, k), 0);
|
2013-03-13 23:33:27 +01:00
|
|
|
world.setAir(i, j, k);
|
2012-02-12 03:03:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
public boolean f(World world, int i, int j, int k) {
|
2012-02-12 03:03:54 +01:00
|
|
|
return this.canPlace(world, i, j, k);
|
|
|
|
}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
public AxisAlignedBB b(World world, int i, int j, int k) {
|
2012-02-12 03:03:54 +01:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getDropType(int i, Random random, int j) {
|
|
|
|
return Item.SUGAR_CANE.id;
|
|
|
|
}
|
|
|
|
|
2012-10-25 05:53:23 +02:00
|
|
|
public boolean c() {
|
2012-02-12 03:03:54 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-10-25 05:53:23 +02:00
|
|
|
public boolean b() {
|
2012-02-12 03:03:54 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-10-25 05:53:23 +02:00
|
|
|
public int d() {
|
2012-02-12 03:03:54 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|