Update CraftBukkit to Minecraft 1.7.2

This commit is contained in:
mbax
2013-11-04 07:07:38 -06:00
committed by Wesley Wolfe
parent ff8b70fbb7
commit 2726696652
349 changed files with 14339 additions and 11287 deletions

View File

@@ -12,14 +12,13 @@ import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.world.StructureGrowEvent;
// CraftBukkit end
public class BlockMushroom extends BlockFlower {
public class BlockMushroom extends BlockPlant implements IBlockFragilePlantElement {
protected BlockMushroom(int i) {
super(i);
protected BlockMushroom() {
float f = 0.2F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
this.b(true);
this.a(true);
}
public void a(World world, int i, int j, int k, Random random) {
@@ -35,7 +34,7 @@ public class BlockMushroom extends BlockFlower {
for (i1 = i - b0; i1 <= i + b0; ++i1) {
for (j1 = k - b0; j1 <= k + b0; ++j1) {
for (k1 = j - 1; k1 <= j + 1; ++k1) {
if (world.getTypeId(i1, k1, j1) == this.id) {
if (world.getType(i1, k1, j1) == this) {
--l;
if (l <= 0) {
return;
@@ -50,7 +49,7 @@ public class BlockMushroom extends BlockFlower {
k1 = k + random.nextInt(3) - 1;
for (int l1 = 0; l1 < 4; ++l1) {
if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) {
if (world.isEmpty(i1, j1, k1) && this.j(world, i1, j1, k1)) {
i = i1;
j = j1;
k = k1;
@@ -61,11 +60,11 @@ public class BlockMushroom extends BlockFlower {
k1 = k + random.nextInt(3) - 1;
}
if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) {
if (world.isEmpty(i1, j1, k1) && this.j(world, i1, j1, k1)) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
blockState.setTypeId(this.id); // nms: this.id, 0, 2
blockState.setTypeId(Block.b(this)); // nms: this.id, 0, 2
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(sourceX, sourceY, sourceZ), blockState);
world.getServer().getPluginManager().callEvent(event);
@@ -79,18 +78,18 @@ public class BlockMushroom extends BlockFlower {
}
public boolean canPlace(World world, int i, int j, int k) {
return super.canPlace(world, i, j, k) && this.f(world, i, j, k);
return super.canPlace(world, i, j, k) && this.j(world, i, j, k);
}
protected boolean g_(int i) {
return Block.t[i];
protected boolean a(Block block) {
return block.j();
}
public boolean f(World world, int i, int j, int k) {
public boolean j(World world, int i, int j, int k) {
if (j >= 0 && j < 256) {
int l = world.getTypeId(i, j - 1, k);
Block block = world.getType(i, j - 1, k);
return l == Block.MYCEL.id || world.m(i, j, k) < 13 && this.g_(l);
return block == Blocks.MYCEL || block == Blocks.DIRT && world.getData(i, j - 1, k) == 2 || world.j(i, j, k) < 13 && this.a(block);
} else {
return false;
}
@@ -107,25 +106,37 @@ public class BlockMushroom extends BlockFlower {
Location location = new Location(world.getWorld(), i, j, k);
WorldGenHugeMushroom worldgenhugemushroom = null;
if (this.id == Block.BROWN_MUSHROOM.id) {
if (this == Blocks.BROWN_MUSHROOM) {
event = new StructureGrowEvent(location, TreeType.BROWN_MUSHROOM, bonemeal, player, new ArrayList<BlockState>());
worldgenhugemushroom = new WorldGenHugeMushroom(0);
} else if (this.id == Block.RED_MUSHROOM.id) {
} else if (this == Blocks.RED_MUSHROOM) {
event = new StructureGrowEvent(location, TreeType.RED_MUSHROOM, bonemeal, player, new ArrayList<BlockState>());
worldgenhugemushroom = new WorldGenHugeMushroom(1);
}
if (worldgenhugemushroom != null && event != null) {
grown = worldgenhugemushroom.grow((org.bukkit.BlockChangeDelegate)world, random, i, j, k, event, itemstack, world.getWorld());
grown = worldgenhugemushroom.grow(new org.bukkit.craftbukkit.CraftBlockChangeDelegate((org.bukkit.BlockChangeDelegate) world), random, i, j, k, event, itemstack, world.getWorld());
if (event.isFromBonemeal() && itemstack != null) {
--itemstack.count;
}
}
if (!grown || event.isCancelled()) {
world.setTypeIdAndData(i, j, k, this.id, l, 3);
world.setTypeAndData(i, j, k, this, l, 3);
return false;
}
return true;
// CraftBukkit end
}
public boolean a(World world, int i, int j, int k, boolean flag) {
return true;
}
public boolean a(World world, Random random, int i, int j, int k) {
return (double) random.nextFloat() < 0.4D;
}
public void b(World world, Random random, int i, int j, int k) {
this.grow(world, i, j, k, random, false, null, null); // CraftBukkit - Add bonemeal, player, and itemstack
}
}