9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-21 07:49:22 +00:00
Files
Gale/patches/server/0047-Make-saving-fireworks-configurable.patch
2022-12-26 07:32:09 +01:00

64 lines
3.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Mon, 26 Dec 2022 07:30:30 +0100
Subject: [PATCH] Make saving fireworks configurable
License: MIT (https://opensource.org/licenses/MIT)
Gale - https://galemc.org
This patch is based on the following patch:
"Don't save Fireworks"
By: Aikar <aikar@aikar.co>
As part of: EmpireCraft (https://github.com/starlis/empirecraft)
Licensed under: MIT (https://opensource.org/licenses/MIT)
* EmpireCraft description *
Fireworks can bug out and not detonate, and an automated
launcher can very easily fill a chunk.
Prevent saving Fireworks so that chunk unloads will wipe a chunks fireworks in this case.
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
index 5406925cd66f46ab8744123c670d72cea7bfc3a1..0061af7c377793568f292be1850644dcca9e144a 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
@@ -358,4 +358,12 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
public boolean isAttackable() {
return false;
}
+
+ // Gale start - EMC - make saving fireworks configurable
+ @Override
+ public boolean shouldBeSaved() {
+ return this.level.galeConfig().smallOptimizations.saveFireworks;
+ }
+ // Gale end - EMC - make saving fireworks configurable
+
}
diff --git a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
index d34ee90eaf160a72d4898feed13d94b0b61eded3..ccc36bb32b99de79ccc157a695fd83f007e7d86a 100644
--- a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
+++ b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
@@ -33,6 +33,20 @@ public class GaleWorldConfiguration extends ConfigurationPart {
public SmallOptimizations smallOptimizations;
public class SmallOptimizations extends ConfigurationPart {
+ // Gale start - EMC - make saving fireworks configurable
+ /**
+ * Whether fireworks are saved when saving a chunk.
+ * <br>
+ * Fireworks can bug out and not detonate, and an automated launcher can very easily fill a chunk.
+ * If this option is true, chunk unloads will remove any fireworks, preventing this scenario.
+ * <ul>
+ * <li><i>Default</i>: true</li>
+ * <li><i>Vanilla</i>: true</li>
+ * </ul>
+ */
+ public boolean saveFireworks = true;
+ // Gale end - EMC - make saving fireworks configurable
+
// Gale start - Airplane - reduce projectile chunk loading
public MaxProjectileChunkLoads maxProjectileChunkLoads;
public class MaxProjectileChunkLoads extends ConfigurationPart {