geforkt von Mirrors/Paper
Make things explodes via patches
Dieser Commit ist enthalten in:
Ursprung
c730cdcecf
Commit
d7874011e2
@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -0,0 +0,0 @@ public class Explosion {
|
||||
this.damageCalculator = behavior == null ? this.makeDamageCalculator(entity) : behavior;
|
||||
this.yield = this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F; // CraftBukkit
|
||||
}
|
||||
|
||||
+ // Paper start - optimise collisions
|
||||
@ -403,10 +403,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- if (optional.isPresent()) {
|
||||
- f -= ((Float) optional.get() + 0.3F) * 0.3F;
|
||||
- }
|
||||
+ if (!iblockdata.isDestroyable()) continue; // Paper
|
||||
+ // Paper - optimise explosions
|
||||
|
||||
-
|
||||
- if (f > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockposition, iblockdata, f)) {
|
||||
+ if (!iblockdata.isDestroyable()) continue; // Paper
|
||||
+ // Paper - optimise explosions
|
||||
+
|
||||
+ f -= cachedBlock.resistance; // Paper - optimise explosions
|
||||
@ -448,23 +447,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
@@ -0,0 +0,0 @@ public class Explosion {
|
||||
d8 /= d11;
|
||||
d9 /= d11;
|
||||
d10 /= d11;
|
||||
- double d12 = this.getBlockDensity(vec3d, entity); // Paper - Optimize explosions
|
||||
+ double d12 = this.getBlockDensity(vec3d, entity, blockCache, blockPos); // Paper - Optimize explosions // Paper - optimise explosions
|
||||
double d13 = (1.0D - d7) * d12;
|
||||
|
||||
// CraftBukkit start
|
||||
@@ -0,0 +0,0 @@ public class Explosion {
|
||||
for (EnderDragonPart entityComplexPart : ((EnderDragon) entity).subEntities) {
|
||||
// Calculate damage separately for each EntityComplexPart
|
||||
double d7part;
|
||||
if (list.contains(entityComplexPart) && (d7part = Math.sqrt(entityComplexPart.distanceToSqr(vec3d)) / f2) <= 1.0D) {
|
||||
- double d13part = (1.0D - d7part) * Explosion.getSeenPercent(vec3d, entityComplexPart);
|
||||
+ double d13part = (1.0D - d7part) * this.getSeenFraction(vec3d, entityComplexPart, blockCache, blockPos); // Paper - optimise explosions
|
||||
entityComplexPart.hurt(this.getDamageSource(), (float) ((int) ((d13part * d13part + d13part) / 2.0D * 7.0D * (double) f2 + 1.0D)));
|
||||
if (list.contains(entityComplexPart)) {
|
||||
- entityComplexPart.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity));
|
||||
+ entityComplexPart.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity, getSeenFraction(vec3d, entityComplexPart, blockCache, blockPos))); // Paper - actually optimise explosions
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -0,0 +0,0 @@ public class Explosion {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
- double d12 = (1.0D - d7) * this.getBlockDensity(vec3d, entity); // Paper - Optimize explosions
|
||||
+ double d12 = (1.0D - d7) * this.getBlockDensity(vec3d, entity, blockCache, blockPos); // Paper - Optimize explosions
|
||||
double d13;
|
||||
|
||||
if (entity instanceof LivingEntity) {
|
||||
@@ -0,0 +0,0 @@ public class Explosion {
|
||||
}
|
||||
}
|
||||
@ -472,7 +471,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ this.blockCache = null; // Paper - optimise explosions
|
||||
+ this.chunkPosCache = null; // Paper - optimise explosions
|
||||
+ this.chunkCache = null; // Paper - optimise explosions
|
||||
+
|
||||
}
|
||||
|
||||
public void finalizeExplosion(boolean particles) {
|
||||
@ -494,3 +492,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.level.explosionDensityCache.put(key, blockDensity);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java b/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java
|
||||
@@ -0,0 +0,0 @@ public class ExplosionDamageCalculator {
|
||||
}
|
||||
|
||||
public float getEntityDamageAmount(Explosion explosion, Entity entity) {
|
||||
+ // Paper start - actually optimise explosions
|
||||
+ return this.getEntityDamageAmount(explosion, entity, Explosion.getSeenPercent(explosion.center(), entity));
|
||||
+ }
|
||||
+ public float getEntityDamageAmount(Explosion explosion, Entity entity, double seenPercent) {
|
||||
+ // Paper end - actually optimise explosions
|
||||
float f = explosion.radius() * 2.0F;
|
||||
Vec3 vec3 = explosion.center();
|
||||
double d = Math.sqrt(entity.distanceToSqr(vec3)) / (double)f;
|
||||
- double e = (1.0D - d) * (double)Explosion.getSeenPercent(vec3, entity);
|
||||
+ double e = (1.0D - d) * seenPercent; // Paper - actually optimise explosions
|
||||
return (float)((e * e + e) / 2.0D * 7.0D * (double)f + 1.0D);
|
||||
}
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren