mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-23 17:09:29 +00:00
55 lines
2.4 KiB
Diff
55 lines
2.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: nostalfinals <yuu8583@proton.me>
|
|
Date: Mon, 29 Apr 2024 23:30:21 +0800
|
|
Subject: [PATCH] Don't save primed tnt entity
|
|
|
|
|
|
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 287ba483614e79e78022e703ef891f59f41ac455..bee0b636685097ee53994ec1a6ffbcf6eed87032 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
|
@@ -276,4 +276,11 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
|
return super.interact(player, hand);
|
|
}
|
|
// Purpur end - Shears can defuse TNT
|
|
+
|
|
+ // Leaf start - PMC - Don't save primed tnt entity
|
|
+ @Override
|
|
+ public boolean shouldBeSaved() {
|
|
+ return !org.dreeam.leaf.config.modules.opt.DontSaveEntity.dontSavePrimedTNT && super.shouldBeSaved();
|
|
+ }
|
|
+ // Leaf - PMC - Don't save primed tnt entity
|
|
}
|
|
diff --git a/src/main/java/org/dreeam/leaf/config/modules/opt/DontSaveEntity.java b/src/main/java/org/dreeam/leaf/config/modules/opt/DontSaveEntity.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..43c9fcc5a27d523d00656e058c46c34f36da8b63
|
|
--- /dev/null
|
|
+++ b/src/main/java/org/dreeam/leaf/config/modules/opt/DontSaveEntity.java
|
|
@@ -0,0 +1,26 @@
|
|
+package org.dreeam.leaf.config.modules.opt;
|
|
+
|
|
+import org.dreeam.leaf.config.ConfigModules;
|
|
+import org.dreeam.leaf.config.EnumConfigCategory;
|
|
+
|
|
+public class DontSaveEntity extends ConfigModules {
|
|
+
|
|
+ public String getBasePath() {
|
|
+ return EnumConfigCategory.PERF.getBaseKeyName() + ".dont-save-entity";
|
|
+ }
|
|
+
|
|
+ public static boolean dontSavePrimedTNT = false;
|
|
+
|
|
+ @Override
|
|
+ public void onLoaded() {
|
|
+ dontSavePrimedTNT = config.getBoolean(getBasePath() + ".dont-save-primed-tnt", dontSavePrimedTNT,
|
|
+ config.pickStringRegionBased(
|
|
+ """
|
|
+ Disable save primed tnt on chunk unloads.
|
|
+ Useful for redstone/technical servers, can prevent machines from being exploded by TNT,
|
|
+ when player disconnected caused by Internet issue.""",
|
|
+ """
|
|
+ 区块卸载时不保存掉落的方块和激活的 TNT,
|
|
+ 可以避免在玩家掉线时机器被炸毁."""));
|
|
+ }
|
|
+}
|