mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-22 16:29: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 7ff26a8df45547b430ff470c32cea81697413bba..9f4fbb9475ab011ab6b19e709b6673cd5c9d0895 100644
|
||||
index 0fdb87741c2f78a70a87a7e4036943be1830410b..529274e0fd3338254035b64742b18f2e009e1c6a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -283,7 +283,11 @@ public class Explosion {
|
||||
|
||||
@@ -284,6 +284,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 779285b59fec13274bb8de9927407e3145b110ac..e2a560846ed479309b18d8474b3c9f9d1f89bd5c 100644
|
||||
index 529274e0fd3338254035b64742b18f2e009e1c6a..cc936e4c842dfc84f134e5dc1e3d0cac30494b28 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -74,6 +74,7 @@ public class Explosion {
|
||||
@@ -24,7 +24,7 @@ index 779285b59fec13274bb8de9927407e3145b110ac..e2a560846ed479309b18d8474b3c9f9d
|
||||
}
|
||||
|
||||
// Sakura start - optimise paper explosions
|
||||
@@ -584,7 +586,7 @@ public class Explosion {
|
||||
@@ -585,7 +587,7 @@ public class Explosion {
|
||||
double d2 = CACHED_RAYS[ray + 2];
|
||||
ray += 3;
|
||||
// Paper end - optimise explosions
|
||||
|
||||
@@ -89,7 +89,7 @@ index 0611555b4afb461e2045585e3d81601420792c7c..ed492ba7df4ea041a1b5916a14eb2944
|
||||
if (distance != 0.0D) {
|
||||
x /= distance;
|
||||
diff --git a/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java b/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java
|
||||
index 39cd91c1e19585d24bbe1333bf15985b0d1a0dab..c4196a7b983efa9a53c1ef2339dc4ee5d6f3bfe2 100644
|
||||
index 5a1a576625b265c9b6d2d0968efedebf4be79166..6dbf75a5c2ed7cc86f24908d203460430ba616a7 100644
|
||||
--- a/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java
|
||||
+++ b/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java
|
||||
@@ -37,6 +37,13 @@ public final class TntExplosion extends SpecialisedExplosion<PrimedTnt> {
|
||||
@@ -487,7 +487,7 @@ index 2db76425a1f295ad179aacfb3abb7efb1be647d9..e7dd0c8aab980d9850a2124598f8a036
|
||||
// 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 e2a560846ed479309b18d8474b3c9f9d1f89bd5c..c1687a2867832387c9038eb8c7b6b2fcd3d836e1 100644
|
||||
index cc936e4c842dfc84f134e5dc1e3d0cac30494b28..5dabcc79200067fc6e97e7ae72f1ccd092eec418 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 {
|
||||
@@ -506,7 +506,7 @@ index e2a560846ed479309b18d8474b3c9f9d1f89bd5c..c1687a2867832387c9038eb8c7b6b2fc
|
||||
}
|
||||
|
||||
// Sakura start - optimise paper explosions
|
||||
@@ -505,8 +507,12 @@ public class Explosion {
|
||||
@@ -506,8 +508,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;
|
||||
@@ -520,7 +520,7 @@ index e2a560846ed479309b18d8474b3c9f9d1f89bd5c..c1687a2867832387c9038eb8c7b6b2fc
|
||||
}
|
||||
if (hitResult == HitResult.Type.MISS) {
|
||||
// Sakura end - replace density cache
|
||||
@@ -611,6 +617,14 @@ public class Explosion {
|
||||
@@ -612,6 +618,14 @@ public class Explosion {
|
||||
}
|
||||
|
||||
if (cachedBlock.outOfWorld) {
|
||||
@@ -535,7 +535,7 @@ index e2a560846ed479309b18d8474b3c9f9d1f89bd5c..c1687a2867832387c9038eb8c7b6b2fc
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -716,9 +730,15 @@ public class Explosion {
|
||||
@@ -717,9 +731,15 @@ public class Explosion {
|
||||
|
||||
if (d7 <= 1.0D) {
|
||||
double d8 = entity.getX() - this.x;
|
||||
@@ -552,7 +552,7 @@ index e2a560846ed479309b18d8474b3c9f9d1f89bd5c..c1687a2867832387c9038eb8c7b6b2fc
|
||||
|
||||
if (d11 != 0.0D) {
|
||||
d8 /= d11;
|
||||
@@ -1050,7 +1070,7 @@ public class Explosion {
|
||||
@@ -1051,7 +1071,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) {
|
||||
@@ -561,7 +561,7 @@ index e2a560846ed479309b18d8474b3c9f9d1f89bd5c..c1687a2867832387c9038eb8c7b6b2fc
|
||||
this.level.densityCache.putDensity(vec3d, entity, blockDensity);
|
||||
// Sakura end - replace density cache
|
||||
}
|
||||
@@ -1058,6 +1078,17 @@ public class Explosion {
|
||||
@@ -1059,6 +1079,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 c1687a2867832387c9038eb8c7b6b2fcd3d836e1..02ec223ad1275ecc7ecfe6a3b1152ed150b57178 100644
|
||||
index 5dabcc79200067fc6e97e7ae72f1ccd092eec418..0631bf063fed8462ebe014e733e8103bc7968ac9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -288,7 +288,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
|
||||
@@ -293,6 +293,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 02ec223ad1275ecc7ecfe6a3b1152ed150b57178..22007aa4c85befa80938adf3126bda12b8ff58c9 100644
|
||||
index 0631bf063fed8462ebe014e733e8103bc7968ac9..035b5ea9570668fa8aaafd7b757458343fd26456 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -943,6 +943,11 @@ public class Explosion {
|
||||
@@ -949,6 +949,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 22007aa4c85befa80938adf3126bda12b8ff58c9..bf3a05d9787eb64f384b67261ab9e04d7adf343f 100644
|
||||
index 035b5ea9570668fa8aaafd7b757458343fd26456..0f2fed57d94993d4f819a40b47503a62c60ac092 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -285,6 +285,11 @@ public class Explosion {
|
||||
Block block = blockState.getBlock();
|
||||
me.samsuik.sakura.explosion.durable.DurableMaterial material = this.level.localConfig().config(pos).durableMaterials.get(block);
|
||||
|
||||
@@ -298,6 +298,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