From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Martijn Muijsers 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 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 288910fb168ddc5d3a61971778b8038a56772fa8..a9354adc79b71a206ef7d76f0c59b26478160fb6 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java @@ -357,4 +357,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 b3054f2fa77d3e2a4d568269d368f1cce7c00723..6f7fe7377532e87b8c5bf0d55cb4cb3f5619eb3e 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. + *
+ * 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. + * + */ + 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 {