mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-22 16:39:22 +00:00
Don't save primed TNT & falling block entity
Co-Authored-By: Nostal Yuu <yuu8583@proton.me>
This commit is contained in:
53
patches/server/0078-Don-t-save-primed-tnt-entity.patch
Normal file
53
patches/server/0078-Don-t-save-primed-tnt-entity.patch
Normal file
@@ -0,0 +1,53 @@
|
||||
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 dff0e7b08b973a1b29f916e63d3e4778d6c56cdc..92bcb38043de9623fb6e8139d5738d40c573b257 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -218,4 +218,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..01755f3f24fc2a89f71f2e3de48166e95253f418
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/dreeam/leaf/config/modules/opt/DontSaveEntity.java
|
||||
@@ -0,0 +1,25 @@
|
||||
+package org.dreeam.leaf.config.modules.opt;
|
||||
+
|
||||
+import org.dreeam.leaf.config.ConfigInfo;
|
||||
+import org.dreeam.leaf.config.EnumConfigCategory;
|
||||
+import org.dreeam.leaf.config.IConfigModule;
|
||||
+
|
||||
+public class DontSaveEntity implements IConfigModule {
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
+ return EnumConfigCategory.PERFORMANCE;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "dont_save_entity";
|
||||
+ }
|
||||
+
|
||||
+ @ConfigInfo(baseName = "dont-save-primed-tnt", comments = """
|
||||
+ Disable save primed tnt on chunk unloads.
|
||||
+ Useful for redstone server, can prevent machine be exploded by TNT,
|
||||
+ when player disconnected caused by Internet issue.
|
||||
+ """)
|
||||
+ public static boolean dontSavePrimedTNT = false;
|
||||
+}
|
||||
Reference in New Issue
Block a user