mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-23 17:09:29 +00:00
Fix Pufferfish optimize mob spawning
This commit is contained in:
254
patches/server/0003-Pufferfish-Utils.patch
Normal file
254
patches/server/0003-Pufferfish-Utils.patch
Normal file
@@ -0,0 +1,254 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kevin Raneri <kevin.raneri@gmail.com>
|
||||||
|
Date: Tue, 9 Nov 2021 23:36:56 -0500
|
||||||
|
Subject: [PATCH] Pufferfish: Utils
|
||||||
|
|
||||||
|
Original license: GPL v3
|
||||||
|
Original project: https://github.com/pufferfish-gg/Pufferfish
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java
|
||||||
|
index 41b9405d6759d865e0d14dd4f95163e9690e967d..091b1ae822e1c0517e59572e7a9bda11e998c0ee 100644
|
||||||
|
--- a/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java
|
||||||
|
+++ b/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java
|
||||||
|
@@ -26,7 +26,7 @@ public abstract class AreaMap<E> {
|
||||||
|
|
||||||
|
// we use linked for better iteration.
|
||||||
|
// map of: coordinate to set of objects in coordinate
|
||||||
|
- protected final Long2ObjectOpenHashMap<PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<E>> areaMap = new Long2ObjectOpenHashMap<>(1024, 0.7f);
|
||||||
|
+ protected Long2ObjectOpenHashMap<PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<E>> areaMap = new Long2ObjectOpenHashMap<>(1024, 0.7f); // Pufferfish - not actually final
|
||||||
|
protected final PooledLinkedHashSets<E> pooledHashSets;
|
||||||
|
|
||||||
|
protected final ChangeCallback<E> addCallback;
|
||||||
|
@@ -160,7 +160,8 @@ public abstract class AreaMap<E> {
|
||||||
|
protected abstract PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<E> getEmptySetFor(final E object);
|
||||||
|
|
||||||
|
// expensive op, only for debug
|
||||||
|
- protected void validate(final E object, final int viewDistance) {
|
||||||
|
+ protected void validate0(final E object, final int viewDistance) { // Pufferfish - rename this thing just in case it gets used I'd rather a compile time error.
|
||||||
|
+ if (true) throw new UnsupportedOperationException(); // Pufferfish - not going to put in the effort to fix this if it doesn't ever get used.
|
||||||
|
int entiesGot = 0;
|
||||||
|
int expectedEntries = (2 * viewDistance + 1);
|
||||||
|
expectedEntries *= expectedEntries;
|
||||||
|
diff --git a/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java
|
||||||
|
index 46954db7ecd35ac4018fdf476df7c8020d7ce6c8..1ad890a244bdf6df48a8db68cb43450e08c788a6 100644
|
||||||
|
--- a/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java
|
||||||
|
+++ b/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java
|
||||||
|
@@ -5,7 +5,7 @@ import net.minecraft.server.level.ServerPlayer;
|
||||||
|
/**
|
||||||
|
* @author Spottedleaf
|
||||||
|
*/
|
||||||
|
-public final class PlayerAreaMap extends AreaMap<ServerPlayer> {
|
||||||
|
+public class PlayerAreaMap extends AreaMap<ServerPlayer> { // Pufferfish - not actually final
|
||||||
|
|
||||||
|
public PlayerAreaMap() {
|
||||||
|
super();
|
||||||
|
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishLogger.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishLogger.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..53f2df00c6809618a9ee3d2ea72e85e8052fbcf1
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishLogger.java
|
||||||
|
@@ -0,0 +1,16 @@
|
||||||
|
+package gg.pufferfish.pufferfish;
|
||||||
|
+
|
||||||
|
+import java.util.logging.Level;
|
||||||
|
+import java.util.logging.Logger;
|
||||||
|
+import org.bukkit.Bukkit;
|
||||||
|
+
|
||||||
|
+public class PufferfishLogger extends Logger {
|
||||||
|
+ public static final PufferfishLogger LOGGER = new PufferfishLogger();
|
||||||
|
+
|
||||||
|
+ private PufferfishLogger() {
|
||||||
|
+ super("Pufferfish", null);
|
||||||
|
+
|
||||||
|
+ setParent(Bukkit.getLogger());
|
||||||
|
+ setLevel(Level.ALL);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
diff --git a/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java b/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..0fe6243ea01f39fc43c4ca8897a70feddb7fb11d
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java
|
||||||
|
@@ -0,0 +1,73 @@
|
||||||
|
+package gg.pufferfish.pufferfish.util;
|
||||||
|
+
|
||||||
|
+import com.google.common.collect.Queues;
|
||||||
|
+import gg.pufferfish.pufferfish.PufferfishLogger;
|
||||||
|
+import java.util.Queue;
|
||||||
|
+import java.util.concurrent.locks.Condition;
|
||||||
|
+import java.util.concurrent.locks.Lock;
|
||||||
|
+import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
+import java.util.logging.Level;
|
||||||
|
+
|
||||||
|
+public class AsyncExecutor implements Runnable {
|
||||||
|
+
|
||||||
|
+ private final Queue<Runnable> jobs = Queues.newArrayDeque();
|
||||||
|
+ private final Lock mutex = new ReentrantLock();
|
||||||
|
+ private final Condition cond = mutex.newCondition();
|
||||||
|
+ private final Thread thread;
|
||||||
|
+ private volatile boolean killswitch = false;
|
||||||
|
+
|
||||||
|
+ public AsyncExecutor(String threadName) {
|
||||||
|
+ this.thread = new Thread(this, threadName);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void start() {
|
||||||
|
+ thread.start();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void kill() {
|
||||||
|
+ killswitch = true;
|
||||||
|
+ cond.signalAll();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void submit(Runnable runnable) {
|
||||||
|
+ mutex.lock();
|
||||||
|
+ try {
|
||||||
|
+ jobs.offer(runnable);
|
||||||
|
+ cond.signalAll();
|
||||||
|
+ } finally {
|
||||||
|
+ mutex.unlock();
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void run() {
|
||||||
|
+ while (!killswitch) {
|
||||||
|
+ try {
|
||||||
|
+ Runnable runnable = takeRunnable();
|
||||||
|
+ if (runnable != null) {
|
||||||
|
+ runnable.run();
|
||||||
|
+ }
|
||||||
|
+ } catch (InterruptedException e) {
|
||||||
|
+ Thread.currentThread().interrupt();
|
||||||
|
+ } catch (Exception e) {
|
||||||
|
+ PufferfishLogger.LOGGER.log(Level.SEVERE, e, () -> "Failed to execute async job for thread " + thread.getName());
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private Runnable takeRunnable() throws InterruptedException {
|
||||||
|
+ mutex.lock();
|
||||||
|
+ try {
|
||||||
|
+ while (jobs.isEmpty() && !killswitch) {
|
||||||
|
+ cond.await();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (jobs.isEmpty()) return null; // We've set killswitch
|
||||||
|
+
|
||||||
|
+ return jobs.remove();
|
||||||
|
+ } finally {
|
||||||
|
+ mutex.unlock();
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+}
|
||||||
|
diff --git a/src/main/java/gg/pufferfish/pufferfish/util/AsyncPlayerAreaMap.java b/src/main/java/gg/pufferfish/pufferfish/util/AsyncPlayerAreaMap.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..a93ee99c2399def1e221260547a3e6bce2d621fa
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/gg/pufferfish/pufferfish/util/AsyncPlayerAreaMap.java
|
||||||
|
@@ -0,0 +1,31 @@
|
||||||
|
+package gg.pufferfish.pufferfish.util;
|
||||||
|
+
|
||||||
|
+import com.destroystokyo.paper.util.misc.PlayerAreaMap;
|
||||||
|
+import com.destroystokyo.paper.util.misc.PooledLinkedHashSets;
|
||||||
|
+import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
+import net.minecraft.server.level.ServerPlayer;
|
||||||
|
+
|
||||||
|
+public final class AsyncPlayerAreaMap extends PlayerAreaMap {
|
||||||
|
+
|
||||||
|
+ public AsyncPlayerAreaMap() {
|
||||||
|
+ super();
|
||||||
|
+ this.areaMap = new Long2ObjectOpenHashMapWrapper<>(new ConcurrentHashMap<>(1024, 0.7f));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public AsyncPlayerAreaMap(final PooledLinkedHashSets<ServerPlayer> pooledHashSets) {
|
||||||
|
+ super(pooledHashSets);
|
||||||
|
+ this.areaMap = new Long2ObjectOpenHashMapWrapper<>(new ConcurrentHashMap<>(1024, 0.7f));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public AsyncPlayerAreaMap(final PooledLinkedHashSets<ServerPlayer> pooledHashSets, final ChangeCallback<ServerPlayer> addCallback,
|
||||||
|
+ final ChangeCallback<ServerPlayer> removeCallback) {
|
||||||
|
+ this(pooledHashSets, addCallback, removeCallback, null);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public AsyncPlayerAreaMap(final PooledLinkedHashSets<ServerPlayer> pooledHashSets, final ChangeCallback<ServerPlayer> addCallback,
|
||||||
|
+ final ChangeCallback<ServerPlayer> removeCallback, final ChangeSourceCallback<ServerPlayer> changeSourceCallback) {
|
||||||
|
+ super(pooledHashSets, addCallback, removeCallback, changeSourceCallback);
|
||||||
|
+ this.areaMap = new Long2ObjectOpenHashMapWrapper<>(new ConcurrentHashMap<>(1024, 0.7f));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+}
|
||||||
|
diff --git a/src/main/java/gg/pufferfish/pufferfish/util/IterableWrapper.java b/src/main/java/gg/pufferfish/pufferfish/util/IterableWrapper.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..c1929840254a3e6d721816f4a20415bea1742580
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/gg/pufferfish/pufferfish/util/IterableWrapper.java
|
||||||
|
@@ -0,0 +1,20 @@
|
||||||
|
+package gg.pufferfish.pufferfish.util;
|
||||||
|
+
|
||||||
|
+import java.util.Iterator;
|
||||||
|
+import org.jetbrains.annotations.NotNull;
|
||||||
|
+
|
||||||
|
+public class IterableWrapper<T> implements Iterable<T> {
|
||||||
|
+
|
||||||
|
+ private final Iterator<T> iterator;
|
||||||
|
+
|
||||||
|
+ public IterableWrapper(Iterator<T> iterator) {
|
||||||
|
+ this.iterator = iterator;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @NotNull
|
||||||
|
+ @Override
|
||||||
|
+ public Iterator<T> iterator() {
|
||||||
|
+ return iterator;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+}
|
||||||
|
diff --git a/src/main/java/gg/pufferfish/pufferfish/util/Long2ObjectOpenHashMapWrapper.java b/src/main/java/gg/pufferfish/pufferfish/util/Long2ObjectOpenHashMapWrapper.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..42cdc43d6b739973a0944f502089757247ee6c61
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/gg/pufferfish/pufferfish/util/Long2ObjectOpenHashMapWrapper.java
|
||||||
|
@@ -0,0 +1,40 @@
|
||||||
|
+package gg.pufferfish.pufferfish.util;
|
||||||
|
+
|
||||||
|
+import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||||
|
+import java.util.Map;
|
||||||
|
+import org.jetbrains.annotations.Nullable;
|
||||||
|
+
|
||||||
|
+public class Long2ObjectOpenHashMapWrapper<V> extends Long2ObjectOpenHashMap<V> {
|
||||||
|
+
|
||||||
|
+ private final Map<Long, V> backingMap;
|
||||||
|
+
|
||||||
|
+ public Long2ObjectOpenHashMapWrapper(Map<Long, V> map) {
|
||||||
|
+ backingMap = map;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public V put(Long key, V value) {
|
||||||
|
+ return backingMap.put(key, value);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public V get(Object key) {
|
||||||
|
+ return backingMap.get(key);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public V remove(Object key) {
|
||||||
|
+ return backingMap.remove(key);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Nullable
|
||||||
|
+ @Override
|
||||||
|
+ public V putIfAbsent(Long key, V value) {
|
||||||
|
+ return backingMap.putIfAbsent(key, value);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public int size() {
|
||||||
|
+ return backingMap.size();
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
@@ -19,138 +19,6 @@ this can result in performance gains of up to 15%, which is significant
|
|||||||
and, in my opinion, worth the low risk of minor mob-spawning-related
|
and, in my opinion, worth the low risk of minor mob-spawning-related
|
||||||
inconsistencies.
|
inconsistencies.
|
||||||
|
|
||||||
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishLogger.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishLogger.java
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000000000000000000000000000000000000..dd5e1381754a158c10704d525a02092008be4c56
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishLogger.java
|
|
||||||
@@ -0,0 +1,17 @@
|
|
||||||
+package gg.pufferfish.pufferfish;
|
|
||||||
+
|
|
||||||
+import java.util.logging.Level;
|
|
||||||
+import java.util.logging.Logger;
|
|
||||||
+
|
|
||||||
+import org.bukkit.Bukkit;
|
|
||||||
+
|
|
||||||
+public class PufferfishLogger extends Logger {
|
|
||||||
+ public static final PufferfishLogger LOGGER = new PufferfishLogger();
|
|
||||||
+
|
|
||||||
+ private PufferfishLogger() {
|
|
||||||
+ super("Pufferfish", null);
|
|
||||||
+
|
|
||||||
+ setParent(Bukkit.getLogger());
|
|
||||||
+ setLevel(Level.ALL);
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
\ No newline at end of file
|
|
||||||
diff --git a/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java b/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000000000000000000000000000000000000..23c959cd4075f375887b0d6868120223a65c8980
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java
|
|
||||||
@@ -0,0 +1,74 @@
|
|
||||||
+package gg.pufferfish.pufferfish.util;
|
|
||||||
+
|
|
||||||
+import com.google.common.collect.Queues;
|
|
||||||
+import gg.pufferfish.pufferfish.PufferfishLogger;
|
|
||||||
+
|
|
||||||
+import java.util.Queue;
|
|
||||||
+import java.util.concurrent.locks.Condition;
|
|
||||||
+import java.util.concurrent.locks.Lock;
|
|
||||||
+import java.util.concurrent.locks.ReentrantLock;
|
|
||||||
+import java.util.logging.Level;
|
|
||||||
+
|
|
||||||
+public class AsyncExecutor implements Runnable {
|
|
||||||
+
|
|
||||||
+ private final Queue<Runnable> jobs = Queues.newArrayDeque();
|
|
||||||
+ private final Lock mutex = new ReentrantLock();
|
|
||||||
+ private final Condition cond = mutex.newCondition();
|
|
||||||
+ private final Thread thread;
|
|
||||||
+ private volatile boolean killswitch = false;
|
|
||||||
+
|
|
||||||
+ public AsyncExecutor(String threadName) {
|
|
||||||
+ this.thread = new Thread(this, threadName);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public void start() {
|
|
||||||
+ thread.start();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public void kill() {
|
|
||||||
+ killswitch = true;
|
|
||||||
+ cond.signalAll();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public void submit(Runnable runnable) {
|
|
||||||
+ mutex.lock();
|
|
||||||
+ try {
|
|
||||||
+ jobs.offer(runnable);
|
|
||||||
+ cond.signalAll();
|
|
||||||
+ } finally {
|
|
||||||
+ mutex.unlock();
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public void run() {
|
|
||||||
+ while (!killswitch) {
|
|
||||||
+ try {
|
|
||||||
+ Runnable runnable = takeRunnable();
|
|
||||||
+ if (runnable != null) {
|
|
||||||
+ runnable.run();
|
|
||||||
+ }
|
|
||||||
+ } catch (InterruptedException e) {
|
|
||||||
+ Thread.currentThread().interrupt();
|
|
||||||
+ } catch (Exception e) {
|
|
||||||
+ PufferfishLogger.LOGGER.log(Level.SEVERE, e, () -> "Failed to execute async job for thread " + thread.getName());
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ private Runnable takeRunnable() throws InterruptedException {
|
|
||||||
+ mutex.lock();
|
|
||||||
+ try {
|
|
||||||
+ while (jobs.isEmpty() && !killswitch) {
|
|
||||||
+ cond.await();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (jobs.isEmpty()) return null; // We've set killswitch
|
|
||||||
+
|
|
||||||
+ return jobs.remove();
|
|
||||||
+ } finally {
|
|
||||||
+ mutex.unlock();
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+}
|
|
||||||
\ No newline at end of file
|
|
||||||
diff --git a/src/main/java/gg/pufferfish/pufferfish/util/IterableWrapper.java b/src/main/java/gg/pufferfish/pufferfish/util/IterableWrapper.java
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000000000000000000000000000000000000..65c3d2989e8140259c5720222c569129034aca6c
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/main/java/gg/pufferfish/pufferfish/util/IterableWrapper.java
|
|
||||||
@@ -0,0 +1,20 @@
|
|
||||||
+package gg.pufferfish.pufferfish.util;
|
|
||||||
+
|
|
||||||
+import java.util.Iterator;
|
|
||||||
+import org.jetbrains.annotations.NotNull;
|
|
||||||
+
|
|
||||||
+public class IterableWrapper<T> implements Iterable<T> {
|
|
||||||
+
|
|
||||||
+ private final Iterator<T> iterator;
|
|
||||||
+
|
|
||||||
+ public IterableWrapper(Iterator<T> iterator) {
|
|
||||||
+ this.iterator = iterator;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @NotNull
|
|
||||||
+ @Override
|
|
||||||
+ public Iterator<T> iterator() {
|
|
||||||
+ return iterator;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+}
|
|
||||||
\ No newline at end of file
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
index ff5c9492f2933cc9ba5a4e15998ba756497eac89..b2cb60cfffbe2b6c5ff4b29f8d242cfb00f6ebb6 100644
|
index ff5c9492f2933cc9ba5a4e15998ba756497eac89..b2cb60cfffbe2b6c5ff4b29f8d242cfb00f6ebb6 100644
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
@@ -183,19 +51,24 @@ index 8ba7f4aad1ff28d5f38b895e8eb47e141390e5ea..69c594bbd52335d6779b06f9273a1ef8
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||||
|
index 780deea4805dfdd80d47e20ca1c2fcac17e5cabc..be9110a4ac4717956c07f37ee5ab8cbed3b771a7 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||||
|
@@ -342,7 +342,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
|
this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new);
|
||||||
|
this.regionManagers.add(this.dataRegionManager);
|
||||||
|
// Paper end
|
||||||
|
- this.playerMobDistanceMap = this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets) : null; // Paper
|
||||||
|
+ this.playerMobDistanceMap = this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new gg.pufferfish.pufferfish.util.AsyncPlayerAreaMap(this.pooledLinkedPlayerHashSets) : null; // Paper // Pufferfish
|
||||||
|
// Paper start - use distance map to optimise entity tracker
|
||||||
|
this.playerEntityTrackerTrackMaps = new com.destroystokyo.paper.util.misc.PlayerAreaMap[TRACKING_RANGE_TYPES.length];
|
||||||
|
this.entityTrackerTrackRanges = new int[TRACKING_RANGE_TYPES.length];
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
index 3c9ff57cf8cf7e7bfca234e460ff869165bd40d3..9e743d20e9ff979ebad152f209a6ca97a533ea47 100644
|
index 3c9ff57cf8cf7e7bfca234e460ff869165bd40d3..259727ca7956416afa0f425fc203103654673cef 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
@@ -48,6 +48,7 @@ import net.minecraft.world.level.storage.DimensionDataStorage;
|
@@ -75,6 +75,9 @@ public class ServerChunkCache extends ChunkSource {
|
||||||
import net.minecraft.world.level.storage.LevelData;
|
|
||||||
import net.minecraft.world.level.storage.LevelStorageSource;
|
|
||||||
import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; // Paper
|
|
||||||
+import org.dreeam.leaf.LeafConfig;
|
|
||||||
|
|
||||||
public class ServerChunkCache extends ChunkSource {
|
|
||||||
|
|
||||||
@@ -75,6 +76,9 @@ public class ServerChunkCache extends ChunkSource {
|
|
||||||
final it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<LevelChunk> loadedChunkMap = new it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<>(8192, 0.5f);
|
final it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<LevelChunk> loadedChunkMap = new it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<>(8192, 0.5f);
|
||||||
|
|
||||||
private final LevelChunk[] lastLoadedChunks = new LevelChunk[4 * 4];
|
private final LevelChunk[] lastLoadedChunks = new LevelChunk[4 * 4];
|
||||||
@@ -205,7 +78,7 @@ index 3c9ff57cf8cf7e7bfca234e460ff869165bd40d3..9e743d20e9ff979ebad152f209a6ca97
|
|||||||
|
|
||||||
private static int getChunkCacheKey(int x, int z) {
|
private static int getChunkCacheKey(int x, int z) {
|
||||||
return x & 3 | ((z & 3) << 2);
|
return x & 3 | ((z & 3) << 2);
|
||||||
@@ -553,18 +557,25 @@ public class ServerChunkCache extends ChunkSource {
|
@@ -553,18 +556,25 @@ public class ServerChunkCache extends ChunkSource {
|
||||||
int l = this.distanceManager.getNaturalSpawnChunkCount();
|
int l = this.distanceManager.getNaturalSpawnChunkCount();
|
||||||
// Paper start - per player mob spawning
|
// Paper start - per player mob spawning
|
||||||
if ((this.spawnFriendlies || this.spawnEnemies) && this.chunkMap.playerMobDistanceMap != null) { // don't count mobs when animals and monsters are disabled
|
if ((this.spawnFriendlies || this.spawnEnemies) && this.chunkMap.playerMobDistanceMap != null) { // don't count mobs when animals and monsters are disabled
|
||||||
@@ -213,7 +86,7 @@ index 3c9ff57cf8cf7e7bfca234e460ff869165bd40d3..9e743d20e9ff979ebad152f209a6ca97
|
|||||||
- for (ServerPlayer player : this.level.players) {
|
- for (ServerPlayer player : this.level.players) {
|
||||||
- Arrays.fill(player.mobCounts, 0);
|
- Arrays.fill(player.mobCounts, 0);
|
||||||
+ // Pufferfish start - moved down when async processing
|
+ // Pufferfish start - moved down when async processing
|
||||||
+ if (!LeafConfig.enableAsyncMobSpawning) {
|
+ if (!org.dreeam.leaf.LeafConfig.enableAsyncMobSpawning) {
|
||||||
+ // re-set mob counts
|
+ // re-set mob counts
|
||||||
+ for (ServerPlayer player : this.level.players) {
|
+ for (ServerPlayer player : this.level.players) {
|
||||||
+ Arrays.fill(player.mobCounts, 0);
|
+ Arrays.fill(player.mobCounts, 0);
|
||||||
@@ -237,23 +110,23 @@ index 3c9ff57cf8cf7e7bfca234e460ff869165bd40d3..9e743d20e9ff979ebad152f209a6ca97
|
|||||||
// Gale start - MultiPaper - skip unnecessary mob spawning computations
|
// Gale start - MultiPaper - skip unnecessary mob spawning computations
|
||||||
} else {
|
} else {
|
||||||
spawnercreature_d = null;
|
spawnercreature_d = null;
|
||||||
@@ -604,8 +615,8 @@ public class ServerChunkCache extends ChunkSource {
|
@@ -604,8 +614,8 @@ public class ServerChunkCache extends ChunkSource {
|
||||||
|
|
||||||
if ((true || this.level.isNaturalSpawningAllowed(chunkcoordintpair)) && this.chunkMap.anyPlayerCloseEnoughForSpawning(holder, chunkcoordintpair, false)) { // Paper - optimise anyPlayerCloseEnoughForSpawning // Paper - the chunk is known ticking
|
if ((true || this.level.isNaturalSpawningAllowed(chunkcoordintpair)) && this.chunkMap.anyPlayerCloseEnoughForSpawning(holder, chunkcoordintpair, false)) { // Paper - optimise anyPlayerCloseEnoughForSpawning // Paper - the chunk is known ticking
|
||||||
chunk1.incrementInhabitedTime(j);
|
chunk1.incrementInhabitedTime(j);
|
||||||
- if (flag2AndHasNaturalSpawn && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(holder, chunkcoordintpair, true)) { // Spigot // Paper - optimise anyPlayerCloseEnoughForSpawning & optimise chunk tick iteration // Gale - MultiPaper - skip unnecessary mob spawning computations
|
- if (flag2AndHasNaturalSpawn && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(holder, chunkcoordintpair, true)) { // Spigot // Paper - optimise anyPlayerCloseEnoughForSpawning & optimise chunk tick iteration // Gale - MultiPaper - skip unnecessary mob spawning computations
|
||||||
- NaturalSpawner.spawnForChunk(this.level, chunk1, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag1);
|
- NaturalSpawner.spawnForChunk(this.level, chunk1, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag1);
|
||||||
+ if (flag2AndHasNaturalSpawn && (!LeafConfig.enableAsyncMobSpawning || _pufferfish_spawnCountsReady.get()) && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(holder, chunkcoordintpair, true)) { // Spigot // Paper - optimise anyPlayerCloseEnoughForSpawning & optimise chunk tick iteration // Gale - MultiPaper - skip unnecessary mob spawning computations
|
+ if (flag2AndHasNaturalSpawn && (!org.dreeam.leaf.LeafConfig.enableAsyncMobSpawning || _pufferfish_spawnCountsReady.get()) && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(holder, chunkcoordintpair, true)) { // Spigot // Paper - optimise anyPlayerCloseEnoughForSpawning & optimise chunk tick iteration // Gale - MultiPaper - skip unnecessary mob spawning computations
|
||||||
+ NaturalSpawner.spawnForChunk(this.level, chunk1, lastSpawnState, this.spawnFriendlies, this.spawnEnemies, flag1);
|
+ NaturalSpawner.spawnForChunk(this.level, chunk1, lastSpawnState, this.spawnFriendlies, this.spawnEnemies, flag1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (true || this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { // Paper - the chunk is known ticking
|
if (true || this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { // Paper - the chunk is known ticking
|
||||||
@@ -663,6 +674,29 @@ public class ServerChunkCache extends ChunkSource {
|
@@ -663,6 +673,29 @@ public class ServerChunkCache extends ChunkSource {
|
||||||
}
|
}
|
||||||
// Paper end - controlled flush for entity tracker packets
|
// Paper end - controlled flush for entity tracker packets
|
||||||
}
|
}
|
||||||
+ // Pufferfish start - optimize mob spawning
|
+ // Pufferfish start - optimize mob spawning
|
||||||
+ if (LeafConfig.enableAsyncMobSpawning) {
|
+ if (org.dreeam.leaf.LeafConfig.enableAsyncMobSpawning) {
|
||||||
+ for (ServerPlayer player : this.level.players) {
|
+ for (ServerPlayer player : this.level.players) {
|
||||||
+ Arrays.fill(player.mobCounts, 0);
|
+ Arrays.fill(player.mobCounts, 0);
|
||||||
+ }
|
+ }
|
||||||
@@ -984,7 +984,7 @@ index dd9f611efc95f7d06fd3011fedd5d0317b1d0a85..be7b3fe2dc84493dcde9e185717b0b7c
|
|||||||
+ // Purpur end
|
+ // Purpur end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||||
index 780deea4805dfdd80d47e20ca1c2fcac17e5cabc..10b88fe8b2cb3f7fe920cad95254ef8d21bd1015 100644
|
index be9110a4ac4717956c07f37ee5ab8cbed3b771a7..5412f7921674d00be5c83f25f677b4896223930e 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||||
@@ -1004,7 +1004,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
@@ -1004,7 +1004,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
@@ -30,7 +30,7 @@ index 5ed89ce9d2c29927f48c1f7f8f9288f39d68b56c..30371f1a6dfb6fc170ac0cbdb3a7c78c
|
|||||||
ServerLoginPacketListenerImpl.this.disconnect("Failed to verify username!");
|
ServerLoginPacketListenerImpl.this.disconnect("Failed to verify username!");
|
||||||
return;
|
return;
|
||||||
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
||||||
index 1a1c867b2602cc6a4dd63ad8c81d95f5ad4dd488..8db36e248902a78b07b487707ee51ee8e4058f3d 100644
|
index 3dafe7583b9d0fc66004eadcfb4ba37fd743f074..64da1ac84c4c61a817363487c14491367ca04180 100644
|
||||||
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
|
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
|
||||||
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
||||||
@@ -169,7 +169,11 @@ public class LeafConfig {
|
@@ -169,7 +169,11 @@ public class LeafConfig {
|
||||||
@@ -26,7 +26,7 @@ index 2821de09a36fc315897129f4691ba713386737db..3f60c1e5bf49784ac2a812157a5d22ce
|
|||||||
this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage));
|
this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage));
|
||||||
this.connection.disconnect(chatmessage);
|
this.connection.disconnect(chatmessage);
|
||||||
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
||||||
index 8db36e248902a78b07b487707ee51ee8e4058f3d..f4ef9e1f9e42ac86696f0718576d404d3a8db3c9 100644
|
index 64da1ac84c4c61a817363487c14491367ca04180..5087732f4e78fb5a567674914174142777d762ef 100644
|
||||||
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
|
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
|
||||||
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
||||||
@@ -170,10 +170,14 @@ public class LeafConfig {
|
@@ -170,10 +170,14 @@ public class LeafConfig {
|
||||||
@@ -28,7 +28,7 @@ index a912462dcd381956c31f19ccd4de826594af65b9..c1431af927a203c16b04a82e0f779fe4
|
|||||||
|
|
||||||
this.player.resetLastActionTime();
|
this.player.resetLastActionTime();
|
||||||
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
||||||
index f4ef9e1f9e42ac86696f0718576d404d3a8db3c9..03769f251ee07c168d93be962bfca6dad921d582 100644
|
index 5087732f4e78fb5a567674914174142777d762ef..065c79a73aa4f1775f5f4efcc90dae46d0ddbf4a 100644
|
||||||
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
|
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
|
||||||
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
||||||
@@ -171,6 +171,8 @@ public class LeafConfig {
|
@@ -171,6 +171,8 @@ public class LeafConfig {
|
||||||
@@ -28,7 +28,7 @@ index ec319f30250df17d247f4bd8fc77709dfaf9da01..d88e93b4fd50102b43f63f00d45b28ac
|
|||||||
} else {
|
} else {
|
||||||
ItemEntity.merge(other, itemstack1, this, itemstack);
|
ItemEntity.merge(other, itemstack1, this, itemstack);
|
||||||
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
||||||
index 03769f251ee07c168d93be962bfca6dad921d582..8d975b996432d98c2f3cc9d01f2a7b85488415ae 100644
|
index 065c79a73aa4f1775f5f4efcc90dae46d0ddbf4a..8f66ee49b0a81fae7b1053a8adc585fc845e17a9 100644
|
||||||
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
|
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
|
||||||
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
||||||
@@ -195,6 +195,7 @@ public class LeafConfig {
|
@@ -195,6 +195,7 @@ public class LeafConfig {
|
||||||
@@ -6,32 +6,6 @@ Subject: [PATCH] Leaves: Server Utils
|
|||||||
Original license: GPLv3
|
Original license: GPLv3
|
||||||
Original project: https://github.com/LeavesMC/Leaves
|
Original project: https://github.com/LeavesMC/Leaves
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java
|
|
||||||
index 41b9405d6759d865e0d14dd4f95163e9690e967d..67008112e1d1c059938838c544f093fa1f0a4fee 100644
|
|
||||||
--- a/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java
|
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java
|
|
||||||
@@ -26,7 +26,7 @@ public abstract class AreaMap<E> {
|
|
||||||
|
|
||||||
// we use linked for better iteration.
|
|
||||||
// map of: coordinate to set of objects in coordinate
|
|
||||||
- protected final Long2ObjectOpenHashMap<PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<E>> areaMap = new Long2ObjectOpenHashMap<>(1024, 0.7f);
|
|
||||||
+ protected Long2ObjectOpenHashMap<PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<E>> areaMap = new Long2ObjectOpenHashMap<>(1024, 0.7f); // Leaves - not final
|
|
||||||
protected final PooledLinkedHashSets<E> pooledHashSets;
|
|
||||||
|
|
||||||
protected final ChangeCallback<E> addCallback;
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java
|
|
||||||
index 46954db7ecd35ac4018fdf476df7c8020d7ce6c8..044c51ebb058fc36074fd178929e3279335f6c99 100644
|
|
||||||
--- a/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java
|
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java
|
|
||||||
@@ -5,7 +5,7 @@ import net.minecraft.server.level.ServerPlayer;
|
|
||||||
/**
|
|
||||||
* @author Spottedleaf
|
|
||||||
*/
|
|
||||||
-public final class PlayerAreaMap extends AreaMap<ServerPlayer> {
|
|
||||||
+public class PlayerAreaMap extends AreaMap<ServerPlayer> { // Leaves - not final
|
|
||||||
|
|
||||||
public PlayerAreaMap() {
|
|
||||||
super();
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index ef7b46d80dbb9f80a2c199796e2e1f596f181145..18b9a7fe41cffb9ef7e060701621fd4b8726fcfd 100644
|
index ef7b46d80dbb9f80a2c199796e2e1f596f181145..18b9a7fe41cffb9ef7e060701621fd4b8726fcfd 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
@@ -89,7 +89,7 @@ index f00dc5b06519f2827a068649394e09ecbdf1a131..2b185b0f8dc9b7f2da0b30f2b393fcf7
|
|||||||
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
||||||
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
|
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
|
||||||
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
||||||
index 8d975b996432d98c2f3cc9d01f2a7b85488415ae..56937d552394bb652032e7150c7a8529c0d88c3e 100644
|
index 8f66ee49b0a81fae7b1053a8adc585fc845e17a9..bc008690cbd87579f98c7c3686321513947f07e6 100644
|
||||||
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
|
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
|
||||||
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
||||||
@@ -254,6 +254,8 @@ public class LeafConfig {
|
@@ -254,6 +254,8 @@ public class LeafConfig {
|
||||||
@@ -58,7 +58,7 @@ index 2b185b0f8dc9b7f2da0b30f2b393fcf7025f87b2..75cf48291652016c664e035ce467b17d
|
|||||||
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
||||||
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
|
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
|
||||||
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
||||||
index 56937d552394bb652032e7150c7a8529c0d88c3e..695b17baa36cb81fd1d5562bb458e1c0add1583b 100644
|
index bc008690cbd87579f98c7c3686321513947f07e6..bce7b0d5dbd1a6e9fe4f656e057550c8861b8ce4 100644
|
||||||
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
|
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
|
||||||
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
||||||
@@ -255,7 +255,9 @@ public class LeafConfig {
|
@@ -255,7 +255,9 @@ public class LeafConfig {
|
||||||
@@ -19,7 +19,7 @@ index 621875cc5ecb613b7a64067d1c0805305977b9a3..a29f58dce847b4cdcf276906011f8450
|
|||||||
// CraftBukkit start - handle player weather
|
// CraftBukkit start - handle player weather
|
||||||
// entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.START_RAINING, 0.0F));
|
// entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.START_RAINING, 0.0F));
|
||||||
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
||||||
index 695b17baa36cb81fd1d5562bb458e1c0add1583b..79b2f7a8f8d71d6a0c9e383a89785a170183a009 100644
|
index bce7b0d5dbd1a6e9fe4f656e057550c8861b8ce4..a0123918192584921accf23a19579bda7bb9f8bd 100644
|
||||||
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
|
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
|
||||||
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
||||||
@@ -19,6 +19,7 @@ import java.util.Collections;
|
@@ -19,6 +19,7 @@ import java.util.Collections;
|
||||||
Reference in New Issue
Block a user