mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-27 18:59:06 +00:00
Add option to disable non tnt entities destroying durable blocks
This commit is contained in:
@@ -608,10 +608,10 @@ index 0000000000000000000000000000000000000000..5fc23a0b579d7cbe03baf5324bef887a
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..027ab22474e56477453ef7402e04ec1c9116e379
|
||||
index 0000000000000000000000000000000000000000..0748b18159d787291f163ef38e574d3e325e2287
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java
|
||||
@@ -0,0 +1,142 @@
|
||||
@@ -0,0 +1,143 @@
|
||||
+package me.samsuik.sakura.configuration;
|
||||
+
|
||||
+import com.mojang.logging.LogUtils;
|
||||
@@ -691,6 +691,7 @@ index 0000000000000000000000000000000000000000..027ab22474e56477453ef7402e04ec1c
|
||||
+ map.put(Blocks.CHIPPED_ANVIL, new DurableMaterial(3, Blocks.END_STONE.getExplosionResistance()));
|
||||
+ map.put(Blocks.DAMAGED_ANVIL, new DurableMaterial(3, Blocks.END_STONE.getExplosionResistance()));
|
||||
+ });
|
||||
+ public boolean allowNonTNTBreakingDurableBlocks = false;
|
||||
+ public boolean destroyWaterloggedBlocks = false;
|
||||
+ public boolean consistentRadius = false;
|
||||
+ }
|
||||
|
||||
@@ -124,7 +124,7 @@ index a8008c7550488be34b51f4280f5569170b1ebd1d..b10cfec6da6dfab89e585c5d4d39ae04
|
||||
public String getDescriptionId() {
|
||||
return this.getOrCreateDescriptionId();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 11ce5591f5f7eb487323e2c828218af2461fca09..184da2f99fdcf0c3750457f38e754918efc6d0bb 100644
|
||||
index 11ce5591f5f7eb487323e2c828218af2461fca09..4abd9fe2c810057beb9d9d5c732d295325b011d7 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -198,6 +198,17 @@ public class Explosion {
|
||||
@@ -145,16 +145,18 @@ index 11ce5591f5f7eb487323e2c828218af2461fca09..184da2f99fdcf0c3750457f38e754918
|
||||
ret = new ExplosionBlockCache(
|
||||
key, pos, blockState, fluidState,
|
||||
(resistance.orElse(ZERO_RESISTANCE).floatValue() + 0.3f) * 0.3f,
|
||||
@@ -795,6 +806,14 @@ public class Explosion {
|
||||
@@ -795,6 +806,16 @@ public class Explosion {
|
||||
BlockPos blockposition = (BlockPos) objectlistiterator.next();
|
||||
BlockState iblockdata = this.level.getBlockState(blockposition);
|
||||
Block block = iblockdata.getBlock();
|
||||
+ // Sakura start - durable materials
|
||||
+ me.samsuik.sakura.explosion.durable.DurableMaterial material = level.localConfig().config(blockposition).durableMaterials.get(block);
|
||||
+ if (level.sakuraConfig().cannons.explosion.allowNonTNTBreakingDurableBlocks || source instanceof net.minecraft.world.entity.item.PrimedTnt) {
|
||||
+ me.samsuik.sakura.explosion.durable.DurableMaterial material = level.localConfig().config(blockposition).durableMaterials.get(block);
|
||||
+
|
||||
+ if (material != null && material.durability() >= 0 && !level.durabilityManager.damage(blockposition, material)) {
|
||||
+ objectlistiterator.remove();
|
||||
+ continue;
|
||||
+ if (material != null && material.durability() >= 0 && !level.durabilityManager.damage(blockposition, material)) {
|
||||
+ objectlistiterator.remove();
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ // Sakura end
|
||||
// CraftBukkit start - TNTPrimeEvent
|
||||
|
||||
@@ -366,7 +366,7 @@ index bf52aafe542ca735181e461d1f9cbc39b8d88220..87ef8f4953c7d9fddfc9ddbdb027e761
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index f25b15949f100b01e44a23832bc900d84f6cf1f1..e58ba1a6f0d17a75fa50dc01ff11cc72872f8714 100644
|
||||
index 16560ef566d3b37e2916be2bf96809556c8893ca..2fbe1da39e9176beededfb5a79e41f1f91bde5cd 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -52,6 +52,13 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
@@ -459,7 +459,7 @@ index f25b15949f100b01e44a23832bc900d84f6cf1f1..e58ba1a6f0d17a75fa50dc01ff11cc72
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 3dc6bd54890bc1fa0f2a3e76f9620a2bff3c1aef..22a06d109c647629e9eeb6847cc8dadfd4d72652 100644
|
||||
index ae727a3652b27706724be1936885da6eb36c50a5..1e67696d718c95e77023c4625948edd48c213363 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -69,6 +69,7 @@ public class Explosion {
|
||||
@@ -528,7 +528,7 @@ index 3dc6bd54890bc1fa0f2a3e76f9620a2bff3c1aef..22a06d109c647629e9eeb6847cc8dadf
|
||||
if (d11 != 0.0D) {
|
||||
d8 /= d11;
|
||||
d9 /= d11;
|
||||
@@ -985,7 +1006,14 @@ public class Explosion {
|
||||
@@ -987,7 +1008,14 @@ public class Explosion {
|
||||
return data.density();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user