@@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/EntityEnderDragon.java 2014-11-28 17:43:43.081707435 +0000
|
||||
+++ src/main/java/net/minecraft/server/EntityEnderDragon.java 2014-11-28 17:38:21.000000000 +0000
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/EntityEnderDragon.java 2015-02-26 22:40:22.515608140 +0000
|
||||
+++ src/main/java/net/minecraft/server/EntityEnderDragon.java 2015-02-26 22:40:22.515608140 +0000
|
||||
@@ -5,6 +5,17 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -18,78 +18,28 @@
|
||||
public class EntityEnderDragon extends EntityInsentient implements IComplex, IMonster {
|
||||
|
||||
public double a;
|
||||
@@ -27,6 +38,7 @@
|
||||
private Entity by;
|
||||
public int bw;
|
||||
public EntityEnderCrystal bx;
|
||||
@@ -24,9 +35,10 @@
|
||||
public float bv;
|
||||
public boolean bw;
|
||||
public boolean bx;
|
||||
- private Entity bA;
|
||||
+ public Entity bA; // CraftBukkit - public
|
||||
public int by;
|
||||
public EntityEnderCrystal bz;
|
||||
+ private Explosion explosionSource = new Explosion(null, this, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, true); // CraftBukkit - reusable source for CraftTNTPrimed.getSource()
|
||||
|
||||
public EntityEnderDragon(World world) {
|
||||
super(world);
|
||||
@@ -120,21 +132,21 @@
|
||||
|
||||
if (this.world.isStatic) {
|
||||
if (this.ba > 0) {
|
||||
- d3 = this.locX + (this.bb - this.locX) / (double) this.ba;
|
||||
- d0 = this.locY + (this.bc - this.locY) / (double) this.ba;
|
||||
- d1 = this.locZ + (this.bd - this.locZ) / (double) this.ba;
|
||||
- d2 = MathHelper.g(this.be - (double) this.yaw);
|
||||
- this.yaw = (float) ((double) this.yaw + d2 / (double) this.ba);
|
||||
+ d0 = this.locX + (this.bb - this.locX) / (double) this.ba;
|
||||
+ d1 = this.locY + (this.bc - this.locY) / (double) this.ba;
|
||||
+ d2 = this.locZ + (this.bd - this.locZ) / (double) this.ba;
|
||||
+ d3 = MathHelper.g(this.be - (double) this.yaw);
|
||||
+ this.yaw = (float) ((double) this.yaw + d3 / (double) this.ba);
|
||||
this.pitch = (float) ((double) this.pitch + (this.bf - (double) this.pitch) / (double) this.ba);
|
||||
--this.ba;
|
||||
- this.setPosition(d3, d0, d1);
|
||||
+ this.setPosition(d0, d1, d2);
|
||||
this.setYawPitch(this.yaw, this.pitch);
|
||||
}
|
||||
} else {
|
||||
- d3 = this.a - this.locX;
|
||||
- d0 = this.b - this.locY;
|
||||
- d1 = this.c - this.locZ;
|
||||
- d2 = d3 * d3 + d0 * d0 + d1 * d1;
|
||||
+ d0 = this.a - this.locX;
|
||||
+ d1 = this.b - this.locY;
|
||||
+ d2 = this.c - this.locZ;
|
||||
+ d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||
double d4;
|
||||
|
||||
if (this.by != null) {
|
||||
@@ -155,16 +167,16 @@
|
||||
this.c += this.random.nextGaussian() * 2.0D;
|
||||
}
|
||||
|
||||
- if (this.bu || d2 < 100.0D || d2 > 22500.0D || this.positionChanged || this.E) {
|
||||
+ if (this.bu || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.E) {
|
||||
this.cd();
|
||||
}
|
||||
|
||||
- d0 /= (double) MathHelper.sqrt(d3 * d3 + d1 * d1);
|
||||
+ d1 /= (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
|
||||
f3 = 0.6F;
|
||||
- d0 = MathHelper.a(d0, (double) (-f3), (double) f3);
|
||||
- this.motY += d0 * 0.10000000149011612D;
|
||||
+ d1 = MathHelper.a(d1, (double) (-f3), (double) f3);
|
||||
+ this.motY += d1 * 0.10000000149011612D;
|
||||
this.yaw = MathHelper.g(this.yaw);
|
||||
- double d8 = 180.0D - Math.atan2(d3, d1) * 180.0D / 3.1415927410125732D;
|
||||
+ double d8 = 180.0D - Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D;
|
||||
double d9 = MathHelper.g(d8 - (double) this.yaw);
|
||||
|
||||
if (d9 > 50.0D) {
|
||||
@@ -290,12 +302,21 @@
|
||||
if (this.bx != null) {
|
||||
if (this.bx.dead) {
|
||||
if (!this.world.isStatic) {
|
||||
+ CraftEventFactory.entityDamage = this.bx; // CraftBukkit
|
||||
this.a(this.bl, DamageSource.explosion((Explosion) null), 10.0F);
|
||||
@@ -294,12 +306,21 @@
|
||||
if (this.bz != null) {
|
||||
if (this.bz.dead) {
|
||||
if (!this.world.isClientSide) {
|
||||
+ CraftEventFactory.entityDamage = this.bz; // CraftBukkit
|
||||
this.a(this.bn, DamageSource.explosion((Explosion) null), 10.0F);
|
||||
+ CraftEventFactory.entityDamage = null; // CraftBukkit
|
||||
}
|
||||
|
||||
this.bx = null;
|
||||
this.bz = null;
|
||||
} else if (this.ticksLived % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
|
||||
- this.setHealth(this.getHealth() + 1.0F);
|
||||
+ // CraftBukkit start
|
||||
@@ -103,11 +53,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,7 +385,19 @@
|
||||
@@ -368,7 +389,19 @@
|
||||
}
|
||||
|
||||
if (this.random.nextInt(2) == 0 && !arraylist.isEmpty()) {
|
||||
- this.by = (Entity) arraylist.get(this.random.nextInt(arraylist.size()));
|
||||
- this.bA = (Entity) arraylist.get(this.random.nextInt(arraylist.size()));
|
||||
+ // CraftBukkit start
|
||||
+ Entity target = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
|
||||
+ EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.RANDOM_TARGET);
|
||||
@@ -115,41 +65,41 @@
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ if (event.getTarget() == null) {
|
||||
+ this.by = null;
|
||||
+ this.bA = null;
|
||||
+ } else {
|
||||
+ this.by = ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle();
|
||||
+ this.bA = ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle();
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
boolean flag;
|
||||
|
||||
@@ -399,6 +432,11 @@
|
||||
int j1 = MathHelper.floor(axisalignedbb.f);
|
||||
@@ -404,6 +437,11 @@
|
||||
boolean flag = false;
|
||||
boolean flag1 = false;
|
||||
+
|
||||
|
||||
+ // CraftBukkit start - Create a list to hold all the destroyed blocks
|
||||
+ List<org.bukkit.block.Block> destroyedBlocks = new java.util.ArrayList<org.bukkit.block.Block>();
|
||||
+ org.bukkit.craftbukkit.CraftWorld craftWorld = this.world.getWorld();
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
for (int k1 = i; k1 <= l; ++k1) {
|
||||
for (int l1 = j; l1 <= i1; ++l1) {
|
||||
@@ -407,7 +445,11 @@
|
||||
for (int i2 = k; i2 <= j1; ++i2) {
|
||||
@@ -412,7 +450,11 @@
|
||||
|
||||
if (block.getMaterial() != Material.AIR) {
|
||||
if (block != Blocks.BARRIER && block != Blocks.OBSIDIAN && block != Blocks.END_STONE && block != Blocks.BEDROCK && block != Blocks.COMMAND_BLOCK && this.world.getGameRules().getBoolean("mobGriefing")) {
|
||||
- flag1 = this.world.setAir(new BlockPosition(k1, l1, i2)) || flag1;
|
||||
- flag1 = this.world.setAir(blockposition) || flag1;
|
||||
+ // CraftBukkit start - Add blocks to list rather than destroying them
|
||||
+ // flag1 = this.world.setAir(new BlockPosition(k1, l1, i2)) || flag1;
|
||||
+ // flag1 = this.world.setAir(new BlockPosition(blockposition)) || flag1;
|
||||
+ flag1 = true;
|
||||
+ destroyedBlocks.add(craftWorld.getBlockAt(k1, l1, i2));
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
@@ -417,6 +459,40 @@
|
||||
@@ -422,6 +464,40 @@
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
@@ -186,36 +136,36 @@
|
||||
+ this.world.setAir(new BlockPosition(blockX, blockY, blockZ));
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ // CraftBukkit end
|
||||
double d0 = axisalignedbb.a + (axisalignedbb.d - axisalignedbb.a) * (double) this.random.nextFloat();
|
||||
double d1 = axisalignedbb.b + (axisalignedbb.e - axisalignedbb.b) * (double) this.random.nextFloat();
|
||||
double d2 = axisalignedbb.c + (axisalignedbb.f - axisalignedbb.c) * (double) this.random.nextFloat();
|
||||
@@ -464,6 +540,7 @@
|
||||
@@ -469,6 +545,7 @@
|
||||
}
|
||||
|
||||
protected void aY() {
|
||||
protected void aZ() {
|
||||
+ if (this.dead) return; // CraftBukkit - can't kill what's already dead
|
||||
++this.bw;
|
||||
if (this.bw >= 180 && this.bw <= 200) {
|
||||
++this.by;
|
||||
if (this.by >= 180 && this.by <= 200) {
|
||||
float f = (this.random.nextFloat() - 0.5F) * 8.0F;
|
||||
@@ -478,7 +555,7 @@
|
||||
@@ -484,7 +561,7 @@
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
if (this.bw > 150 && this.bw % 5 == 0 && this.world.getGameRules().getBoolean("doMobLoot")) {
|
||||
if (!this.world.isClientSide) {
|
||||
if (this.by > 150 && this.by % 5 == 0 && flag) {
|
||||
- i = 1000;
|
||||
+ i = this.expToDrop / 12; // CraftBukkit - drop experience as dragon falls from sky. use experience drop from death event. This is now set in getExpReward()
|
||||
|
||||
while (i > 0) {
|
||||
j = EntityExperienceOrb.getOrbValue(i);
|
||||
@@ -488,14 +565,30 @@
|
||||
@@ -494,7 +571,23 @@
|
||||
}
|
||||
|
||||
if (this.bw == 1) {
|
||||
if (this.by == 1) {
|
||||
- this.world.a(1018, new BlockPosition(this), 0);
|
||||
+ // CraftBukkit start - Use relative location for far away sounds
|
||||
+ // this.world.a(1018, new BlockPosition(this), 0);
|
||||
+ int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
|
||||
+ for (EntityPlayer player : (List<EntityPlayer>) this.world.players) {
|
||||
+ for (EntityPlayer player : (List<EntityPlayer>) (List) this.world.players) {
|
||||
+ double deltaX = this.locX - player.locX;
|
||||
+ double deltaZ = this.locZ - player.locZ;
|
||||
+ double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
||||
@@ -232,25 +182,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
this.move(0.0D, 0.10000000149011612D, 0.0D);
|
||||
this.aG = this.yaw += 20.0F;
|
||||
if (this.bw == 200 && !this.world.isStatic) {
|
||||
- i = 2000;
|
||||
+ i = this.expToDrop - (10 * this.expToDrop / 12); // CraftBukkit - drop the remaining experience
|
||||
@@ -502,7 +595,7 @@
|
||||
this.aI = this.yaw += 20.0F;
|
||||
if (this.by == 200 && !this.world.isClientSide) {
|
||||
if (flag) {
|
||||
- i = 2000;
|
||||
+ i = this.expToDrop - (10 * this.expToDrop / 12); // CraftBukkit - drop the remaining experience
|
||||
|
||||
while (i > 0) {
|
||||
j = EntityExperienceOrb.getOrbValue(i);
|
||||
@@ -513,6 +606,9 @@
|
||||
boolean flag = true;
|
||||
while (i > 0) {
|
||||
j = EntityExperienceOrb.getOrbValue(i);
|
||||
@@ -522,6 +615,9 @@
|
||||
double d0 = 12.25D;
|
||||
double d1 = 6.25D;
|
||||
+
|
||||
|
||||
+ // CraftBukkit start - Replace any "this.world" in the following with just "world"!
|
||||
+ BlockStateListPopulator world = new BlockStateListPopulator(this.world.getWorld());
|
||||
|
||||
+
|
||||
for (int i = -1; i <= 32; ++i) {
|
||||
for (int j = -4; j <= 4; ++j) {
|
||||
@@ -524,31 +620,51 @@
|
||||
for (int k = -4; k <= 4; ++k) {
|
||||
@@ -532,31 +628,51 @@
|
||||
|
||||
if (i < 0) {
|
||||
if (d2 <= 6.25D) {
|
||||
@@ -315,8 +266,8 @@
|
||||
}
|
||||
|
||||
protected void D() {}
|
||||
@@ -576,4 +692,12 @@
|
||||
protected float bA() {
|
||||
@@ -584,4 +700,12 @@
|
||||
protected float bB() {
|
||||
return 5.0F;
|
||||
}
|
||||
+
|
||||
|
||||
Reference in New Issue
Block a user