9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2026-01-04 15:31:43 +00:00

Separate block resistance conditions

This commit is contained in:
Samsuik
2024-06-20 20:56:20 +01:00
parent 5acb2279d1
commit 30ff7213f0
6 changed files with 36 additions and 33 deletions

View File

@@ -474,7 +474,7 @@ index 7d5fdcf1e0b3cd46e12e1ae102eadb8f198a68c4..a17491a826accc23fbafcdf07ed66293
// Paper end - Option to prevent TNT from moving in water
}
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 7911b0dce3ebace1e28c7fc79c3e152a7601e017..79a08eebbbb74a8aadfe2a2b87e1009f58ad994e 100644
index f2543d250be7692dcebf29f19e34bd08961a60e0..bb16b526b512ebb15fedcc85c3f9b24693f7e00b 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -77,6 +77,7 @@ public class Explosion {
@@ -485,7 +485,7 @@ index 7911b0dce3ebace1e28c7fc79c3e152a7601e017..79a08eebbbb74a8aadfe2a2b87e1009f
// Paper start - optimise collisions
private static final double[] CACHED_RAYS;
@@ -451,6 +452,7 @@ public class Explosion {
@@ -452,6 +453,7 @@ public class Explosion {
this.explosionSound = soundEvent;
this.yield = this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F; // CraftBukkit
this.consistentRadius = world.localConfig().config(BlockPos.containing(x, y, z)).consistentRadius; // Sakura - consistent explosion radius
@@ -493,7 +493,7 @@ index 7911b0dce3ebace1e28c7fc79c3e152a7601e017..79a08eebbbb74a8aadfe2a2b87e1009f
}
private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) {
@@ -482,8 +484,12 @@ public class Explosion {
@@ -483,8 +485,12 @@ public class Explosion {
final float density = entity.level().densityCache.getKnownDensity(vec3d1);
if (density != me.samsuik.sakura.explosion.density.BlockDensityCache.UNKNOWN_DENSITY) {
hitResult = density != 0.0f ? net.minecraft.world.phys.HitResult.Type.MISS : net.minecraft.world.phys.HitResult.Type.BLOCK;
@@ -507,7 +507,7 @@ index 7911b0dce3ebace1e28c7fc79c3e152a7601e017..79a08eebbbb74a8aadfe2a2b87e1009f
}
if (hitResult == HitResult.Type.MISS) {
// Sakura end - replace density cache
@@ -579,6 +585,14 @@ public class Explosion {
@@ -580,6 +586,14 @@ public class Explosion {
}
if (cachedBlock.outOfWorld) {
@@ -522,7 +522,7 @@ index 7911b0dce3ebace1e28c7fc79c3e152a7601e017..79a08eebbbb74a8aadfe2a2b87e1009f
break;
}
// Paper end - collision optimisations
@@ -681,9 +695,15 @@ public class Explosion {
@@ -682,9 +696,15 @@ public class Explosion {
if (d7 <= 1.0D) {
double d8 = entity.getX() - this.x;
@@ -539,7 +539,7 @@ index 7911b0dce3ebace1e28c7fc79c3e152a7601e017..79a08eebbbb74a8aadfe2a2b87e1009f
if (d11 != 0.0D) {
d8 /= d11;
@@ -1022,7 +1042,7 @@ public class Explosion {
@@ -1023,7 +1043,7 @@ public class Explosion {
// Sakura start - replace density cache
float blockDensity = this.level.densityCache.getDensity(vec3d, entity);
if (blockDensity == me.samsuik.sakura.explosion.density.BlockDensityCache.UNKNOWN_DENSITY) {
@@ -548,7 +548,7 @@ index 7911b0dce3ebace1e28c7fc79c3e152a7601e017..79a08eebbbb74a8aadfe2a2b87e1009f
this.level.densityCache.putDensity(vec3d, entity, blockDensity);
// Sakura end - replace density cache
}
@@ -1030,6 +1050,17 @@ public class Explosion {
@@ -1031,6 +1051,17 @@ public class Explosion {
return blockDensity;
}