SPIGOT-949: Fix damage cooldown reducing explosion knockback

This commit is contained in:
Jedediah Smith
2015-08-31 18:06:13 +10:00
committed by md_5
parent 53fac9f1b6
commit 9a17f01ff1
3 changed files with 44 additions and 38 deletions

View File

@@ -41,16 +41,17 @@
private static final AxisAlignedBB a = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
private static int entityCount;
private int id;
@@ -79,6 +111,8 @@
@@ -79,6 +111,9 @@
private boolean invulnerable;
protected UUID uniqueID;
private final CommandObjectiveExecutor au;
+ public boolean valid; // CraftBukkit
+ public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only
+ public boolean forceExplosionKnockback; // CraftBukkit - SPIGOT-949
public int getId() {
return this.id;
@@ -152,6 +186,33 @@
@@ -152,6 +187,33 @@
}
protected void setYawPitch(float f, float f1) {
@@ -84,7 +85,7 @@
this.yaw = f % 360.0F;
this.pitch = f1 % 360.0F;
}
@@ -188,7 +249,7 @@
@@ -188,7 +250,7 @@
int i = this.L();
if (this.ak) {
@@ -93,7 +94,7 @@
if (this.vehicle == null && this.al++ >= i) {
this.al = i;
this.portalCooldown = this.aq();
@@ -265,6 +326,27 @@
@@ -265,6 +327,27 @@
protected void burnFromLava() {
if (!this.fireProof) {
this.damageEntity(DamageSource.LAVA, 4.0F);
@@ -121,7 +122,7 @@
this.setOnFire(15);
}
}
@@ -302,6 +384,22 @@
@@ -302,6 +385,22 @@
this.a(this.getBoundingBox().c(d0, d1, d2));
this.recalcPosition();
} else {
@@ -144,7 +145,7 @@
this.world.methodProfiler.a("move");
double d3 = this.locX;
double d4 = this.locY;
@@ -522,6 +620,26 @@
@@ -522,6 +621,26 @@
block.a(this.world, this);
}
@@ -171,7 +172,7 @@
if (this.s_() && !flag && this.vehicle == null) {
double d21 = this.locX - d3;
double d22 = this.locY - d4;
@@ -532,7 +650,7 @@
@@ -532,7 +651,7 @@
}
if (block != null && this.onGround) {
@@ -180,7 +181,7 @@
}
this.M = (float) ((double) this.M + (double) MathHelper.sqrt(d21 * d21 + d23 * d23) * 0.6D);
@@ -550,9 +668,12 @@
@@ -550,9 +669,12 @@
}
this.a(blockposition, block);
@@ -193,7 +194,7 @@
try {
this.checkBlockCollisions();
} catch (Throwable throwable) {
@@ -562,6 +683,8 @@
@@ -562,6 +684,8 @@
this.appendEntityCrashDetails(crashreportsystemdetails);
throw new ReportedException(crashreport);
}
@@ -202,7 +203,7 @@
boolean flag2 = this.U();
@@ -569,7 +692,16 @@
@@ -569,7 +693,16 @@
this.burn(1);
if (!flag2) {
++this.fireTicks;
@@ -220,7 +221,7 @@
this.setOnFire(8);
}
}
@@ -675,7 +807,7 @@
@@ -675,7 +808,7 @@
return null;
}
@@ -229,7 +230,7 @@
if (!this.fireProof) {
this.damageEntity(DamageSource.FIRE, (float) i);
}
@@ -818,6 +950,13 @@
@@ -818,6 +951,13 @@
}
public void spawnIn(World world) {
@@ -243,7 +244,7 @@
this.world = world;
}
@@ -1010,6 +1149,18 @@
@@ -1010,6 +1150,18 @@
try {
nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY, this.locZ}));
nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ}));
@@ -262,7 +263,7 @@
nbttagcompound.set("Rotation", this.a(new float[] { this.yaw, this.pitch}));
nbttagcompound.setFloat("FallDistance", this.fallDistance);
nbttagcompound.setShort("Fire", (short) this.fireTicks);
@@ -1020,6 +1171,11 @@
@@ -1020,6 +1172,11 @@
nbttagcompound.setInt("PortalCooldown", this.portalCooldown);
nbttagcompound.setLong("UUIDMost", this.getUniqueID().getMostSignificantBits());
nbttagcompound.setLong("UUIDLeast", this.getUniqueID().getLeastSignificantBits());
@@ -274,7 +275,7 @@
if (this.getCustomName() != null && this.getCustomName().length() > 0) {
nbttagcompound.setString("CustomName", this.getCustomName());
nbttagcompound.setBoolean("CustomNameVisible", this.getCustomNameVisible());
@@ -1057,6 +1213,8 @@
@@ -1057,6 +1214,8 @@
this.motX = nbttaglist1.d(0);
this.motY = nbttaglist1.d(1);
this.motZ = nbttaglist1.d(2);
@@ -283,7 +284,7 @@
if (Math.abs(this.motX) > 10.0D) {
this.motX = 0.0D;
}
@@ -1068,6 +1226,7 @@
@@ -1068,6 +1227,7 @@
if (Math.abs(this.motZ) > 10.0D) {
this.motZ = 0.0D;
}
@@ -291,7 +292,7 @@
this.lastX = this.P = this.locX = nbttaglist.d(0);
this.lastY = this.Q = this.locY = nbttaglist.d(1);
@@ -1103,6 +1262,58 @@
@@ -1103,6 +1263,58 @@
this.setPosition(this.locX, this.locY, this.locZ);
}
@@ -350,7 +351,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
@@ -1164,6 +1375,12 @@
@@ -1164,6 +1376,12 @@
public EntityItem a(ItemStack itemstack, float f) {
if (itemstack.count != 0 && itemstack.getItem() != null) {
@@ -363,7 +364,7 @@
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY + (double) f, this.locZ, itemstack);
entityitem.p();
@@ -1277,17 +1494,70 @@
@@ -1277,17 +1495,70 @@
return (double) this.length * 0.75D;
}
@@ -434,7 +435,7 @@
if (this.vehicle != null) {
this.vehicle.passenger = null;
}
@@ -1406,10 +1676,49 @@
@@ -1406,10 +1677,49 @@
}
public void onLightningStrike(EntityLightning entitylightning) {
@@ -486,7 +487,7 @@
}
}
@@ -1550,32 +1859,83 @@
@@ -1550,32 +1860,83 @@
if (!this.world.isClientSide && !this.dead) {
this.world.methodProfiler.a("changeDimension");
MinecraftServer minecraftserver = MinecraftServer.getServer();
@@ -574,7 +575,7 @@
}
this.dead = true;
@@ -1670,6 +2030,11 @@
@@ -1670,6 +2031,11 @@
}
public void setCustomName(String s) {
@@ -586,7 +587,7 @@
this.datawatcher.watch(2, s);
}
@@ -1721,7 +2086,26 @@
@@ -1721,7 +2087,26 @@
}
public void a(AxisAlignedBB axisalignedbb) {