mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
Spawn ignore lc
This commit is contained in:
@@ -19,7 +19,7 @@ index a2f71a6d1a9e98133dff6cd0f625da9435a8af14..45897b81a822b9523c16658ca46a5077
|
||||
|
||||
new TimingsExport(listeners, parent, history).start();
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 57e7f83345afa462d329cea515c96fa2aa48a5e3..2e7850a1e0da1f2978b585312aefb46bf0d039e9 100644
|
||||
index 670f25370554c3f8c40d2fcc4f5a31d7a372f452..18b10f1d1d62e1184a562ef52e1625b4927aec45 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1118,6 +1118,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -128,10 +128,10 @@ index a53514f2c510b29f596c361de7bc0b405c27e964..269c7ba0707db4fdc45a70000e0be892
|
||||
.withRequiredArg()
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4d8063f34c91ec4fe5a926f9d46555ce0d5bd8d9
|
||||
index 0000000000000000000000000000000000000000..6156868aab660e8cccb8539dc38fb0e418487995
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
@@ -0,0 +1,767 @@
|
||||
@@ -0,0 +1,772 @@
|
||||
+package top.leavesmc.leaves;
|
||||
+
|
||||
+import com.destroystokyo.paper.util.SneakyThrow;
|
||||
@@ -724,6 +724,11 @@ index 0000000000000000000000000000000000000000..4d8063f34c91ec4fe5a926f9d46555ce
|
||||
+ shaveSnowLayers = getBoolean("settings.modify.shave-snow-layers", shaveSnowLayers);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean ignoreLC = false;
|
||||
+ private static void ignoreLC() {
|
||||
+ ignoreLC = getBoolean("settings.modify.ignore-lc", ignoreLC);
|
||||
+ }
|
||||
+
|
||||
+ public static final class WorldConfig {
|
||||
+
|
||||
+ public final String worldName;
|
||||
|
||||
55
patches/server/0075-Spawn-ignore-lc.patch
Normal file
55
patches/server/0075-Spawn-ignore-lc.patch
Normal file
@@ -0,0 +1,55 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Thu, 29 Jun 2023 22:40:24 +0800
|
||||
Subject: [PATCH] Spawn ignore lc
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
index 4327ec0948fb82939272f2dc1bbde8b1e090c5b7..35c8004c4228957d18edf305060a554583e2aeb1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
@@ -40,6 +40,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
+import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.structure.BuiltinStructures;
|
||||
import net.minecraft.world.level.levelgen.structure.Structure;
|
||||
@@ -208,6 +209,19 @@ public final class NaturalSpawner {
|
||||
}
|
||||
public static int spawnCategoryForChunk(MobCategory group, ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner, int maxSpawns, Consumer<Entity> trackEntity) {
|
||||
// Paper end - add parameters and int ret type
|
||||
+ // Leaves start - ignore lc
|
||||
+ if (top.leavesmc.leaves.LeavesConfig.ignoreLC) {
|
||||
+ int spawnN = 0;
|
||||
+ for (int i = chunk.getMinBuildHeight(); i < chunk.getMaxBuildHeight(); i += 16) {
|
||||
+ LevelChunkSection section = chunk.getSections()[chunk.getSectionIndex(i)];
|
||||
+ if (section != null && !section.hasOnlyAir()) {
|
||||
+ BlockPos pos = getRandomPosInChunk(world, chunk).offset(0, i, 0);
|
||||
+ spawnN += spawnCategoryForPosition(group, world, chunk, pos, checker, runner, maxSpawns, trackEntity);
|
||||
+ }
|
||||
+ }
|
||||
+ return spawnN;
|
||||
+ }
|
||||
+ // Leaves stop - ignore lc
|
||||
BlockPos blockposition = NaturalSpawner.getRandomPosWithin(world, chunk);
|
||||
|
||||
if (blockposition.getY() >= world.getMinBuildHeight() + 1) {
|
||||
@@ -216,6 +230,16 @@ public final class NaturalSpawner {
|
||||
return 0; // Paper
|
||||
}
|
||||
|
||||
+ // Leaves start - ignore lc
|
||||
+ private static BlockPos getRandomPosInChunk(Level world, LevelChunk chunk) {
|
||||
+ ChunkPos chunkPos = chunk.getPos();
|
||||
+ int x = chunkPos.getMinBlockX() + world.random.nextInt(16);
|
||||
+ int z = chunkPos.getMinBlockZ() + world.random.nextInt(16);
|
||||
+ int y = world.random.nextInt(16) + 1;
|
||||
+ return new BlockPos(x, y, z);
|
||||
+ }
|
||||
+ // Leaves stop - ignore lc
|
||||
+
|
||||
@VisibleForDebug
|
||||
public static void spawnCategoryForPosition(MobCategory group, ServerLevel world, BlockPos pos) {
|
||||
NaturalSpawner.spawnCategoryForPosition(group, world, world.getChunk(pos), pos, (entitytypes, blockposition1, ichunkaccess) -> {
|
||||
Reference in New Issue
Block a user