mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-24 01:09:16 +00:00
Separate block resistance conditions
This commit is contained in:
@@ -5,17 +5,17 @@ Subject: [PATCH] Destroy Waterlogged Blocks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 243ac586aad29e3a145eec3c9a85b24901450121..c2edd4021fe2bdf96f58f6d402b767f911801cf6 100644
|
||||
index f4b17c01ee6552df325ea02a2f6da22b14f6e78f..154b636f04f979f4a3a2bc3a02a54258d3cf7646 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -284,7 +284,11 @@ public class Explosion {
|
||||
|
||||
@@ -285,6 +285,11 @@ public class Explosion {
|
||||
if (material != null && material.resistance() >= 0.0f && (this.level.sakuraConfig().cannons.explosion.allowNonTntBreakingDurableBlocks || this.source instanceof net.minecraft.world.entity.item.PrimedTnt)) {
|
||||
return Optional.of(material.resistance());
|
||||
+ // Sakura start - destroy water logged blocks
|
||||
+ } else if (!fluidState.isEmpty() && this.level.sakuraConfig().cannons.explosion.destroyWaterloggedBlocks) {
|
||||
+ return Optional.of(ZERO_RESISTANCE);
|
||||
}
|
||||
+ // Sakura start - destroy water logged blocks
|
||||
+ if (!fluidState.isEmpty() && this.level.sakuraConfig().cannons.explosion.destroyWaterloggedBlocks) {
|
||||
+ return Optional.of(ZERO_RESISTANCE);
|
||||
+ }
|
||||
+ // Sakura end - destroy water logged blocks
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Consistent Explosion Radius
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 9d9fe71897839d5ee7f3ec7467616021a8791a29..f7e01cb367b5b75f1f267d727b539066845d6e14 100644
|
||||
index 154b636f04f979f4a3a2bc3a02a54258d3cf7646..0a612539f0fc1b447396a8146312cafa6569174f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -75,6 +75,7 @@ public class Explosion {
|
||||
@@ -24,7 +24,7 @@ index 9d9fe71897839d5ee7f3ec7467616021a8791a29..f7e01cb367b5b75f1f267d727b539066
|
||||
}
|
||||
|
||||
// Sakura start - optimise paper explosions
|
||||
@@ -585,7 +587,7 @@ public class Explosion {
|
||||
@@ -586,7 +588,7 @@ public class Explosion {
|
||||
double d2 = CACHED_RAYS[ray + 2];
|
||||
ray += 3;
|
||||
// Paper end - optimise explosions
|
||||
|
||||
@@ -481,7 +481,7 @@ index df2a37e57012333a618937e61cb5a99c3ef4a0f9..62d40333c42f673479db5e6312343161
|
||||
// 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 b75f3527bad174cb309ffb34f6bf73540007cf53..73ccabd524ad24962ba790bb93e8494dff866166 100644
|
||||
index 0a612539f0fc1b447396a8146312cafa6569174f..86f493c8e8ba8e5fcd986ca8e151a4bdcc3ac4b6 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -76,6 +76,7 @@ public class Explosion {
|
||||
@@ -500,7 +500,7 @@ index b75f3527bad174cb309ffb34f6bf73540007cf53..73ccabd524ad24962ba790bb93e8494d
|
||||
}
|
||||
|
||||
// Sakura start - optimise paper explosions
|
||||
@@ -506,8 +508,12 @@ public class Explosion {
|
||||
@@ -507,8 +509,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;
|
||||
@@ -514,7 +514,7 @@ index b75f3527bad174cb309ffb34f6bf73540007cf53..73ccabd524ad24962ba790bb93e8494d
|
||||
}
|
||||
if (hitResult == HitResult.Type.MISS) {
|
||||
// Sakura end - replace density cache
|
||||
@@ -612,6 +618,14 @@ public class Explosion {
|
||||
@@ -613,6 +619,14 @@ public class Explosion {
|
||||
}
|
||||
|
||||
if (cachedBlock.outOfWorld) {
|
||||
@@ -529,7 +529,7 @@ index b75f3527bad174cb309ffb34f6bf73540007cf53..73ccabd524ad24962ba790bb93e8494d
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -717,9 +731,15 @@ public class Explosion {
|
||||
@@ -718,9 +732,15 @@ public class Explosion {
|
||||
|
||||
if (d7 <= 1.0D) {
|
||||
double d8 = entity.getX() - this.x;
|
||||
@@ -546,7 +546,7 @@ index b75f3527bad174cb309ffb34f6bf73540007cf53..73ccabd524ad24962ba790bb93e8494d
|
||||
|
||||
if (d11 != 0.0D) {
|
||||
d8 /= d11;
|
||||
@@ -1046,7 +1066,7 @@ public class Explosion {
|
||||
@@ -1047,7 +1067,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) {
|
||||
@@ -555,7 +555,7 @@ index b75f3527bad174cb309ffb34f6bf73540007cf53..73ccabd524ad24962ba790bb93e8494d
|
||||
this.level.densityCache.putDensity(vec3d, entity, blockDensity);
|
||||
// Sakura end - replace density cache
|
||||
}
|
||||
@@ -1054,6 +1074,17 @@ public class Explosion {
|
||||
@@ -1055,6 +1075,17 @@ public class Explosion {
|
||||
return blockDensity;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,15 +5,18 @@ Subject: [PATCH] Allow explosions to destroy lava
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index c5db31bd92a441eccd0f4c5ea1b8c7f17a00de65..fd53dff917b65b94eceb5796fc80b1a490454cc2 100644
|
||||
index 86f493c8e8ba8e5fcd986ca8e151a4bdcc3ac4b6..31cf85345c9638b72d2b2b218d48408a5988210b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -289,7 +289,7 @@ public class Explosion {
|
||||
if (material != null && material.resistance() >= 0.0f && (this.level.sakuraConfig().cannons.explosion.allowNonTntBreakingDurableBlocks || this.source instanceof net.minecraft.world.entity.item.PrimedTnt)) {
|
||||
return Optional.of(material.resistance());
|
||||
// Sakura start - destroy water logged blocks
|
||||
- } else if (!fluidState.isEmpty() && this.level.sakuraConfig().cannons.explosion.destroyWaterloggedBlocks) {
|
||||
+ } else if (!fluidState.isEmpty() && this.level.sakuraConfig().cannons.explosion.destroyWaterloggedBlocks || blockState.is(Blocks.LAVA) && this.level.sakuraConfig().cannons.explosion.explodeLava) { // Sakura - allow explosions to destroy lava
|
||||
@@ -294,6 +294,11 @@ public class Explosion {
|
||||
return Optional.of(ZERO_RESISTANCE);
|
||||
}
|
||||
// Sakura end - destroy water logged blocks
|
||||
+ // Sakura start - allow explosions to destroy lava
|
||||
+ if (blockState.is(Blocks.LAVA) && this.level.sakuraConfig().cannons.explosion.explodeLava) {
|
||||
+ return Optional.of(ZERO_RESISTANCE);
|
||||
+ }
|
||||
+ // Sakura end - allow explosions to destroy lava
|
||||
}
|
||||
|
||||
return this.damageCalculator.getBlockExplosionResistance((Explosion)(Object)this, this.level, pos, blockState, fluidState);
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add explosions dropping items config
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 4137fe261ae4934e80db2a8f1c0d6fb880839d8f..af71ce8f190e69ce1de758e6a551dbef817491be 100644
|
||||
index 31cf85345c9638b72d2b2b218d48408a5988210b..bc7a1d9bfbf6b9bdc9e987b8f06d7f5f8789847f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -939,6 +939,11 @@ public class Explosion {
|
||||
@@ -945,6 +945,11 @@ public class Explosion {
|
||||
this.level.densityCache.clear(-1);
|
||||
}
|
||||
// Sakura end - explosion density cache
|
||||
|
||||
@@ -5,18 +5,18 @@ Subject: [PATCH] Protect scaffolding from creepers
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index af71ce8f190e69ce1de758e6a551dbef817491be..7491de0a6dd7cf0288eb366c4809f2c92788469f 100644
|
||||
index bc7a1d9bfbf6b9bdc9e987b8f06d7f5f8789847f..c1f235a111428168dbf950635618badf3d48acdc 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -286,6 +286,11 @@ public class Explosion {
|
||||
Block block = blockState.getBlock();
|
||||
me.samsuik.sakura.explosion.durable.DurableMaterial material = this.level.localConfig().config(pos).durableMaterials.get(block);
|
||||
|
||||
@@ -299,6 +299,11 @@ public class Explosion {
|
||||
return Optional.of(ZERO_RESISTANCE);
|
||||
}
|
||||
// Sakura end - allow explosions to destroy lava
|
||||
+ // Sakura start - protect scaffolding from creepers
|
||||
+ if (this.level.sakuraConfig().cannons.explosion.protectScaffoldingFromCreepers && blockState.is(Blocks.SCAFFOLDING) && this.source instanceof net.minecraft.world.entity.monster.Creeper) {
|
||||
+ return Optional.of(Blocks.BARRIER.getExplosionResistance());
|
||||
+ }
|
||||
+ // Sakura end - protect scaffolding from creepers
|
||||
if (material != null && material.resistance() >= 0.0f && (this.level.sakuraConfig().cannons.explosion.allowNonTntBreakingDurableBlocks || this.source instanceof net.minecraft.world.entity.item.PrimedTnt)) {
|
||||
return Optional.of(material.resistance());
|
||||
// Sakura start - destroy water logged blocks
|
||||
}
|
||||
|
||||
return this.damageCalculator.getBlockExplosionResistance((Explosion)(Object)this, this.level, pos, blockState, fluidState);
|
||||
|
||||
Reference in New Issue
Block a user