9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-22 16:29:26 +00:00
Files
Gale/patches/server/0099-Don-t-load-chunks-to-spawn-phantoms.patch
2024-08-18 23:18:01 -04:00

52 lines
3.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Sun, 25 Dec 2022 19:31:09 +0100
Subject: [PATCH] Don't load chunks to spawn phantoms
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
Gale - https://galemc.org
This patch is based on the following patch:
"Don't load chunks when spawning phantoms"
By: PureGero <puregero@gmail.com>
As part of: MultiPaper (https://github.com/MultiPaper/MultiPaper)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
index 1b1b475ca27e799e251d6f8a8c9fe1a4fd8bae83..ae1e164285f5675371bf036c8a564d9f5c1dd395 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
@@ -70,7 +70,15 @@ public class PhantomSpawner implements CustomSpawner {
if (randomsource.nextInt(j) >= world.paperConfig().entities.behavior.playerInsomniaStartTicks) { // Paper - Ability to control player's insomnia and phantoms
BlockPos blockposition1 = blockposition.above(20 + randomsource.nextInt(15)).east(-10 + randomsource.nextInt(21)).south(-10 + randomsource.nextInt(21));
- BlockState iblockdata = world.getBlockState(blockposition1);
+ // Gale start - MultiPaper - don't load chunks to spawn phantoms
+ BlockState iblockdata;
+ if (world.galeConfig().smallOptimizations.loadChunks.toSpawnPhantoms) {
+ iblockdata = world.getBlockState(blockposition1);
+ } else {
+ iblockdata = world.getBlockStateIfLoaded(blockposition1);
+ if (iblockdata == null) continue;
+ }
+ // Gale end - MultiPaper - don't load chunks to spawn phantoms
FluidState fluid = world.getFluidState(blockposition1);
if (NaturalSpawner.isValidEmptySpawnBlock(world, blockposition1, iblockdata, fluid, EntityType.PHANTOM)) {
diff --git a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
index fd5d02f8b1b1e2e84e6bda4885f091a000cbcbc9..e648d995fe9d2b44e66cb50e3f894b3524f77fef 100644
--- a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
+++ b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
@@ -92,6 +92,11 @@ public class GaleWorldConfiguration extends ConfigurationPart {
}
+ public LoadChunks loadChunks;
+ public class LoadChunks extends ConfigurationPart {
+ public boolean toSpawnPhantoms = false; // Gale - MultiPaper - don't load chunks to spawn phantoms
+ }
+
}
public GameplayMechanics gameplayMechanics;