Update CraftBukkit to Minecraft 1.4.4.

This commit is contained in:
Travis Watkins
2012-11-06 06:05:28 -06:00
parent a0c3b4f9d1
commit 7f7192f8fd
169 changed files with 3295 additions and 2774 deletions

View File

@@ -95,7 +95,7 @@ public class EntityMinecart extends Entity implements IInventory {
}
public AxisAlignedBB g(Entity entity) {
return entity.boundingBox;
return entity.M() ? entity.boundingBox : null;
}
public AxisAlignedBB E() {
@@ -125,86 +125,90 @@ public class EntityMinecart extends Entity implements IInventory {
}
public boolean damageEntity(DamageSource damagesource, int i) {
if (!this.world.isStatic && !this.dead) {
// CraftBukkit start
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity passenger = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, i);
this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
i = event.getDamage();
// CraftBukkit end
this.i(-this.k());
this.h(10);
this.K();
this.setDamage(this.getDamage() + i * 10);
if (damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild) {
this.setDamage(100);
}
if (this.getDamage() > 40) {
if (this.passenger != null) {
this.passenger.mount(this);
}
if (this.isInvulnerable()) {
return false;
} else {
if (!this.world.isStatic && !this.dead) {
// CraftBukkit start
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger);
this.world.getServer().getPluginManager().callEvent(destroyEvent);
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity passenger = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
if (destroyEvent.isCancelled()) {
this.setDamage(40); // Maximize damage so this doesn't get triggered again right away
VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, i);
this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
i = event.getDamage();
// CraftBukkit end
this.die();
this.a(Item.MINECART.id, 1, 0.0F);
if (this.type == 1) {
EntityMinecart entityminecart = this;
this.i(-this.k());
this.h(10);
this.K();
this.setDamage(this.getDamage() + i * 10);
if (damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild) {
this.setDamage(100);
}
for (int j = 0; j < entityminecart.getSize(); ++j) {
ItemStack itemstack = entityminecart.getItem(j);
if (itemstack != null) {
float f = this.random.nextFloat() * 0.8F + 0.1F;
float f1 = this.random.nextFloat() * 0.8F + 0.1F;
float f2 = this.random.nextFloat() * 0.8F + 0.1F;
while (itemstack.count > 0) {
int k = this.random.nextInt(21) + 10;
if (k > itemstack.count) {
k = itemstack.count;
}
itemstack.count -= k;
// CraftBukkit - include enchantments in the new itemstack
EntityItem entityitem = new EntityItem(this.world, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, new ItemStack(itemstack.id, k, itemstack.getData(), itemstack.getEnchantments()));
float f3 = 0.05F;
entityitem.motX = (double) ((float) this.random.nextGaussian() * f3);
entityitem.motY = (double) ((float) this.random.nextGaussian() * f3 + 0.2F);
entityitem.motZ = (double) ((float) this.random.nextGaussian() * f3);
this.world.addEntity(entityitem);
}
}
if (this.getDamage() > 40) {
if (this.passenger != null) {
this.passenger.mount(this);
}
this.a(Block.CHEST.id, 1, 0.0F);
} else if (this.type == 2) {
this.a(Block.FURNACE.id, 1, 0.0F);
}
}
// CraftBukkit start
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger);
this.world.getServer().getPluginManager().callEvent(destroyEvent);
return true;
} else {
return true;
if (destroyEvent.isCancelled()) {
this.setDamage(40); // Maximize damage so this doesn't get triggered again right away
return true;
}
// CraftBukkit end
this.die();
this.a(Item.MINECART.id, 1, 0.0F);
if (this.type == 1) {
EntityMinecart entityminecart = this;
for (int j = 0; j < entityminecart.getSize(); ++j) {
ItemStack itemstack = entityminecart.getItem(j);
if (itemstack != null) {
float f = this.random.nextFloat() * 0.8F + 0.1F;
float f1 = this.random.nextFloat() * 0.8F + 0.1F;
float f2 = this.random.nextFloat() * 0.8F + 0.1F;
while (itemstack.count > 0) {
int k = this.random.nextInt(21) + 10;
if (k > itemstack.count) {
k = itemstack.count;
}
itemstack.count -= k;
// CraftBukkit - include enchantments in the new itemstack
EntityItem entityitem = new EntityItem(this.world, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, new ItemStack(itemstack.id, k, itemstack.getData(), itemstack.getEnchantments()));
float f3 = 0.05F;
entityitem.motX = (double) ((float) this.random.nextGaussian() * f3);
entityitem.motY = (double) ((float) this.random.nextGaussian() * f3 + 0.2F);
entityitem.motZ = (double) ((float) this.random.nextGaussian() * f3);
this.world.addEntity(entityitem);
}
}
}
this.a(Block.CHEST.id, 1, 0.0F);
} else if (this.type == 2) {
this.a(Block.FURNACE.id, 1, 0.0F);
}
}
return true;
} else {
return true;
}
}
}
@@ -322,6 +326,7 @@ public class EntityMinecart extends Entity implements IInventory {
int l = this.world.getTypeId(i, j, k);
if (BlockMinecartTrack.d(l)) {
this.fallDistance = 0.0F;
Vec3D vec3d = this.a(this.locX, this.locY, this.locZ);
int i1 = this.world.getData(i, j, k);
@@ -536,15 +541,15 @@ public class EntityMinecart extends Entity implements IInventory {
this.motX += this.motX / d21 * d22;
this.motZ += this.motZ / d21 * d22;
} else if (i1 == 1) {
if (this.world.s(i - 1, j, k)) {
if (this.world.t(i - 1, j, k)) {
this.motX = 0.02D;
} else if (this.world.s(i + 1, j, k)) {
} else if (this.world.t(i + 1, j, k)) {
this.motX = -0.02D;
}
} else if (i1 == 0) {
if (this.world.s(i, j, k - 1)) {
if (this.world.t(i, j, k - 1)) {
this.motZ = 0.02D;
} else if (this.world.s(i, j, k + 1)) {
} else if (this.world.t(i, j, k + 1)) {
this.motZ = -0.02D;
}
}
@@ -904,7 +909,7 @@ public class EntityMinecart extends Entity implements IInventory {
public void update() {}
public boolean c(EntityHuman entityhuman) {
public boolean a(EntityHuman entityhuman) {
if (this.type == 0) {
if (this.passenger != null && this.passenger instanceof EntityHuman && this.passenger != entityhuman) {
return true;
@@ -935,7 +940,7 @@ public class EntityMinecart extends Entity implements IInventory {
return true;
}
public boolean a(EntityHuman entityhuman) {
public boolean a_(EntityHuman entityhuman) {
return this.dead ? false : entityhuman.e(this) <= 64.0D;
}