9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-22 16:29:16 +00:00

Rename allow-non-tnt-breaking-durable-blocks

This commit is contained in:
Samsuik
2025-06-25 17:41:58 +01:00
parent e867f752dc
commit 5103f1c769
11 changed files with 73 additions and 23 deletions

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Explosion Durable Blocks
diff --git a/net/minecraft/world/item/BlockItem.java b/net/minecraft/world/item/BlockItem.java
index 2fbbbac9f1472354bd507926a85c25f48291edfe..e11f4c722b132340b9a48915bddf5ec6e55239ed 100644
index cc363ba3bc719d8b93992141d779b4c1d1bbd2fb..cdcaf954cec280970f29ac11db906457f18190c6 100644
--- a/net/minecraft/world/item/BlockItem.java
+++ b/net/minecraft/world/item/BlockItem.java
@@ -38,8 +38,31 @@ public class BlockItem extends Item {
@@ -41,7 +41,7 @@ index 2fbbbac9f1472354bd507926a85c25f48291edfe..e11f4c722b132340b9a48915bddf5ec6
return !interactionResult.consumesAction() && context.getItemInHand().has(DataComponents.CONSUMABLE)
? super.use(context.getLevel(), context.getPlayer(), context.getHand())
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index 99571af2e473cb14322625b0287b2f18fcf116d3..769887ee6d798d0b11de72e9ffe80c9d358daf17 100644
index c7a5d369e9889353242d8a70772b2c45684a6951..54d97a271e6a500f5e4ca74bcecbb0f8a1fd1ae2 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -830,6 +830,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@@ -53,7 +53,7 @@ index 99571af2e473cb14322625b0287b2f18fcf116d3..769887ee6d798d0b11de72e9ffe80c9d
protected Level(
WritableLevelData levelData,
diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java
index 6510ce55b9590fbfa50b70b56180840abf565731..ba067476b418fa81952a9f59528ca75eefd13746 100644
index 9f0dcaf0db44925c35fa46fdb2de83540ee959c4..48d98bac0140cec91fe2c9e7bb72a6f05a70aa49 100644
--- a/net/minecraft/world/level/ServerExplosion.java
+++ b/net/minecraft/world/level/ServerExplosion.java
@@ -131,7 +131,7 @@ public class ServerExplosion implements Explosion {
@@ -75,7 +75,7 @@ index 6510ce55b9590fbfa50b70b56180840abf565731..ba067476b418fa81952a9f59528ca75e
+ final Block block = blockState.getBlock();
+ final me.samsuik.sakura.explosion.durable.DurableMaterial material = this.level.localConfig().config(pos).durableMaterials.get(block);
+
+ if (material != null && material.resistance() >= 0.0f && pos.getY() > this.level.getMinY() && (this.level.sakuraConfig().cannons.explosion.allowNonTntBreakingDurableBlocks || this.source instanceof net.minecraft.world.entity.item.PrimedTnt)) {
+ if (material != null && material.resistance() >= 0.0f && pos.getY() > this.level.getMinY() && (!this.level.sakuraConfig().cannons.explosion.requireTntToDamageDurableMaterials || this.source instanceof net.minecraft.world.entity.item.PrimedTnt)) {
+ return Optional.of(material.resistance());
+ }
+ }
@@ -91,7 +91,7 @@ index 6510ce55b9590fbfa50b70b56180840abf565731..ba067476b418fa81952a9f59528ca75e
}
// CraftBukkit end
+ // Sakura start - explosion durable blocks
+ if (this.level.sakuraConfig().cannons.explosion.allowNonTntBreakingDurableBlocks || this.source instanceof net.minecraft.world.entity.item.PrimedTnt) {
+ if (!this.level.sakuraConfig().cannons.explosion.requireTntToDamageDurableMaterials || this.source instanceof net.minecraft.world.entity.item.PrimedTnt) {
+ final me.samsuik.sakura.explosion.durable.DurableMaterial material = this.level.localConfig().config(blockPos).durableMaterials.get(block);
+ if (material != null && material.durability() >= 0 && !this.level.durabilityManager.damage(blockPos, material)) {
+ continue;