geforkt von Mirrors/Paper
Rewrite chunk system (#8177)
Patch documentation to come Issues with the old system that are fixed now: - World generation does not scale with cpu cores effectively. - Relies on the main thread for scheduling and maintaining chunk state, dropping chunk load/generate rates at lower tps. - Unreliable prioritisation of chunk gen/load calls that block the main thread. - Shutdown logic is utterly unreliable, as it has to wait for all chunks to unload - is it guaranteed that the chunk system is in a state on shutdown that it can reliably do this? Watchdog shutdown also typically failed due to thread checks, which is now resolved. - Saving of data is not unified (i.e can save chunk data without saving entity data, poses problems for desync if shutdown is really abnormal. - Entities are not loaded with chunks. This caused quite a bit of headache for Chunk#getEntities API, but now the new chunk system loads entities with chunks so that they are ready whenever the chunk loads in. Effectively brings the behavior back to 1.16 era, but still storing entities in their own separate regionfiles. The above list is not complete. The patch documentation will complete it. New chunk system hard relies on starlight and dataconverter, and most importantly the new concurrent utilities in ConcurrentUtil. Some of the old async chunk i/o interface (i.e the old file io thread reroutes _some_ calls to the new file io thread) is kept for plugin compat reasons. It will be removed in the next major version of minecraft. The old legacy chunk system patches have been moved to the removed folder in case we need them again.
Dieser Commit ist enthalten in:
Ursprung
abe53a7eb4
Commit
01a13871de
@ -431,14 +431,13 @@ index 0000000000000000000000000000000000000000..c2dca89291361d60cbf160cab77749cb
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..aaecd691922a28e971b859175574c80a330edb8e
|
||||
index 0000000000000000000000000000000000000000..84785fed0d85d78c4caf8fabe35c0e89a59240d5
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
@@ -0,0 +1,274 @@
|
||||
@@ -0,0 +1,275 @@
|
||||
+package io.papermc.paper.configuration;
|
||||
+
|
||||
+import co.aikar.timings.MinecraftTimings;
|
||||
+import com.destroystokyo.paper.io.chunk.ChunkTaskManager;
|
||||
+import io.papermc.paper.configuration.constraint.Constraint;
|
||||
+import io.papermc.paper.configuration.constraint.Constraints;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
@ -604,15 +603,17 @@ index 0000000000000000000000000000000000000000..aaecd691922a28e971b859175574c80a
|
||||
+ public boolean saveEmptyScoreboardTeams = false;
|
||||
+ }
|
||||
+
|
||||
+ public AsyncChunks asyncChunks;
|
||||
+ public ChunkSystem chunkSystem;
|
||||
+
|
||||
+ public class AsyncChunks extends ConfigurationPart.Post {
|
||||
+ public int threads = -1;
|
||||
+ public transient boolean asyncChunks = false;
|
||||
+ public class ChunkSystem extends ConfigurationPart.Post {
|
||||
+
|
||||
+ public int ioThreads = -1;
|
||||
+ public int workerThreads = -1;
|
||||
+ public String genParallelism = "default";
|
||||
+
|
||||
+ @Override
|
||||
+ public void postProcess() {
|
||||
+ ChunkTaskManager.processConfiguration(this);
|
||||
+ io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.init(this);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
@ -1412,6 +1412,160 @@ index 0000000000000000000000000000000000000000..f4415f782b32fed25da98e44b172f717
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/ca/spottedleaf/concurrentutil/collection/SRSWLinkedQueue.java b/src/main/java/ca/spottedleaf/concurrentutil/collection/SRSWLinkedQueue.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..597659f38aa816646dcda4ca39c002b6d9f9a792
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/ca/spottedleaf/concurrentutil/collection/SRSWLinkedQueue.java
|
||||
@@ -0,0 +1,148 @@
|
||||
+package ca.spottedleaf.concurrentutil.collection;
|
||||
+
|
||||
+import ca.spottedleaf.concurrentutil.util.ConcurrentUtil;
|
||||
+import ca.spottedleaf.concurrentutil.util.Validate;
|
||||
+import java.lang.invoke.VarHandle;
|
||||
+import java.util.ConcurrentModificationException;
|
||||
+
|
||||
+/**
|
||||
+ * Single reader thread single writer thread queue. The reader side of the queue is ordered by acquire semantics,
|
||||
+ * and the writer side of the queue is ordered by release semantics.
|
||||
+ */
|
||||
+// TODO test
|
||||
+public class SRSWLinkedQueue<E> {
|
||||
+
|
||||
+ // always non-null
|
||||
+ protected LinkedNode<E> head;
|
||||
+
|
||||
+ // always non-null
|
||||
+ protected LinkedNode<E> tail;
|
||||
+
|
||||
+ /* IMPL NOTE: Leave hashCode and equals to their defaults */
|
||||
+
|
||||
+ public SRSWLinkedQueue() {
|
||||
+ final LinkedNode<E> dummy = new LinkedNode<>(null, null);
|
||||
+ this.head = this.tail = dummy;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Must be the reader thread.
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * Returns, without removing, the first element of this queue.
|
||||
+ * </p>
|
||||
+ * @return Returns, without removing, the first element of this queue.
|
||||
+ */
|
||||
+ public E peekFirst() {
|
||||
+ LinkedNode<E> head = this.head;
|
||||
+ E ret = head.getElementPlain();
|
||||
+ if (ret == null) {
|
||||
+ head = head.getNextAcquire();
|
||||
+ if (head == null) {
|
||||
+ // empty
|
||||
+ return null;
|
||||
+ }
|
||||
+ // update head reference for next poll() call
|
||||
+ this.head = head;
|
||||
+ // guaranteed to be non-null
|
||||
+ ret = head.getElementPlain();
|
||||
+ if (ret == null) {
|
||||
+ throw new ConcurrentModificationException("Multiple reader threads");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Must be the reader thread.
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * Returns and removes the first element of this queue.
|
||||
+ * </p>
|
||||
+ * @return Returns and removes the first element of this queue.
|
||||
+ */
|
||||
+ public E poll() {
|
||||
+ LinkedNode<E> head = this.head;
|
||||
+ E ret = head.getElementPlain();
|
||||
+ if (ret == null) {
|
||||
+ head = head.getNextAcquire();
|
||||
+ if (head == null) {
|
||||
+ // empty
|
||||
+ return null;
|
||||
+ }
|
||||
+ // guaranteed to be non-null
|
||||
+ ret = head.getElementPlain();
|
||||
+ if (ret == null) {
|
||||
+ throw new ConcurrentModificationException("Multiple reader threads");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ head.setElementPlain(null);
|
||||
+ LinkedNode<E> next = head.getNextAcquire();
|
||||
+ this.head = next == null ? head : next;
|
||||
+
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Must be the writer thread.
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * Adds the element to the end of the queue.
|
||||
+ * </p>
|
||||
+ *
|
||||
+ * @throws NullPointerException If the provided element is null
|
||||
+ */
|
||||
+ public void addLast(final E element) {
|
||||
+ Validate.notNull(element, "Provided element cannot be null");
|
||||
+ final LinkedNode<E> append = new LinkedNode<>(element, null);
|
||||
+
|
||||
+ this.tail.setNextRelease(append);
|
||||
+ this.tail = append;
|
||||
+ }
|
||||
+
|
||||
+ protected static final class LinkedNode<E> {
|
||||
+
|
||||
+ protected volatile Object element;
|
||||
+ protected volatile LinkedNode<E> next;
|
||||
+
|
||||
+ protected static final VarHandle ELEMENT_HANDLE = ConcurrentUtil.getVarHandle(LinkedNode.class, "element", Object.class);
|
||||
+ protected static final VarHandle NEXT_HANDLE = ConcurrentUtil.getVarHandle(LinkedNode.class, "next", LinkedNode.class);
|
||||
+
|
||||
+ protected LinkedNode(final Object element, final LinkedNode<E> next) {
|
||||
+ ELEMENT_HANDLE.set(this, element);
|
||||
+ NEXT_HANDLE.set(this, next);
|
||||
+ }
|
||||
+
|
||||
+ /* element */
|
||||
+
|
||||
+ @SuppressWarnings("unchecked")
|
||||
+ protected final E getElementPlain() {
|
||||
+ return (E)ELEMENT_HANDLE.get(this);
|
||||
+ }
|
||||
+
|
||||
+ protected final void setElementPlain(final E update) {
|
||||
+ ELEMENT_HANDLE.set(this, (Object)update);
|
||||
+ }
|
||||
+ /* next */
|
||||
+
|
||||
+ @SuppressWarnings("unchecked")
|
||||
+ protected final LinkedNode<E> getNextPlain() {
|
||||
+ return (LinkedNode<E>)NEXT_HANDLE.get(this);
|
||||
+ }
|
||||
+
|
||||
+ @SuppressWarnings("unchecked")
|
||||
+ protected final LinkedNode<E> getNextAcquire() {
|
||||
+ return (LinkedNode<E>)NEXT_HANDLE.getAcquire(this);
|
||||
+ }
|
||||
+
|
||||
+ protected final void setNextPlain(final LinkedNode<E> next) {
|
||||
+ NEXT_HANDLE.set(this, next);
|
||||
+ }
|
||||
+
|
||||
+ protected final void setNextRelease(final LinkedNode<E> next) {
|
||||
+ NEXT_HANDLE.setRelease(this, next);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/ca/spottedleaf/concurrentutil/completable/Completable.java b/src/main/java/ca/spottedleaf/concurrentutil/completable/Completable.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a1ad3308f9c3545a604b635896259a1cd3382b2a
|
||||
@ -1518,7 +1672,7 @@ index 0000000000000000000000000000000000000000..a1ad3308f9c3545a604b635896259a1c
|
||||
+}
|
||||
diff --git a/src/main/java/ca/spottedleaf/concurrentutil/executor/BaseExecutor.java b/src/main/java/ca/spottedleaf/concurrentutil/executor/BaseExecutor.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..716a0fd3f558df748e355069746272facb91de22
|
||||
index 0000000000000000000000000000000000000000..8c452b0988da4725762d543f6bee09915c328ae6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/ca/spottedleaf/concurrentutil/executor/BaseExecutor.java
|
||||
@@ -0,0 +1,198 @@
|
||||
@ -1575,11 +1729,11 @@ index 0000000000000000000000000000000000000000..716a0fd3f558df748e355069746272fa
|
||||
+ * @throws IllegalStateException If the current thread is not allowed to wait
|
||||
+ */
|
||||
+ public default void waitUntilAllExecuted() throws IllegalStateException {
|
||||
+ long failures = 9L; // start out at 1ms
|
||||
+ long failures = 1L; // start at 0.25ms
|
||||
+
|
||||
+ while (!this.haveAllTasksExecuted()) {
|
||||
+ Thread.yield();
|
||||
+ failures = ConcurrentUtil.linearLongBackoff(failures, 500_000L, 5_000_000L); // 500us, 5ms
|
||||
+ failures = ConcurrentUtil.linearLongBackoff(failures, 250_000L, 5_000_000L); // 500us, 5ms
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
@ -856,6 +856,137 @@ index 0000000000000000000000000000000000000000..277cfd9d1e8fff5d9b5e534b75c3c516
|
||||
+ return this.map.values().iterator();
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/ReferenceList.java b/src/main/java/com/destroystokyo/paper/util/maplist/ReferenceList.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..190c5f0b02a3d99054704ae1afbffb3498ddffe1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/util/maplist/ReferenceList.java
|
||||
@@ -0,0 +1,125 @@
|
||||
+package com.destroystokyo.paper.util.maplist;
|
||||
+
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
|
||||
+import java.util.Arrays;
|
||||
+import java.util.Iterator;
|
||||
+import java.util.NoSuchElementException;
|
||||
+
|
||||
+/**
|
||||
+ * @author Spottedleaf
|
||||
+ */
|
||||
+public final class ReferenceList<E> implements Iterable<E> {
|
||||
+
|
||||
+ protected final Reference2IntOpenHashMap<E> referenceToIndex = new Reference2IntOpenHashMap<>(2, 0.8f);
|
||||
+ {
|
||||
+ this.referenceToIndex.defaultReturnValue(Integer.MIN_VALUE);
|
||||
+ }
|
||||
+
|
||||
+ protected static final Object[] EMPTY_LIST = new Object[0];
|
||||
+
|
||||
+ protected Object[] references = EMPTY_LIST;
|
||||
+ protected int count;
|
||||
+
|
||||
+ public int size() {
|
||||
+ return this.count;
|
||||
+ }
|
||||
+
|
||||
+ public boolean contains(final E obj) {
|
||||
+ return this.referenceToIndex.containsKey(obj);
|
||||
+ }
|
||||
+
|
||||
+ public boolean remove(final E obj) {
|
||||
+ final int index = this.referenceToIndex.removeInt(obj);
|
||||
+ if (index == Integer.MIN_VALUE) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ // move the object at the end to this index
|
||||
+ final int endIndex = --this.count;
|
||||
+ final E end = (E)this.references[endIndex];
|
||||
+ if (index != endIndex) {
|
||||
+ // not empty after this call
|
||||
+ this.referenceToIndex.put(end, index); // update index
|
||||
+ }
|
||||
+ this.references[index] = end;
|
||||
+ this.references[endIndex] = null;
|
||||
+
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ public boolean add(final E obj) {
|
||||
+ final int count = this.count;
|
||||
+ final int currIndex = this.referenceToIndex.putIfAbsent(obj, count);
|
||||
+
|
||||
+ if (currIndex != Integer.MIN_VALUE) {
|
||||
+ return false; // already in this list
|
||||
+ }
|
||||
+
|
||||
+ Object[] list = this.references;
|
||||
+
|
||||
+ if (list.length == count) {
|
||||
+ // resize required
|
||||
+ list = this.references = Arrays.copyOf(list, (int)Math.max(4L, count * 2L)); // overflow results in negative
|
||||
+ }
|
||||
+
|
||||
+ list[count] = obj;
|
||||
+ this.count = count + 1;
|
||||
+
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ public E getChecked(final int index) {
|
||||
+ if (index < 0 || index >= this.count) {
|
||||
+ throw new IndexOutOfBoundsException("Index: " + index + " is out of bounds, size: " + this.count);
|
||||
+ }
|
||||
+ return (E)this.references[index];
|
||||
+ }
|
||||
+
|
||||
+ public E getUnchecked(final int index) {
|
||||
+ return (E)this.references[index];
|
||||
+ }
|
||||
+
|
||||
+ public Object[] getRawData() {
|
||||
+ return this.references;
|
||||
+ }
|
||||
+
|
||||
+ public void clear() {
|
||||
+ this.referenceToIndex.clear();
|
||||
+ Arrays.fill(this.references, 0, this.count, null);
|
||||
+ this.count = 0;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Iterator<E> iterator() {
|
||||
+ return new Iterator<>() {
|
||||
+ private E lastRet;
|
||||
+ private int current;
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean hasNext() {
|
||||
+ return this.current < ReferenceList.this.count;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public E next() {
|
||||
+ if (this.current >= ReferenceList.this.count) {
|
||||
+ throw new NoSuchElementException();
|
||||
+ }
|
||||
+ return this.lastRet = (E)ReferenceList.this.references[this.current++];
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void remove() {
|
||||
+ final E lastRet = this.lastRet;
|
||||
+
|
||||
+ if (lastRet == null) {
|
||||
+ throw new IllegalStateException();
|
||||
+ }
|
||||
+ this.lastRet = null;
|
||||
+
|
||||
+ ReferenceList.this.remove(lastRet);
|
||||
+ --this.current;
|
||||
+ }
|
||||
+ };
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c89f6986eda5a132a948732ea1b6923370685317
|
||||
@ -4530,10 +4661,10 @@ index 207f1c1fc9d4451d27047bb8362bded8cd53e32f..021a26a6b1c258deffc26c035ab52a4e
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkSystem.java b/src/main/java/net/minecraft/server/ChunkSystem.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..83dc09f6526206690c474b50a7a6e71cefc93ab4
|
||||
index 0000000000000000000000000000000000000000..c59fca05484c30b28e883f5b5dde0362f294b517
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkSystem.java
|
||||
@@ -0,0 +1,269 @@
|
||||
@@ -0,0 +1,294 @@
|
||||
+package net.minecraft.server;
|
||||
+
|
||||
+import ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor;
|
||||
@ -4544,6 +4675,7 @@ index 0000000000000000000000000000000000000000..83dc09f6526206690c474b50a7a6e71c
|
||||
+import net.minecraft.server.level.ChunkHolder;
|
||||
+import net.minecraft.server.level.ChunkMap;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import net.minecraft.server.level.TicketType;
|
||||
+import net.minecraft.world.entity.Entity;
|
||||
+import net.minecraft.world.level.ChunkPos;
|
||||
@ -4775,30 +4907,54 @@ index 0000000000000000000000000000000000000000..83dc09f6526206690c474b50a7a6e71c
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void onChunkBorder(LevelChunk chunk, ChunkHolder holder) {
|
||||
+ public static void onChunkBorder(final LevelChunk chunk, final ChunkHolder holder) {
|
||||
+ chunk.playerChunk = holder;
|
||||
+ }
|
||||
+
|
||||
+ public static void onChunkNotBorder(LevelChunk chunk, ChunkHolder holder) {
|
||||
+ public static void onChunkNotBorder(final LevelChunk chunk, final ChunkHolder holder) {
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ public static void onChunkTicking(LevelChunk chunk, ChunkHolder holder) {
|
||||
+ public static void onChunkTicking(final LevelChunk chunk, final ChunkHolder holder) {
|
||||
+ chunk.level.getChunkSource().tickingChunks.add(chunk);
|
||||
+ }
|
||||
+
|
||||
+ public static void onChunkNotTicking(LevelChunk chunk, ChunkHolder holder) {
|
||||
+ public static void onChunkNotTicking(final LevelChunk chunk, final ChunkHolder holder) {
|
||||
+ chunk.level.getChunkSource().tickingChunks.remove(chunk);
|
||||
+ }
|
||||
+
|
||||
+ public static void onChunkEntityTicking(LevelChunk chunk, ChunkHolder holder) {
|
||||
+ public static void onChunkEntityTicking(final LevelChunk chunk, final ChunkHolder holder) {
|
||||
+ chunk.level.getChunkSource().entityTickingChunks.add(chunk);
|
||||
+ }
|
||||
+
|
||||
+ public static void onChunkNotEntityTicking(LevelChunk chunk, ChunkHolder holder) {
|
||||
+ public static void onChunkNotEntityTicking(final LevelChunk chunk, final ChunkHolder holder) {
|
||||
+ chunk.level.getChunkSource().entityTickingChunks.remove(chunk);
|
||||
+ }
|
||||
+
|
||||
+ public static ChunkHolder getUnloadingChunkHolder(final ServerLevel level, final int chunkX, final int chunkZ) {
|
||||
+ return level.chunkSource.chunkMap.getUnloadingChunkHolder(chunkX, chunkZ);
|
||||
+ }
|
||||
+
|
||||
+ public static int getSendViewDistance(final ServerPlayer player) {
|
||||
+ return getLoadViewDistance(player);
|
||||
+ }
|
||||
+
|
||||
+ public static int getLoadViewDistance(final ServerPlayer player) {
|
||||
+ final ServerLevel level = player.getLevel();
|
||||
+ if (level == null) {
|
||||
+ return Bukkit.getViewDistance() + 1;
|
||||
+ }
|
||||
+ return level.chunkSource.chunkMap.getEffectiveViewDistance() + 1;
|
||||
+ }
|
||||
+
|
||||
+ public static int getTickViewDistance(final ServerPlayer player) {
|
||||
+ final ServerLevel level = player.getLevel();
|
||||
+ if (level == null) {
|
||||
+ return Bukkit.getSimulationDistance();
|
||||
+ }
|
||||
+ return level.chunkSource.chunkMap.distanceManager.getSimulationDistance();
|
||||
+ }
|
||||
+
|
||||
+ private ChunkSystem() {
|
||||
+ throw new RuntimeException();
|
||||
+ }
|
||||
@ -5882,7 +6038,7 @@ index 91a9b9ff0d7821a2261e7137fb1b3989ba096b88..1fbe1b6de925f71763f79fe3d2371b70
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||
index 6c98676827ceb6999f340fa2b06a0b3e1cb4cae2..f08089b8672454acf8c2309e850466b335248692 100644
|
||||
index 6c98676827ceb6999f340fa2b06a0b3e1cb4cae2..fbe62a31ab199d83a1db0a4e0b1a813824e6f2c2 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||
@@ -60,8 +60,9 @@ public abstract class DistanceManager {
|
||||
@ -5904,7 +6060,20 @@ index 6c98676827ceb6999f340fa2b06a0b3e1cb4cae2..f08089b8672454acf8c2309e850466b3
|
||||
}
|
||||
|
||||
protected void purgeStaleTickets() {
|
||||
@@ -382,7 +384,7 @@ public abstract class DistanceManager {
|
||||
@@ -319,6 +321,12 @@ public abstract class DistanceManager {
|
||||
this.playerTicketManager.updateViewDistance(viewDistance);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public int getSimulationDistance() {
|
||||
+ return this.simulationDistance;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public void updateSimulationDistance(int simulationDistance) {
|
||||
if (simulationDistance != this.simulationDistance) {
|
||||
this.simulationDistance = simulationDistance;
|
||||
@@ -382,7 +390,7 @@ public abstract class DistanceManager {
|
||||
}
|
||||
|
||||
public void removeTicketsOnClosing() {
|
||||
@ -6332,19 +6501,20 @@ index aa396df025115c7fd866cbc63a44c2c17abfde84..b2f79a0c9caa6783816afc36531c9437
|
||||
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
|
||||
// Holder holder = worlddimension.typeHolder(); // CraftBukkit - decompile error
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index e2ed77972fcec43fef5f3af044479849f78901a9..84564ca128d2dfc79c0b5a13b699cf6fc80bdea7 100644
|
||||
index e2ed77972fcec43fef5f3af044479849f78901a9..bdad7b404067ab65d85d1628db9009896a43a052 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -243,6 +243,8 @@ public class ServerPlayer extends Player {
|
||||
@@ -243,6 +243,9 @@ public class ServerPlayer extends Player {
|
||||
public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
|
||||
// CraftBukkit end
|
||||
|
||||
+ public boolean isRealPlayer; // Paper
|
||||
+ public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
||||
+
|
||||
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, @Nullable ProfilePublicKey publicKey) {
|
||||
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile, publicKey);
|
||||
this.chatVisibility = ChatVisiblity.FULL;
|
||||
@@ -306,6 +308,8 @@ public class ServerPlayer extends Player {
|
||||
@@ -306,6 +309,8 @@ public class ServerPlayer extends Player {
|
||||
this.maxUpStep = 1.0F;
|
||||
this.fudgeSpawnLocation(world);
|
||||
|
||||
@ -6396,6 +6566,18 @@ index 96ab71f72b43758b86f8990a74a238ad68e10890..32d6e4b194c3c4eca7009059f8d18589
|
||||
@Override
|
||||
public BlockState getBlockState(BlockPos pos) {
|
||||
return this.getChunk(SectionPos.blockToSectionCoord(pos.getX()), SectionPos.blockToSectionCoord(pos.getZ())).getBlockState(pos);
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..474843e57028ade5ef36ac5cda4924dbd95f6fe4 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -175,6 +175,7 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
public void placeNewPlayer(Connection connection, ServerPlayer player) {
|
||||
+ player.isRealPlayer = true; // Paper
|
||||
GameProfile gameprofile = player.getGameProfile();
|
||||
GameProfileCache usercache = this.server.getProfileCache();
|
||||
Optional<GameProfile> optional = usercache.get(gameprofile.getId());
|
||||
diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
|
||||
index 288fdbef407d11ab430d5d7026dfad148c3c1065..6fefa619299d3202158490630d62c16aef71e831 100644
|
||||
--- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
|
||||
@ -6848,7 +7030,7 @@ index d484aaae8614e78fdb984b26304b1de8b649e4bd..fabc7df600c89b01d97a76eb0b1206a3
|
||||
this.levelHeightAccessor = heightLimitView;
|
||||
this.sections = new LevelChunkSection[heightLimitView.getSectionsCount()];
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index e518e8e417f2eee43ff0847c24b6858054e7c9a9..ab986a3d1dc2f605b5b84d2b62cd97007e3a2c22 100644
|
||||
index e518e8e417f2eee43ff0847c24b6858054e7c9a9..bcd0287d99eeba2b3534b4a298dc4b79b293ec58 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -25,6 +25,7 @@ import net.minecraft.nbt.CompoundTag;
|
||||
@ -6859,12 +7041,11 @@ index e518e8e417f2eee43ff0847c24b6858054e7c9a9..ab986a3d1dc2f605b5b84d2b62cd9700
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.profiling.ProfilerFiller;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
@@ -124,6 +125,110 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -124,6 +125,109 @@ public class LevelChunk extends ChunkAccess {
|
||||
|
||||
// CraftBukkit end
|
||||
|
||||
+ // Paper start
|
||||
+ public final com.destroystokyo.paper.util.maplist.EntityList entities = new com.destroystokyo.paper.util.maplist.EntityList();
|
||||
+ public @Nullable ChunkHolder playerChunk;
|
||||
+
|
||||
+ static final int NEIGHBOUR_CACHE_RADIUS = 3;
|
||||
@ -6970,7 +7151,7 @@ index e518e8e417f2eee43ff0847c24b6858054e7c9a9..ab986a3d1dc2f605b5b84d2b62cd9700
|
||||
public LevelChunk(ServerLevel world, ProtoChunk protoChunk, @Nullable LevelChunk.PostLoadProcessor entityLoader) {
|
||||
this(world, protoChunk.getPos(), protoChunk.getUpgradeData(), protoChunk.unpackBlockTicks(), protoChunk.unpackFluidTicks(), protoChunk.getInhabitedTime(), protoChunk.getSections(), entityLoader, protoChunk.getBlendingData());
|
||||
Iterator iterator = protoChunk.getBlockEntities().values().iterator();
|
||||
@@ -233,6 +338,18 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -233,6 +337,18 @@ public class LevelChunk extends ChunkAccess {
|
||||
}
|
||||
}
|
||||
|
||||
@ -6989,7 +7170,7 @@ index e518e8e417f2eee43ff0847c24b6858054e7c9a9..ab986a3d1dc2f605b5b84d2b62cd9700
|
||||
@Override
|
||||
public FluidState getFluidState(BlockPos pos) {
|
||||
return this.getFluidState(pos.getX(), pos.getY(), pos.getZ());
|
||||
@@ -354,6 +471,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -354,6 +470,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
return this.getBlockEntity(pos, LevelChunk.EntityCreationType.CHECK);
|
||||
}
|
||||
|
||||
@ -6997,7 +7178,7 @@ index e518e8e417f2eee43ff0847c24b6858054e7c9a9..ab986a3d1dc2f605b5b84d2b62cd9700
|
||||
@Nullable
|
||||
public BlockEntity getBlockEntity(BlockPos pos, LevelChunk.EntityCreationType creationType) {
|
||||
// CraftBukkit start
|
||||
@@ -535,7 +653,25 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -535,7 +652,25 @@ public class LevelChunk extends ChunkAccess {
|
||||
|
||||
// CraftBukkit start
|
||||
public void loadCallback() {
|
||||
@ -7023,7 +7204,7 @@ index e518e8e417f2eee43ff0847c24b6858054e7c9a9..ab986a3d1dc2f605b5b84d2b62cd9700
|
||||
if (server != null) {
|
||||
/*
|
||||
* If it's a new world, the first few chunks are generated inside
|
||||
@@ -574,6 +710,22 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -574,6 +709,22 @@ public class LevelChunk extends ChunkAccess {
|
||||
server.getPluginManager().callEvent(unloadEvent);
|
||||
// note: saving can be prevented, but not forced if no saving is actually required
|
||||
this.mustNotSave = !unloadEvent.isSaveChunk();
|
||||
|
@ -1959,7 +1959,7 @@ index 805a1773d55e2551911e5b8e69052e23f630359b..e4220f14a5ebf43dd3491fc8649c2be5
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 84564ca128d2dfc79c0b5a13b699cf6fc80bdea7..9ab4588e4e512176b881ad4c252e400ff6ea97bd 100644
|
||||
index bdad7b404067ab65d85d1628db9009896a43a052..5aad3da061d391d1003bdcca95dd4f7e5c0e5ea8 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -154,6 +154,7 @@ import net.minecraft.world.scores.Score;
|
||||
@ -1978,7 +1978,7 @@ index 84564ca128d2dfc79c0b5a13b699cf6fc80bdea7..9ab4588e4e512176b881ad4c252e400f
|
||||
public Component listName;
|
||||
public org.bukkit.Location compassTarget;
|
||||
public int newExp = 0;
|
||||
@@ -312,6 +314,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -313,6 +315,7 @@ public class ServerPlayer extends Player {
|
||||
|
||||
// CraftBukkit start
|
||||
this.displayName = this.getScoreboardName();
|
||||
@ -1986,7 +1986,7 @@ index 84564ca128d2dfc79c0b5a13b699cf6fc80bdea7..9ab4588e4e512176b881ad4c252e400f
|
||||
this.bukkitPickUpLoot = true;
|
||||
this.maxHealthCache = this.getMaxHealth();
|
||||
}
|
||||
@@ -788,22 +791,17 @@ public class ServerPlayer extends Player {
|
||||
@@ -789,22 +792,17 @@ public class ServerPlayer extends Player {
|
||||
|
||||
String deathmessage = defaultMessage.getString();
|
||||
this.keepLevel = keepInventory; // SPIGOT-2222: pre-set keepLevel
|
||||
@ -2013,7 +2013,7 @@ index 84564ca128d2dfc79c0b5a13b699cf6fc80bdea7..9ab4588e4e512176b881ad4c252e400f
|
||||
|
||||
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
|
||||
boolean flag1 = true;
|
||||
@@ -1729,8 +1727,13 @@ public class ServerPlayer extends Player {
|
||||
@@ -1730,8 +1728,13 @@ public class ServerPlayer extends Player {
|
||||
}
|
||||
|
||||
public void sendChatMessage(OutgoingPlayerChatMessage message, boolean filterMaskEnabled, ChatType.Bound params) {
|
||||
@ -2028,7 +2028,7 @@ index 84564ca128d2dfc79c0b5a13b699cf6fc80bdea7..9ab4588e4e512176b881ad4c252e400f
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1751,6 +1754,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -1752,6 +1755,7 @@ public class ServerPlayer extends Player {
|
||||
}
|
||||
|
||||
public String locale = "en_us"; // CraftBukkit - add, lowercase
|
||||
@ -2036,7 +2036,7 @@ index 84564ca128d2dfc79c0b5a13b699cf6fc80bdea7..9ab4588e4e512176b881ad4c252e400f
|
||||
public void updateOptions(ServerboundClientInformationPacket packet) {
|
||||
// CraftBukkit start
|
||||
if (getMainArm() != packet.mainHand()) {
|
||||
@@ -1762,6 +1766,10 @@ public class ServerPlayer extends Player {
|
||||
@@ -1763,6 +1767,10 @@ public class ServerPlayer extends Player {
|
||||
this.server.server.getPluginManager().callEvent(event);
|
||||
}
|
||||
this.locale = packet.language;
|
||||
@ -2278,7 +2278,7 @@ index 3a587073dbe5e8a599d342c5f758d842b7b6cddb..a426adfba3fccf1815177e0b8065684c
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e311706a10 100644
|
||||
index 474843e57028ade5ef36ac5cda4924dbd95f6fe4..3710f544a491a837b973daedc2dfa51357b70b56 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -8,6 +8,7 @@ import com.mojang.logging.LogUtils;
|
||||
@ -2289,7 +2289,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3
|
||||
import java.io.File;
|
||||
import java.net.SocketAddress;
|
||||
import java.nio.file.Path;
|
||||
@@ -264,7 +265,7 @@ public abstract class PlayerList {
|
||||
@@ -265,7 +266,7 @@ public abstract class PlayerList {
|
||||
}
|
||||
// CraftBukkit start
|
||||
ichatmutablecomponent.withStyle(ChatFormatting.YELLOW);
|
||||
@ -2298,7 +2298,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3
|
||||
|
||||
playerconnection.teleport(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot());
|
||||
this.players.add(player);
|
||||
@@ -278,19 +279,18 @@ public abstract class PlayerList {
|
||||
@@ -279,19 +280,18 @@ public abstract class PlayerList {
|
||||
// Ensure that player inventory is populated with its viewer
|
||||
player.containerMenu.transferTo(player.containerMenu, bukkitPlayer);
|
||||
|
||||
@ -2323,7 +2323,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -487,7 +487,7 @@ public abstract class PlayerList {
|
||||
@@ -488,7 +488,7 @@ public abstract class PlayerList {
|
||||
|
||||
}
|
||||
|
||||
@ -2332,7 +2332,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3
|
||||
ServerLevel worldserver = entityplayer.getLevel();
|
||||
|
||||
entityplayer.awardStat(Stats.LEAVE_GAME);
|
||||
@@ -498,7 +498,7 @@ public abstract class PlayerList {
|
||||
@@ -499,7 +499,7 @@ public abstract class PlayerList {
|
||||
entityplayer.closeContainer();
|
||||
}
|
||||
|
||||
@ -2341,7 +2341,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3
|
||||
this.cserver.getPluginManager().callEvent(playerQuitEvent);
|
||||
entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());
|
||||
|
||||
@@ -551,7 +551,7 @@ public abstract class PlayerList {
|
||||
@@ -552,7 +552,7 @@ public abstract class PlayerList {
|
||||
this.cserver.getScoreboardManager().removePlayer(entityplayer.getBukkitEntity());
|
||||
// CraftBukkit end
|
||||
|
||||
@ -2350,7 +2350,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3
|
||||
}
|
||||
|
||||
// CraftBukkit start - Whole method, SocketAddress to LoginListener, added hostname to signature, return EntityPlayer
|
||||
@@ -597,10 +597,10 @@ public abstract class PlayerList {
|
||||
@@ -598,10 +598,10 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
// return chatmessage;
|
||||
@ -2363,7 +2363,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3
|
||||
} else if (this.getIpBans().isBanned(socketaddress) && !this.getIpBans().get(socketaddress).hasExpired()) {
|
||||
IpBanListEntry ipbanentry = this.ipBans.get(socketaddress);
|
||||
|
||||
@@ -610,17 +610,17 @@ public abstract class PlayerList {
|
||||
@@ -611,17 +611,17 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
// return chatmessage;
|
||||
@ -2384,7 +2384,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3
|
||||
return null;
|
||||
}
|
||||
return entity;
|
||||
@@ -1128,7 +1128,7 @@ public abstract class PlayerList {
|
||||
@@ -1129,7 +1129,7 @@ public abstract class PlayerList {
|
||||
public void removeAll() {
|
||||
// CraftBukkit start - disconnect safely
|
||||
for (ServerPlayer player : this.players) {
|
||||
@ -2393,7 +2393,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -1169,14 +1169,25 @@ public abstract class PlayerList {
|
||||
@@ -1170,14 +1170,25 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
public void broadcastChatMessage(PlayerChatMessage message, ServerPlayer sender, ChatType.Bound params) {
|
||||
@ -2421,7 +2421,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3
|
||||
OutgoingPlayerChatMessage outgoingplayerchatmessage = OutgoingPlayerChatMessage.create(message);
|
||||
boolean flag1 = message.isFullyFiltered();
|
||||
boolean flag2 = false;
|
||||
@@ -1186,7 +1197,7 @@ public abstract class PlayerList {
|
||||
@@ -1187,7 +1198,7 @@ public abstract class PlayerList {
|
||||
ServerPlayer entityplayer1 = (ServerPlayer) iterator.next();
|
||||
boolean flag3 = shouldSendFiltered.test(entityplayer1);
|
||||
|
||||
@ -2430,7 +2430,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3
|
||||
if (sender != entityplayer1) {
|
||||
flag2 |= flag1 && flag3;
|
||||
}
|
||||
@@ -1213,7 +1224,7 @@ public abstract class PlayerList {
|
||||
@@ -1214,7 +1225,7 @@ public abstract class PlayerList {
|
||||
|
||||
}
|
||||
|
||||
|
@ -1309,7 +1309,7 @@ index 93d02b5de0721e3c5903e80bbf8b3b56ec3ab45d..4e7db441f68019d6e5d3359605b76bc4
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 521f485366c65527ac3289dd27d8f2e311706a10..5833cc3d5014dad82607afc4d643b6bed885be64 100644
|
||||
index 3710f544a491a837b973daedc2dfa51357b70b56..e7fcb402e3d4e0707a28505a9fb6642764034e23 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1,5 +1,6 @@
|
||||
@ -1319,7 +1319,7 @@ index 521f485366c65527ac3289dd27d8f2e311706a10..5833cc3d5014dad82607afc4d643b6be
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
@@ -1018,10 +1019,11 @@ public abstract class PlayerList {
|
||||
@@ -1019,10 +1020,11 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
public void saveAll() {
|
||||
@ -1588,10 +1588,10 @@ index dec38e58e30c84887e9d29436c0f76c70c0a627d..be08224c8107aab3e9a3645a20977dd1
|
||||
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
|
||||
public CraftPersistentDataContainer persistentDataContainer;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index ab986a3d1dc2f605b5b84d2b62cd97007e3a2c22..58a245b2ca6e65d491694142ad04d38236b46434 100644
|
||||
index bcd0287d99eeba2b3534b4a298dc4b79b293ec58..b322d9b7bd9e107a9adf995b6c4db4ff0af05fc1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -681,6 +681,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -680,6 +680,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(this.bukkitChunk, this.needsDecoration));
|
||||
|
||||
if (this.needsDecoration) {
|
||||
@ -1599,7 +1599,7 @@ index ab986a3d1dc2f605b5b84d2b62cd97007e3a2c22..58a245b2ca6e65d491694142ad04d382
|
||||
this.needsDecoration = false;
|
||||
java.util.Random random = new java.util.Random();
|
||||
random.setSeed(this.level.getSeed());
|
||||
@@ -700,6 +701,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -699,6 +700,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
}
|
||||
}
|
||||
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(this.bukkitChunk));
|
||||
|
@ -22656,10 +22656,10 @@ index 0000000000000000000000000000000000000000..967ad1186cbc81a76a4958ea99d4eff3
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
||||
index fee9a8e74bfcc94942991b56799debf67b551f43..b230a3d475357d2ffd340f9a89934ea7227e69d0 100644
|
||||
index c56946f86565ad1ac41bb7b655c113f648d2f539..9730ee10042e02741383c8153eb3b7b7103f80e0 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
||||
@@ -87,7 +87,7 @@ public class ChunkStorage implements AutoCloseable {
|
||||
@@ -78,7 +78,7 @@ public class ChunkStorage implements AutoCloseable {
|
||||
int i = ChunkStorage.getVersion(nbttagcompound);
|
||||
|
||||
// CraftBukkit start
|
||||
@ -22668,16 +22668,16 @@ index fee9a8e74bfcc94942991b56799debf67b551f43..b230a3d475357d2ffd340f9a89934ea7
|
||||
CompoundTag level = nbttagcompound.getCompound("Level");
|
||||
if (level.getBoolean("TerrainPopulated") && !level.getBoolean("LightPopulated")) {
|
||||
ServerChunkCache cps = (generatoraccess == null) ? null : ((ServerLevel) generatoraccess).getChunkSource();
|
||||
@@ -99,7 +99,7 @@ public class ChunkStorage implements AutoCloseable {
|
||||
@@ -90,7 +90,7 @@ public class ChunkStorage implements AutoCloseable {
|
||||
// CraftBukkit end
|
||||
|
||||
if (i < 1493) {
|
||||
- nbttagcompound = NbtUtils.update(this.fixerUpper, DataFixTypes.CHUNK, nbttagcompound, i, 1493);
|
||||
+ ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.CHUNK, nbttagcompound, i, 1493); // Paper - replace chunk converter
|
||||
if (nbttagcompound.getCompound("Level").getBoolean("hasLegacyStructureData")) {
|
||||
synchronized (this.persistentDataLock) { // Paper - Async chunk loading
|
||||
LegacyStructureDataHandler persistentstructurelegacy = this.getLegacyStructureHandler(resourcekey, supplier);
|
||||
@@ -119,7 +119,7 @@ public class ChunkStorage implements AutoCloseable {
|
||||
|
||||
@@ -108,7 +108,7 @@ public class ChunkStorage implements AutoCloseable {
|
||||
// Spigot end
|
||||
|
||||
ChunkStorage.injectDatafixingContext(nbttagcompound, resourcekey, optional);
|
||||
@ -22687,10 +22687,10 @@ index fee9a8e74bfcc94942991b56799debf67b551f43..b230a3d475357d2ffd340f9a89934ea7
|
||||
nbttagcompound.putInt("DataVersion", SharedConstants.getCurrentVersion().getWorldVersion());
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java
|
||||
index de7afc737b1ab099edc29a4ef94baa76329c2947..2bc0384728f89b7c64a8beec78a1b77dc063d37b 100644
|
||||
index dae66dd5dbebc7fd8fc331b1f5f06ec461667830..0ede151943109e81f66875340261d77f67f63c95 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java
|
||||
@@ -128,7 +128,7 @@ public class EntityStorage implements EntityPersistentStorage<Entity> {
|
||||
@@ -117,7 +117,7 @@ public class EntityStorage implements EntityPersistentStorage<Entity> {
|
||||
|
||||
private CompoundTag upgradeChunkTag(CompoundTag chunkNbt) {
|
||||
int i = getVersion(chunkNbt);
|
||||
@ -22700,10 +22700,10 @@ index de7afc737b1ab099edc29a4ef94baa76329c2947..2bc0384728f89b7c64a8beec78a1b77d
|
||||
|
||||
public static int getVersion(CompoundTag chunkNbt) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
|
||||
index bb59cff9ba570923a40c1612d5812a64390454ee..10e8d1e36639cca21aa451e81cdab90ba9e9a496 100644
|
||||
index 8a4750dd8f604062c4ea452f7b97b05a0c8d583a..a0b61647e5a7e5989aed52522bc9a43bc487421c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
|
||||
@@ -148,7 +148,14 @@ public class SectionStorage<R> extends RegionFileStorage implements AutoCloseabl
|
||||
@@ -142,7 +142,14 @@ public class SectionStorage<R> implements AutoCloseable {
|
||||
int j = getVersion(dynamic);
|
||||
int k = SharedConstants.getCurrentVersion().getWorldVersion();
|
||||
boolean bl = j != k;
|
||||
@ -22733,7 +22733,7 @@ index 963ad3ce1ef83888ae1537ff01accdbb5b04ffa1..a7cba5b828a586d7435bda4d512af686
|
||||
LOGGER.warn("Failed to partially datafix chunk {}", pos, var12);
|
||||
return StructureCheckResult.CHUNK_LOAD_NEEDED;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
index d785efd61caa2237e05d9ce3dbf84d86076ff047..601f8099f74e81c17600566b3c9b7a6dd39c9bcb 100644
|
||||
index 86fb11e9e197357871d603c4f8ce778660d507cf..bf4c895794c2bc2ad65faa128c6fa92cb0656841 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
@@ -93,7 +93,7 @@ public class PlayerDataStorage {
|
@ -1,40 +1,9 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <spottedleaf@spottedleaf.dev>
|
||||
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||
Date: Wed, 28 Oct 2020 16:51:55 -0700
|
||||
Subject: [PATCH] Rewrite the light engine
|
||||
Subject: [PATCH] Starlight
|
||||
|
||||
The standard vanilla light engine is plagued by
|
||||
awful performance. Paper's changes to the light engine
|
||||
help a bit, however they appear to cause some lighting
|
||||
errors - most easily noticed in coral generation.
|
||||
|
||||
The vanilla light engine's is too abstract to be modified -
|
||||
so an entirely new implementation is required to fix the
|
||||
performance and lighting errors.
|
||||
|
||||
The new implementation is designed primarily to optimise
|
||||
light level propagations (increase and decrease). Unlike
|
||||
the vanilla light engine, this implementation tracks more
|
||||
information per queued value when performing a
|
||||
breadth first search. Vanilla just tracks coordinate, which
|
||||
means every time they handle a queued value, they must
|
||||
also determine the coordinate's target light level
|
||||
from its neighbours - very wasteful, especially considering
|
||||
these checks read neighbour block data.
|
||||
The new light engine tracks both position and target level,
|
||||
as well as whether the target block needs to be read at all
|
||||
(for checking sided propagation). So, the work done per coordinate
|
||||
is significantly reduced because no work is done for calculating
|
||||
the target level.
|
||||
In my testing, the block get calls were reduced by approximately
|
||||
an order of magnitude. However, the light read checks were only
|
||||
reduced by approximately 2x - but this is fine, light read checks
|
||||
are extremely cheap compared to block gets.
|
||||
|
||||
Generation testing showed that the new light engine improved
|
||||
total generation (not lighting itself, but the whole generation process)
|
||||
by 2x. According to cpu time, the light engine itself spent 10x less time
|
||||
lighting chunks for generation.
|
||||
See https://github.com/PaperMC/Starlight
|
||||
|
||||
diff --git a/src/main/java/ca/spottedleaf/starlight/common/light/BlockStarLightEngine.java b/src/main/java/ca/spottedleaf/starlight/common/light/BlockStarLightEngine.java
|
||||
new file mode 100644
|
||||
@ -4357,53 +4326,99 @@ index 0000000000000000000000000000000000000000..dd995e25ae620ae36cd5eecb2fe10ad0
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java b/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java
|
||||
index 190df802cb24aa360f6cf4d291e38b4b3fe4a2ac..68645bbbab9b4225048b647252d8f462028a9c84 100644
|
||||
--- a/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java
|
||||
+++ b/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.level.ThreadedLevelLightEngine;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
+import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
@@ -19,6 +20,8 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
diff --git a/src/main/java/io/papermc/paper/command/PaperCommand.java b/src/main/java/io/papermc/paper/command/PaperCommand.java
|
||||
index b3a58bf4b654e336826dc04da9e2f80ff8b9a9a7..c9a2ac696f7cefc8b0715f53db3fc541f26b62f6 100644
|
||||
--- a/src/main/java/io/papermc/paper/command/PaperCommand.java
|
||||
+++ b/src/main/java/io/papermc/paper/command/PaperCommand.java
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.papermc.paper.command;
|
||||
|
||||
import static net.kyori.adventure.text.Component.text;
|
||||
import io.papermc.paper.command.subcommands.EntityCommand;
|
||||
+import io.papermc.paper.command.subcommands.FixLightCommand;
|
||||
import io.papermc.paper.command.subcommands.HeapDumpCommand;
|
||||
import io.papermc.paper.command.subcommands.ReloadCommand;
|
||||
import io.papermc.paper.command.subcommands.VersionCommand;
|
||||
@@ -40,6 +41,7 @@ public final class PaperCommand extends Command {
|
||||
commands.put(Set.of("entity"), new EntityCommand());
|
||||
commands.put(Set.of("reload"), new ReloadCommand());
|
||||
commands.put(Set.of("version"), new VersionCommand());
|
||||
+ commands.put(Set.of("fixlight"), new FixLightCommand());
|
||||
|
||||
return commands.entrySet().stream()
|
||||
.flatMap(entry -> entry.getKey().stream().map(s -> Map.entry(s, entry.getValue())))
|
||||
diff --git a/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java b/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..450bd95218852174cfbc88d4517e17daee5ffd5f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java
|
||||
@@ -0,0 +1,115 @@
|
||||
+package io.papermc.paper.command.subcommands;
|
||||
+
|
||||
+import io.papermc.paper.command.PaperSubcommand;
|
||||
+import java.util.ArrayDeque;
|
||||
+import java.util.Deque;
|
||||
+import net.minecraft.server.MCUtil;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.level.ChunkHolder;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import net.minecraft.server.level.ThreadedLevelLightEngine;
|
||||
+import net.minecraft.world.level.ChunkPos;
|
||||
+import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
+import net.minecraft.world.level.chunk.LevelChunk;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
+import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
+
|
||||
+import static net.kyori.adventure.text.Component.text;
|
||||
+import static net.kyori.adventure.text.format.NamedTextColor.BLUE;
|
||||
+import static net.kyori.adventure.text.format.NamedTextColor.DARK_AQUA;
|
||||
import static net.kyori.adventure.text.format.NamedTextColor.GREEN;
|
||||
import static net.kyori.adventure.text.format.NamedTextColor.RED;
|
||||
|
||||
@@ -44,7 +47,7 @@ public final class FixLightCommand implements PaperSubcommand {
|
||||
sender.sendMessage(text("Radius cannot be negative!", RED));
|
||||
return;
|
||||
}
|
||||
- final int maxRadius = 5;
|
||||
+ final int maxRadius = 32; // Paper - MOOOOOORE
|
||||
radius = Math.min(maxRadius, parsed);
|
||||
if (radius != parsed) {
|
||||
post = () -> sender.sendMessage(text("Radius '" + parsed + "' was not in the required range [0, " + maxRadius + "], it was lowered to the maximum (" + maxRadius + " chunks).", RED));
|
||||
@@ -59,12 +62,67 @@ public final class FixLightCommand implements PaperSubcommand {
|
||||
ServerPlayer handle = player.getHandle();
|
||||
ServerLevel world = (ServerLevel) handle.level;
|
||||
ThreadedLevelLightEngine lightengine = world.getChunkSource().getLightEngine();
|
||||
+ // Paper start - rewrite light engine
|
||||
+ if (true) {
|
||||
+ this.starlightFixLight(handle, world, lightengine, radius, post);
|
||||
+import static net.kyori.adventure.text.format.NamedTextColor.GREEN;
|
||||
+import static net.kyori.adventure.text.format.NamedTextColor.RED;
|
||||
+
|
||||
+@DefaultQualifier(NonNull.class)
|
||||
+public final class FixLightCommand implements PaperSubcommand {
|
||||
+ @Override
|
||||
+ public boolean execute(final CommandSender sender, final String subCommand, final String[] args) {
|
||||
+ this.doFixLight(sender, args);
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ private void doFixLight(final CommandSender sender, final String[] args) {
|
||||
+ if (!(sender instanceof Player)) {
|
||||
+ sender.sendMessage(text("Only players can use this command", RED));
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end - rewrite light engine
|
||||
|
||||
net.minecraft.core.BlockPos center = MCUtil.toBlockPosition(player.getLocation());
|
||||
Deque<ChunkPos> queue = new ArrayDeque<>(MCUtil.getSpiralOutChunks(center, radius));
|
||||
updateLight(sender, world, lightengine, queue, post);
|
||||
}
|
||||
|
||||
+ // Paper start - rewrite light engine
|
||||
+ @Nullable Runnable post = null;
|
||||
+ int radius = 2;
|
||||
+ if (args.length > 0) {
|
||||
+ try {
|
||||
+ final int parsed = Integer.parseInt(args[0]);
|
||||
+ if (parsed < 0) {
|
||||
+ sender.sendMessage(text("Radius cannot be negative!", RED));
|
||||
+ return;
|
||||
+ }
|
||||
+ final int maxRadius = 32;
|
||||
+ radius = Math.min(maxRadius, parsed);
|
||||
+ if (radius != parsed) {
|
||||
+ post = () -> sender.sendMessage(text("Radius '" + parsed + "' was not in the required range [0, " + maxRadius + "], it was lowered to the maximum (" + maxRadius + " chunks).", RED));
|
||||
+ }
|
||||
+ } catch (final Exception e) {
|
||||
+ sender.sendMessage(text("'" + args[0] + "' is not a valid number.", RED));
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ CraftPlayer player = (CraftPlayer) sender;
|
||||
+ ServerPlayer handle = player.getHandle();
|
||||
+ ServerLevel world = (ServerLevel) handle.level;
|
||||
+ ThreadedLevelLightEngine lightengine = world.getChunkSource().getLightEngine();
|
||||
+ this.starlightFixLight(handle, world, lightengine, radius, post);
|
||||
+ }
|
||||
+
|
||||
+ private void starlightFixLight(
|
||||
+ final ServerPlayer sender,
|
||||
+ final ServerLevel world,
|
||||
@ -4411,10 +4426,10 @@ index 190df802cb24aa360f6cf4d291e38b4b3fe4a2ac..68645bbbab9b4225048b647252d8f462
|
||||
+ final int radius,
|
||||
+ final @Nullable Runnable done
|
||||
+ ) {
|
||||
+ long start = System.nanoTime();
|
||||
+ java.util.LinkedHashSet<ChunkPos> chunks = new java.util.LinkedHashSet<>(MCUtil.getSpiralOutChunks(sender.blockPosition(), radius)); // getChunkCoordinates is actually just bad mappings, this function rets position as blockpos
|
||||
+ final long start = System.nanoTime();
|
||||
+ final java.util.LinkedHashSet<ChunkPos> chunks = new java.util.LinkedHashSet<>(MCUtil.getSpiralOutChunks(sender.blockPosition(), radius)); // getChunkCoordinates is actually just bad mappings, this function rets position as blockpos
|
||||
+
|
||||
+ int[] pending = new int[1];
|
||||
+ final int[] pending = new int[1];
|
||||
+ for (java.util.Iterator<ChunkPos> iterator = chunks.iterator(); iterator.hasNext(); ) {
|
||||
+ final ChunkPos chunkPos = iterator.next();
|
||||
+
|
||||
@ -4428,16 +4443,16 @@ index 190df802cb24aa360f6cf4d291e38b4b3fe4a2ac..68645bbbab9b4225048b647252d8f462
|
||||
+ ++pending[0];
|
||||
+ }
|
||||
+
|
||||
+ int[] relitChunks = new int[1];
|
||||
+ final int[] relitChunks = new int[1];
|
||||
+ lightengine.relight(chunks,
|
||||
+ (ChunkPos chunkPos) -> {
|
||||
+ (final ChunkPos chunkPos) -> {
|
||||
+ ++relitChunks[0];
|
||||
+ sender.getBukkitEntity().sendMessage(text().color(DARK_AQUA).append(
|
||||
+ text("Relit chunk ", BLUE), text(chunkPos.toString()),
|
||||
+ text(", progress: ", BLUE), text((int) (Math.round(100.0 * (double) (relitChunks[0]) / (double) pending[0])) + "%")
|
||||
+ ));
|
||||
+ },
|
||||
+ (int totalRelit) -> {
|
||||
+ (final int totalRelit) -> {
|
||||
+ final long end = System.nanoTime();
|
||||
+ final long diff = Math.round(1.0e-6 * (end - start));
|
||||
+ sender.getBukkitEntity().sendMessage(text().color(DARK_AQUA).append(
|
||||
@ -4447,16 +4462,13 @@ index 190df802cb24aa360f6cf4d291e38b4b3fe4a2ac..68645bbbab9b4225048b647252d8f462
|
||||
+ if (done != null) {
|
||||
+ done.run();
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+ );
|
||||
+ sender.getBukkitEntity().sendMessage(text().color(BLUE).append(text("Relighting "), text(pending[0], DARK_AQUA), text(" chunks")));
|
||||
+ }
|
||||
+ // Paper end - rewrite light engine
|
||||
+
|
||||
private void updateLight(
|
||||
final CommandSender sender,
|
||||
final ServerLevel world,
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
index 09f262de1b12b09013f8277b25d13ffcf53b96d8..73712d6b9c828427d4c066c6d8672534575f3793 100644
|
||||
index 0873134f1f6de0c372ba28b89a20302c9a0115d8..86c33f029ae56fcace51b69763202be9f8bc5f44 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
@@ -55,7 +55,7 @@ public class ChunkHolder {
|
||||
@ -4469,33 +4481,33 @@ index 09f262de1b12b09013f8277b25d13ffcf53b96d8..73712d6b9c828427d4c066c6d8672534
|
||||
private final DebugBuffer<ChunkHolder.ChunkSaveDebug> chunkToSaveHistory;
|
||||
public int oldTicketLevel;
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 69b8f5dcae4ea75ea9d63c36b3f5b4383fe232f9..fe10c770b511fa8a38ece2bf9679492a85b28eff 100644
|
||||
index 2a9e5fb8164f79b0f9c1cb5497216e51f9df3454..cbd4e749574c55c6e52f42b62dd6da8cfcca97f9 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -133,7 +133,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -128,7 +128,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
public final LongSet entitiesInLevel;
|
||||
public final ServerLevel level;
|
||||
private final ThreadedLevelLightEngine lightEngine;
|
||||
- private final BlockableEventLoop<Runnable> mainThreadExecutor;
|
||||
+ public final BlockableEventLoop<Runnable> mainThreadExecutor; // Paper - public
|
||||
final java.util.concurrent.Executor mainInvokingExecutor; // Paper
|
||||
public ChunkGenerator generator;
|
||||
private RandomState randomState;
|
||||
public final Supplier<DimensionDataStorage> overworldDataStorage;
|
||||
diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||
index 537d34a0325a985948c744929b90144a66a35ee3..06e4d3a02e0d1326b7029157856476db4ef3575e 100644
|
||||
index fbe62a31ab199d83a1db0a4e0b1a813824e6f2c2..d38ad1b1eee92a6dbd2b79b4fcdb8959cdb4007d 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||
@@ -545,7 +545,7 @@ public abstract class DistanceManager {
|
||||
@@ -390,7 +390,7 @@ public abstract class DistanceManager {
|
||||
}
|
||||
|
||||
public void removeTicketsOnClosing() {
|
||||
- ImmutableSet<TicketType<?>> immutableset = ImmutableSet.of(TicketType.UNKNOWN, TicketType.POST_TELEPORT, TicketType.LIGHT, TicketType.FUTURE_AWAIT, TicketType.ASYNC_LOAD, TicketType.REQUIRED_LOAD); // Paper - add additional tickets to preserve
|
||||
+ ImmutableSet<TicketType<?>> immutableset = ImmutableSet.of(TicketType.UNKNOWN, TicketType.POST_TELEPORT, TicketType.LIGHT, TicketType.FUTURE_AWAIT, TicketType.ASYNC_LOAD, TicketType.REQUIRED_LOAD, TicketType.CHUNK_RELIGHT, ca.spottedleaf.starlight.common.light.StarLightInterface.CHUNK_WORK_TICKET); // Paper - add additional tickets to preserve
|
||||
- ImmutableSet<TicketType<?>> immutableset = ImmutableSet.of(TicketType.UNKNOWN, TicketType.POST_TELEPORT, TicketType.LIGHT, TicketType.FUTURE_AWAIT); // Paper - add additional tickets to preserve
|
||||
+ ImmutableSet<TicketType<?>> immutableset = ImmutableSet.of(TicketType.UNKNOWN, TicketType.POST_TELEPORT, TicketType.LIGHT, TicketType.FUTURE_AWAIT, TicketType.CHUNK_RELIGHT, ca.spottedleaf.starlight.common.light.StarLightInterface.CHUNK_WORK_TICKET); // Paper - add additional tickets to preserve
|
||||
ObjectIterator objectiterator = this.tickets.long2ObjectEntrySet().fastIterator();
|
||||
|
||||
while (objectiterator.hasNext()) {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java
|
||||
index 5539f2a7e069cbe98997b734f3b1cd498148f09b..b57bffce30154b196b879209c1ce559d0b82456e 100644
|
||||
index 5b238e41ffa3e374b52ee955cb39087571c6ffc2..89f3380632b098aaf95d68a386bc7e72c8c27f5c 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java
|
||||
@@ -23,6 +23,17 @@ import net.minecraft.world.level.chunk.LightChunkGetter;
|
||||
@ -4516,7 +4528,7 @@ index 5539f2a7e069cbe98997b734f3b1cd498148f09b..b57bffce30154b196b879209c1ce559d
|
||||
public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCloseable {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private final ProcessorMailbox<Runnable> taskMailbox;
|
||||
@@ -157,13 +168,168 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
|
||||
@@ -32,13 +43,168 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
|
||||
private volatile int taskPerBatch = 5;
|
||||
private final AtomicBoolean scheduled = new AtomicBoolean();
|
||||
|
||||
@ -4529,7 +4541,7 @@ index 5539f2a7e069cbe98997b734f3b1cd498148f09b..b57bffce30154b196b879209c1ce559d
|
||||
public ThreadedLevelLightEngine(LightChunkGetter chunkProvider, ChunkMap chunkStorage, boolean hasBlockLight, ProcessorMailbox<Runnable> processor, ProcessorHandle<ChunkTaskPriorityQueueSorter.Message<Runnable>> executor) {
|
||||
- super(chunkProvider, true, hasBlockLight);
|
||||
+ super(chunkProvider, false, false); // Paper - destroy vanilla light engine state
|
||||
this.chunkMap = chunkStorage; this.playerChunkMap = chunkMap; // Paper
|
||||
this.chunkMap = chunkStorage;
|
||||
this.sorterMailbox = executor;
|
||||
this.taskMailbox = processor;
|
||||
+ // Paper start - replace light engine impl
|
||||
@ -4539,7 +4551,7 @@ index 5539f2a7e069cbe98997b734f3b1cd498148f09b..b57bffce30154b196b879209c1ce559d
|
||||
+ // Paper end - replace light engine impl
|
||||
+ }
|
||||
+
|
||||
+// Paper start - replace light engine impl
|
||||
+ // Paper start - replace light engine impl
|
||||
+ protected final ChunkAccess getChunk(final int chunkX, final int chunkZ) {
|
||||
+ return ((ServerLevel)this.theLightEngine.getWorld()).getChunkSource().getChunkAtImmediately(chunkX, chunkZ);
|
||||
+ }
|
||||
@ -4664,7 +4676,7 @@ index 5539f2a7e069cbe98997b734f3b1cd498148f09b..b57bffce30154b196b879209c1ce559d
|
||||
+ @Override
|
||||
+ public boolean hasLightWork() {
|
||||
+ // route to new light engine
|
||||
+ return this.theLightEngine.hasUpdates() || !this.queue.isEmpty();
|
||||
+ return this.theLightEngine.hasUpdates();
|
||||
}
|
||||
|
||||
+ @Override
|
||||
@ -4686,7 +4698,7 @@ index 5539f2a7e069cbe98997b734f3b1cd498148f09b..b57bffce30154b196b879209c1ce559d
|
||||
@Override
|
||||
public void close() {
|
||||
}
|
||||
@@ -180,15 +346,16 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
|
||||
@@ -55,15 +221,16 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
|
||||
|
||||
@Override
|
||||
public void checkBlock(BlockPos pos) {
|
||||
@ -4709,7 +4721,7 @@ index 5539f2a7e069cbe98997b734f3b1cd498148f09b..b57bffce30154b196b879209c1ce559d
|
||||
this.addTask(pos.x, pos.z, () -> {
|
||||
return 0;
|
||||
}, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> {
|
||||
@@ -211,17 +378,16 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
|
||||
@@ -86,17 +253,16 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
|
||||
|
||||
@Override
|
||||
public void updateSectionStatus(SectionPos pos, boolean notReady) {
|
||||
@ -4733,7 +4745,7 @@ index 5539f2a7e069cbe98997b734f3b1cd498148f09b..b57bffce30154b196b879209c1ce559d
|
||||
this.addTask(pos.x, pos.z, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> {
|
||||
super.enableLightSources(pos, retainData);
|
||||
}, () -> {
|
||||
@@ -231,6 +397,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
|
||||
@@ -106,6 +272,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
|
||||
|
||||
@Override
|
||||
public void queueSectionData(LightLayer lightType, SectionPos pos, @Nullable DataLayer nibbles, boolean nonEdge) {
|
||||
@ -4741,7 +4753,7 @@ index 5539f2a7e069cbe98997b734f3b1cd498148f09b..b57bffce30154b196b879209c1ce559d
|
||||
this.addTask(pos.x(), pos.z(), () -> {
|
||||
return 0;
|
||||
}, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> {
|
||||
@@ -252,6 +419,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
|
||||
@@ -131,6 +298,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
|
||||
|
||||
@Override
|
||||
public void retainData(ChunkPos pos, boolean retainData) {
|
||||
@ -4749,7 +4761,7 @@ index 5539f2a7e069cbe98997b734f3b1cd498148f09b..b57bffce30154b196b879209c1ce559d
|
||||
this.addTask(pos.x, pos.z, () -> {
|
||||
return 0;
|
||||
}, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> {
|
||||
@@ -274,6 +442,37 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
|
||||
@@ -153,6 +321,37 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
|
||||
}
|
||||
|
||||
public CompletableFuture<ChunkAccess> lightChunk(ChunkAccess chunk, boolean excludeBlocks) {
|
||||
@ -4785,61 +4797,55 @@ index 5539f2a7e069cbe98997b734f3b1cd498148f09b..b57bffce30154b196b879209c1ce559d
|
||||
+ }
|
||||
+ // Paper end - replace light engine impl
|
||||
ChunkPos chunkPos = chunk.getPos();
|
||||
// Paper start
|
||||
//ichunkaccess.b(false); // Don't need to disable this
|
||||
@@ -316,7 +515,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
|
||||
chunk.setLightCorrect(false);
|
||||
this.addTask(chunkPos.x, chunkPos.z, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> {
|
||||
@@ -187,7 +386,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
|
||||
}
|
||||
|
||||
public void tryScheduleUpdate() {
|
||||
- if ((!this.queue.isEmpty() || super.hasLightWork()) && this.scheduled.compareAndSet(false, true)) { // Paper
|
||||
- if ((!this.lightTasks.isEmpty() || super.hasLightWork()) && this.scheduled.compareAndSet(false, true)) {
|
||||
+ if (this.hasLightWork() && this.scheduled.compareAndSet(false, true)) { // Paper // Paper - rewrite light engine
|
||||
this.taskMailbox.tell(() -> {
|
||||
this.runUpdate();
|
||||
this.scheduled.set(false);
|
||||
@@ -333,12 +532,12 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
|
||||
if (queue.poll(pre, post)) {
|
||||
pre.forEach(Runnable::run);
|
||||
pre.clear();
|
||||
- super.runUpdates(Integer.MAX_VALUE, true, true);
|
||||
+ this.theLightEngine.propagateChanges(); // Paper - rewrite light engine
|
||||
post.forEach(Runnable::run);
|
||||
post.clear();
|
||||
} else {
|
||||
// might have level updates to go still
|
||||
- super.runUpdates(Integer.MAX_VALUE, true, true);
|
||||
+ this.theLightEngine.propagateChanges(); // Paper - rewrite light engine
|
||||
@@ -209,7 +408,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
|
||||
}
|
||||
// Paper end
|
||||
}
|
||||
|
||||
objectListIterator.back(j);
|
||||
- super.runUpdates(Integer.MAX_VALUE, true, true);
|
||||
+ this.theLightEngine.propagateChanges(); // Paper - rewrite light engine
|
||||
|
||||
for(int var5 = 0; objectListIterator.hasNext() && var5 < i; ++var5) {
|
||||
Pair<ThreadedLevelLightEngine.TaskType, Runnable> pair2 = objectListIterator.next();
|
||||
diff --git a/src/main/java/net/minecraft/server/level/TicketType.java b/src/main/java/net/minecraft/server/level/TicketType.java
|
||||
index 41ddcf6775f99c56cf4b13b284420061e5dd6bdc..ae46429264e6a7e5c88b6b6a41a6df4db7b3e70d 100644
|
||||
index 0d536d72ac918fbd403397ff369d10143ee9c204..6051e5f272838ef23276a90e21c2fc821ca155d1 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/TicketType.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/TicketType.java
|
||||
@@ -32,6 +32,7 @@ public class TicketType<T> {
|
||||
@@ -26,6 +26,7 @@ public class TicketType<T> {
|
||||
public static final TicketType<ChunkPos> UNKNOWN = TicketType.create("unknown", Comparator.comparingLong(ChunkPos::toLong), 1);
|
||||
public static final TicketType<Unit> PLUGIN = TicketType.create("plugin", (a, b) -> 0); // CraftBukkit
|
||||
public static final TicketType<org.bukkit.plugin.Plugin> PLUGIN_TICKET = TicketType.create("plugin_ticket", (plugin1, plugin2) -> plugin1.getClass().getName().compareTo(plugin2.getClass().getName())); // CraftBukkit
|
||||
public static final TicketType<Long> DELAY_UNLOAD = create("delay_unload", Long::compareTo, 300); // Paper
|
||||
public static final TicketType<Long> REQUIRED_LOAD = create("required_load", Long::compareTo); // Paper - make sure getChunkAt does not fail
|
||||
+ public static final TicketType<Long> CHUNK_RELIGHT = create("light_update", Long::compareTo); // Paper - ensure chunks stay loaded for lighting
|
||||
|
||||
public static <T> TicketType<T> create(String name, Comparator<T> argumentComparator) {
|
||||
return new TicketType<>(name, argumentComparator, 0L);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
index 178d9ad7525b6743038ed45c6f85686a860ffd26..24b820484497714eb8be87e07ca1d37829d4f2c9 100644
|
||||
index f0bd06ab32e99c188510b3c3fa41f1737ab4fe78..51ac731cf49e6d2cd574e48f26c4b151e9014826 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
@@ -701,6 +701,7 @@ public abstract class BlockBehaviour {
|
||||
@@ -694,6 +694,7 @@ public abstract class BlockBehaviour {
|
||||
this.hasPostProcess = blockbase_info.hasPostProcess;
|
||||
this.emissiveRendering = blockbase_info.emissiveRendering;
|
||||
this.offsetType = (BlockBehaviour.OffsetType) blockbase_info.offsetType.apply(this.asState());
|
||||
+ this.conditionallyFullOpaque = this.isOpaque() & this.isTransparentOnSomeFaces(); // Paper
|
||||
}
|
||||
// Paper start - impl cached craft block data, lazy load to fix issue with loading at the wrong time
|
||||
private org.bukkit.craftbukkit.block.data.CraftBlockData cachedCraftBlockData;
|
||||
@@ -721,6 +722,18 @@ public abstract class BlockBehaviour {
|
||||
protected boolean isTicking;
|
||||
protected FluidState fluid;
|
||||
|
||||
// Paper start
|
||||
@@ -702,12 +703,25 @@ public abstract class BlockBehaviour {
|
||||
return this.shapeExceedsCube;
|
||||
}
|
||||
// Paper end
|
||||
+ // Paper start
|
||||
+ // Paper start - starlight
|
||||
+ protected int opacityIfCached = -1;
|
||||
+ // ret -1 if opacity is dynamic, or -1 if the block is conditionally full opaque, else return opacity in [0, 15]
|
||||
+ public final int getOpacityIfCached() {
|
||||
@ -4850,20 +4856,19 @@ index 178d9ad7525b6743038ed45c6f85686a860ffd26..24b820484497714eb8be87e07ca1d378
|
||||
+ public final boolean isConditionallyFullOpaque() {
|
||||
+ return this.conditionallyFullOpaque;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+ // Paper end - starlight
|
||||
|
||||
public void initCache() {
|
||||
this.fluid = this.getBlock().getFluidState(this.asState()); // Paper - moved from getFluid()
|
||||
@@ -729,6 +742,7 @@ public abstract class BlockBehaviour {
|
||||
if (!this.getBlock().hasDynamicShape()) {
|
||||
this.cache = new BlockBehaviour.BlockStateBase.Cache(this.asState());
|
||||
}
|
||||
this.shapeExceedsCube = this.cache == null || this.cache.largeCollisionShape; // Paper - moved from actual method to here
|
||||
+ this.opacityIfCached = this.cache == null || this.isConditionallyFullOpaque() ? -1 : this.cache.lightBlock; // Paper - cache opacity for light
|
||||
+ this.opacityIfCached = this.cache == null || this.isConditionallyFullOpaque() ? -1 : this.cache.lightBlock; // Paper - starlight - cache opacity for light
|
||||
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
||||
index a97909e77b9b28aede8c8716831c3f9a90618f09..b68625ebb32b8d1e5bc232d7cc791edbed923378 100644
|
||||
index fabc7df600c89b01d97a76eb0b1206a32407b906..0e787d877901dfcea714b0e14e9fc4358ee30bbe 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
||||
@@ -81,6 +81,47 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
|
||||
@ -4914,14 +4919,37 @@ index a97909e77b9b28aede8c8716831c3f9a90618f09..b68625ebb32b8d1e5bc232d7cc791edb
|
||||
|
||||
public ChunkAccess(ChunkPos pos, UpgradeData upgradeData, LevelHeightAccessor heightLimitView, Registry<Biome> biome, long inhabitedTime, @Nullable LevelChunkSection[] sectionArrayInitializer, @Nullable BlendingData blendingData) {
|
||||
this.locX = pos.x; this.locZ = pos.z; // Paper - reduce need for field lookups
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java
|
||||
index 441d46635caedfae3cb2f46d30b8d9ae95636e7b..e6240f891e396d91e31b02fdf3084be77e9d6697 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java
|
||||
@@ -292,6 +292,17 @@ public class ChunkStatus {
|
||||
return this.chunkType;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public static ChunkStatus getStatus(String name) {
|
||||
+ try {
|
||||
+ // We need this otherwise we return EMPTY for invalid names
|
||||
+ ResourceLocation key = new ResourceLocation(name);
|
||||
+ return Registry.CHUNK_STATUS.getOptional(key).orElse(null);
|
||||
+ } catch (Exception ex) {
|
||||
+ return null; // invalid name
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
public static ChunkStatus byName(String id) {
|
||||
return (ChunkStatus) Registry.CHUNK_STATUS.get(ResourceLocation.tryParse(id));
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java
|
||||
index a9c65c8d36e5c7080133706df1363b3ce52e3370..d1b175f2bb1bc96e4f044a97b14721feb44d78f5 100644
|
||||
index 80e383e9a2d12f9f1b0b0d9ae71a0add9b51c9d4..a78bf00d4559dd99869d93ec78b3525d24331925 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java
|
||||
@@ -21,6 +21,38 @@ public class EmptyLevelChunk extends LevelChunk {
|
||||
@@ -21,6 +21,40 @@ public class EmptyLevelChunk extends LevelChunk {
|
||||
this.biome = holder;
|
||||
}
|
||||
|
||||
+ // Paper start - starlight
|
||||
+ @Override
|
||||
+ public ca.spottedleaf.starlight.common.light.SWMRNibbleArray[] getBlockNibbles() {
|
||||
+ return ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(this.getLevel());
|
||||
@ -4953,12 +4981,13 @@ index a9c65c8d36e5c7080133706df1363b3ce52e3370..d1b175f2bb1bc96e4f044a97b14721fe
|
||||
+
|
||||
+ @Override
|
||||
+ public void setBlockEmptinessMap(final boolean[] emptinessMap) {}
|
||||
+ // Paper end - starlight
|
||||
+
|
||||
// Paper start
|
||||
@Override
|
||||
public BlockState getBlockState(int x, int y, int z) {
|
||||
public BlockState getBlockState(BlockPos pos) {
|
||||
return Blocks.VOID_AIR.defaultBlockState();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
|
||||
index 7b320357973202423c29743d922b72dc4ec11efe..8ffc206a858864d277ff94de7c66ffdb07d8f491 100644
|
||||
index 3dff0f7c3ccd04a67b2153e402d801de2341e520..ac5dff35e2df23b8790bbe65c40acc6a3c77e6ac 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
|
||||
@@ -31,6 +31,48 @@ public class ImposterProtoChunk extends ProtoChunk {
|
||||
@ -5011,13 +5040,13 @@ index 7b320357973202423c29743d922b72dc4ec11efe..8ffc206a858864d277ff94de7c66ffdb
|
||||
super(wrapped.getPos(), UpgradeData.EMPTY, wrapped.levelHeightAccessor, wrapped.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), wrapped.getBlendingData());
|
||||
this.wrapped = wrapped;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index c85380c3bf3bf4448a28a91af78f41c235a583e4..d870cefbe5b7485f423817f4f639e3e2a304640c 100644
|
||||
index b322d9b7bd9e107a9adf995b6c4db4ff0af05fc1..e75ec8f6aa597b5f3048d6269fba45eef057bc71 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -100,6 +100,10 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -93,6 +93,10 @@ public class LevelChunk extends ChunkAccess {
|
||||
|
||||
public LevelChunk(Level world, ChunkPos pos, UpgradeData upgradeData, LevelChunkTicks<Block> blockTickScheduler, LevelChunkTicks<Fluid> fluidTickScheduler, long inhabitedTime, @Nullable LevelChunkSection[] sectionArrayInitializer, @Nullable LevelChunk.PostLoadProcessor entityLoader, @Nullable BlendingData blendingData) {
|
||||
super(pos, upgradeData, world, net.minecraft.server.MinecraftServer.getServer().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), inhabitedTime, sectionArrayInitializer, blendingData); // Paper - Anti-Xray - The world isn't ready yet, use server singleton for registry
|
||||
super(pos, upgradeData, world, world.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), inhabitedTime, sectionArrayInitializer, blendingData);
|
||||
+ // Paper start - rewrite light engine
|
||||
+ this.setBlockNibbles(ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(world));
|
||||
+ this.setSkyNibbles(ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(world));
|
||||
@ -5025,7 +5054,7 @@ index c85380c3bf3bf4448a28a91af78f41c235a583e4..d870cefbe5b7485f423817f4f639e3e2
|
||||
this.tickersInLevel = Maps.newHashMap();
|
||||
this.clientLightReady = false;
|
||||
this.level = (ServerLevel) world; // CraftBukkit - type
|
||||
@@ -330,6 +334,12 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -230,6 +234,12 @@ public class LevelChunk extends ChunkAccess {
|
||||
|
||||
public LevelChunk(ServerLevel world, ProtoChunk protoChunk, @Nullable LevelChunk.PostLoadProcessor entityLoader) {
|
||||
this(world, protoChunk.getPos(), protoChunk.getUpgradeData(), protoChunk.unpackBlockTicks(), protoChunk.unpackFluidTicks(), protoChunk.getInhabitedTime(), protoChunk.getSections(), entityLoader, protoChunk.getBlendingData());
|
||||
@ -5039,10 +5068,10 @@ index c85380c3bf3bf4448a28a91af78f41c235a583e4..d870cefbe5b7485f423817f4f639e3e2
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
index 5ebde3a4f99b8d017d9a10a30fefc0b7dd011319..7908360dd47937b2cb702e381802b7b278a5198e 100644
|
||||
index 78e20871e4bd8d92c4475f797a55733c68f6aeb4..33eecdac9d844af2f70aad97c4788b138dab8896 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
@@ -203,7 +203,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
@@ -142,7 +142,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
return this.get(this.strategy.getIndex(x, y, z));
|
||||
}
|
||||
|
||||
@ -5052,7 +5081,7 @@ index 5ebde3a4f99b8d017d9a10a30fefc0b7dd011319..7908360dd47937b2cb702e381802b7b2
|
||||
return data.palette.valueFor(data.storage.get(index));
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
|
||||
index 9014331e4ceac9f77a911aead87bf452d29e3fb4..13b62e8e6569c154547bc0d5626488c5b0839f20 100644
|
||||
index 603111a52346f678aba0fd66b010d8f3026fce40..040c6092ceed4c693a7a056c0d1a49d3d2242b19 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
|
||||
@@ -55,6 +55,12 @@ public class ProtoChunk extends ChunkAccess {
|
||||
@ -5069,10 +5098,10 @@ index 9014331e4ceac9f77a911aead87bf452d29e3fb4..13b62e8e6569c154547bc0d5626488c5
|
||||
this.fluidTicks = fluidTickScheduler;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||
index be9c15fe141ede1132dbe07ba4bfcf22036ab194..4df5853781a2ac89dd391374d34d9096643a2ab8 100644
|
||||
index 864e2e0355a5fb8c1d4a5b0896ba299faf9ea534..2dead743775df9b261bdcdca30df9b672c6acc8b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||
@@ -94,6 +94,14 @@ public class ChunkSerializer {
|
||||
@@ -82,6 +82,14 @@ public class ChunkSerializer {
|
||||
public static final String BLOCK_LIGHT_TAG = "BlockLight";
|
||||
public static final String SKY_LIGHT_TAG = "SkyLight";
|
||||
|
||||
@ -5086,13 +5115,13 @@ index be9c15fe141ede1132dbe07ba4bfcf22036ab194..4df5853781a2ac89dd391374d34d9096
|
||||
+
|
||||
public ChunkSerializer() {}
|
||||
|
||||
// Paper start - guard against serializing mismatching coordinates
|
||||
@@ -153,13 +161,20 @@ public class ChunkSerializer {
|
||||
public static ProtoChunk read(ServerLevel world, PoiManager poiStorage, ChunkPos chunkPos, CompoundTag nbt) {
|
||||
@@ -92,13 +100,20 @@ public class ChunkSerializer {
|
||||
}
|
||||
|
||||
UpgradeData chunkconverter = nbt.contains("UpgradeData", 10) ? new UpgradeData(nbt.getCompound("UpgradeData"), world) : UpgradeData.EMPTY;
|
||||
- boolean flag = nbt.getBoolean("isLightOn");
|
||||
+ boolean flag = getStatus(nbt).isOrAfter(ChunkStatus.LIGHT) && nbt.get("isLightOn") != null && nbt.getInt(STARLIGHT_VERSION_TAG) == STARLIGHT_LIGHT_VERSION; // Paper
|
||||
+ boolean flag = getStatus(nbt) != null && getStatus(nbt).isOrAfter(ChunkStatus.LIGHT) && nbt.get("isLightOn") != null && nbt.getInt(STARLIGHT_VERSION_TAG) == STARLIGHT_LIGHT_VERSION; // Paper
|
||||
ListTag nbttaglist = nbt.getList("sections", 10);
|
||||
int i = world.getSectionsCount();
|
||||
LevelChunkSection[] achunksection = new LevelChunkSection[i];
|
||||
@ -5100,8 +5129,8 @@ index be9c15fe141ede1132dbe07ba4bfcf22036ab194..4df5853781a2ac89dd391374d34d9096
|
||||
ServerChunkCache chunkproviderserver = world.getChunkSource();
|
||||
LevelLightEngine lightengine = chunkproviderserver.getLightEngine();
|
||||
+ // Paper start
|
||||
+ ca.spottedleaf.starlight.common.light.SWMRNibbleArray[] blockNibbles = ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(world); // Paper - replace light impl
|
||||
+ ca.spottedleaf.starlight.common.light.SWMRNibbleArray[] skyNibbles = ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(world); // Paper - replace light impl
|
||||
+ ca.spottedleaf.starlight.common.light.SWMRNibbleArray[] blockNibbles = ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(world);
|
||||
+ ca.spottedleaf.starlight.common.light.SWMRNibbleArray[] skyNibbles = ca.spottedleaf.starlight.common.light.StarLightEngine.getFilledEmptyLight(world);
|
||||
+ final int minSection = io.papermc.paper.util.WorldUtil.getMinLightSection(world);
|
||||
+ final int maxSection = io.papermc.paper.util.WorldUtil.getMaxLightSection(world);
|
||||
+ boolean canReadSky = world.dimensionType().hasSkyLight();
|
||||
@ -5109,7 +5138,7 @@ index be9c15fe141ede1132dbe07ba4bfcf22036ab194..4df5853781a2ac89dd391374d34d9096
|
||||
Registry<Biome> iregistry = world.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY);
|
||||
Codec<PalettedContainer<Holder<Biome>>> codec = ChunkSerializer.makeBiomeCodecRW(iregistry); // CraftBukkit - read/write
|
||||
boolean flag2 = false;
|
||||
@@ -167,7 +182,7 @@ public class ChunkSerializer {
|
||||
@@ -106,7 +121,7 @@ public class ChunkSerializer {
|
||||
DataResult dataresult;
|
||||
|
||||
for (int j = 0; j < nbttaglist.size(); ++j) {
|
||||
@ -5118,46 +5147,33 @@ index be9c15fe141ede1132dbe07ba4bfcf22036ab194..4df5853781a2ac89dd391374d34d9096
|
||||
byte b0 = nbttagcompound1.getByte("Y");
|
||||
int k = world.getSectionIndexFromSectionY(b0);
|
||||
|
||||
@@ -214,31 +229,45 @@ public class ChunkSerializer {
|
||||
@@ -147,19 +162,39 @@ public class ChunkSerializer {
|
||||
boolean flag3 = nbttagcompound1.contains("BlockLight", 7);
|
||||
boolean flag4 = flag1 && nbttagcompound1.contains("SkyLight", 7);
|
||||
|
||||
- if (flag3 || flag4) {
|
||||
- if (!flag2) {
|
||||
- lightengine.retainData(chunkPos, true);
|
||||
- flag2 = true;
|
||||
- }
|
||||
-
|
||||
+ // Paper start - rewrite the light engine
|
||||
+ if (flag) {
|
||||
+ try {
|
||||
+ if ((flag3 || flag4) && !flag2) {
|
||||
+ // Paper end - rewrite the light engine
|
||||
tasksToExecuteOnMain.add(() -> { // Paper - delay this task since we're executing off-main
|
||||
lightengine.retainData(chunkPos, true);
|
||||
}); // Paper - delay this task since we're executing off-main
|
||||
flag2 = true;
|
||||
}
|
||||
|
||||
+ int y = sectionData.getByte("Y");
|
||||
+ // Paper end - rewrite the light engine
|
||||
if (flag3) {
|
||||
- // Paper start - delay this task since we're executing off-main
|
||||
- DataLayer blockLight = new DataLayer(nbttagcompound1.getByteArray("BlockLight").clone());
|
||||
- tasksToExecuteOnMain.add(() -> {
|
||||
- lightengine.queueSectionData(LightLayer.BLOCK, SectionPos.of(chunkPos, b0), blockLight, true);
|
||||
- });
|
||||
- // Paper end - delay this task since we're executing off-main
|
||||
- lightengine.queueSectionData(LightLayer.BLOCK, SectionPos.of(chunkPos, b0), new DataLayer(nbttagcompound1.getByteArray("BlockLight")), true);
|
||||
+ // Paper start - rewrite the light engine
|
||||
+ // this is where our diff is
|
||||
+ blockNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(sectionData.getByteArray("BlockLight").clone(), sectionData.getInt(BLOCKLIGHT_STATE_TAG)); // clone for data safety
|
||||
+ } else {
|
||||
+ blockNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(null, sectionData.getInt(BLOCKLIGHT_STATE_TAG));
|
||||
+ // Paper end - rewrite the light engine
|
||||
}
|
||||
+ // Paper end - rewrite the light engine
|
||||
|
||||
if (flag4) {
|
||||
- // Paper start - delay this task since we're executing off-main
|
||||
- DataLayer skyLight = new DataLayer(nbttagcompound1.getByteArray("SkyLight").clone());
|
||||
- tasksToExecuteOnMain.add(() -> {
|
||||
- lightengine.queueSectionData(LightLayer.SKY, SectionPos.of(chunkPos, b0), skyLight, true);
|
||||
- });
|
||||
- // Paper end - delay this task since we're executing off-mai
|
||||
- lightengine.queueSectionData(LightLayer.SKY, SectionPos.of(chunkPos, b0), new DataLayer(nbttagcompound1.getByteArray("SkyLight")), true);
|
||||
+ // Paper start - rewrite the light engine
|
||||
+ // we store under the same key so mod programs editing nbt
|
||||
+ // can still read the data, hopefully.
|
||||
@ -5167,18 +5183,19 @@ index be9c15fe141ede1132dbe07ba4bfcf22036ab194..4df5853781a2ac89dd391374d34d9096
|
||||
+ skyNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(sectionData.getByteArray("SkyLight").clone(), sectionData.getInt(SKYLIGHT_STATE_TAG)); // clone for data safety
|
||||
+ } else if (flag1) {
|
||||
+ skyNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(null, sectionData.getInt(SKYLIGHT_STATE_TAG));
|
||||
}
|
||||
+ // Paper end - rewrite the light engine
|
||||
+ // Paper end - rewrite the light engine
|
||||
+ }
|
||||
+
|
||||
+ // Paper start - rewrite the light engine
|
||||
+ } catch (Exception ex) {
|
||||
+ LOGGER.warn("Failed to load light data for chunk " + chunkPos + " in world '" + world.getWorld().getName() + "', light will be regenerated", ex);
|
||||
+ flag = false;
|
||||
+ }
|
||||
}
|
||||
+ // Paper end - rewrite light engine
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,6 +296,8 @@ public class ChunkSerializer {
|
||||
@@ -188,6 +223,8 @@ public class ChunkSerializer {
|
||||
}, chunkPos);
|
||||
|
||||
object1 = new LevelChunk(world.getLevel(), chunkPos, chunkconverter, levelchunkticks, levelchunkticks1, l, achunksection, ChunkSerializer.postLoadChunk(world, nbt), blendingdata);
|
||||
@ -5187,7 +5204,7 @@ index be9c15fe141ede1132dbe07ba4bfcf22036ab194..4df5853781a2ac89dd391374d34d9096
|
||||
} else {
|
||||
ProtoChunkTicks<Block> protochunkticklist = ProtoChunkTicks.load(nbt.getList("block_ticks", 10), (s) -> {
|
||||
return Registry.BLOCK.getOptional(ResourceLocation.tryParse(s));
|
||||
@@ -275,6 +306,8 @@ public class ChunkSerializer {
|
||||
@@ -196,6 +233,8 @@ public class ChunkSerializer {
|
||||
return Registry.FLUID.getOptional(ResourceLocation.tryParse(s));
|
||||
}, chunkPos);
|
||||
ProtoChunk protochunk = new ProtoChunk(chunkPos, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, world, iregistry, blendingdata);
|
||||
@ -5196,19 +5213,10 @@ index be9c15fe141ede1132dbe07ba4bfcf22036ab194..4df5853781a2ac89dd391374d34d9096
|
||||
|
||||
object1 = protochunk;
|
||||
protochunk.setInhabitedTime(l);
|
||||
@@ -420,7 +453,7 @@ public class ChunkSerializer {
|
||||
DataLayer[] blockLight = new DataLayer[lightenginethreaded.getMaxLightSection() - lightenginethreaded.getMinLightSection()];
|
||||
DataLayer[] skyLight = new DataLayer[lightenginethreaded.getMaxLightSection() - lightenginethreaded.getMinLightSection()];
|
||||
@@ -336,6 +375,12 @@ public class ChunkSerializer {
|
||||
// CraftBukkit end
|
||||
|
||||
- for (int i = lightenginethreaded.getMinLightSection(); i < lightenginethreaded.getMaxLightSection(); ++i) {
|
||||
+ for (int i = lightenginethreaded.getMinLightSection(); false && i < lightenginethreaded.getMaxLightSection(); ++i) { // Paper - don't run loop, we don't need to - light data is per chunk now
|
||||
DataLayer blockArray = lightenginethreaded.getLayerListener(LightLayer.BLOCK).getDataLayerData(SectionPos.of(chunkPos, i));
|
||||
DataLayer skyArray = lightenginethreaded.getLayerListener(LightLayer.SKY).getDataLayerData(SectionPos.of(chunkPos, i));
|
||||
|
||||
@@ -478,6 +511,12 @@ public class ChunkSerializer {
|
||||
}
|
||||
public static CompoundTag saveChunk(ServerLevel world, ChunkAccess chunk, @org.checkerframework.checker.nullness.qual.Nullable AsyncSaveData asyncsavedata) {
|
||||
// Paper end
|
||||
public static CompoundTag write(ServerLevel world, ChunkAccess chunk) {
|
||||
+ // Paper start - rewrite light impl
|
||||
+ final int minSection = io.papermc.paper.util.WorldUtil.getMinLightSection(world);
|
||||
+ final int maxSection = io.papermc.paper.util.WorldUtil.getMaxLightSection(world);
|
||||
@ -5218,21 +5226,12 @@ index be9c15fe141ede1132dbe07ba4bfcf22036ab194..4df5853781a2ac89dd391374d34d9096
|
||||
ChunkPos chunkcoordintpair = chunk.getPos();
|
||||
CompoundTag nbttagcompound = new CompoundTag();
|
||||
|
||||
@@ -528,20 +567,14 @@ public class ChunkSerializer {
|
||||
@@ -386,11 +431,14 @@ public class ChunkSerializer {
|
||||
for (int i = lightenginethreaded.getMinLightSection(); i < lightenginethreaded.getMaxLightSection(); ++i) {
|
||||
int j = chunk.getSectionIndexFromSectionY(i);
|
||||
boolean flag1 = j >= 0 && j < achunksection.length;
|
||||
- // Paper start - async chunk save for unload
|
||||
- DataLayer nibblearray; // block light
|
||||
- DataLayer nibblearray1; // sky light
|
||||
- if (asyncsavedata == null) {
|
||||
- nibblearray = lightenginethreaded.getLayerListener(LightLayer.BLOCK).getDataLayerData(SectionPos.of(chunkcoordintpair, i)); /// Paper - diff on method change (see getAsyncSaveData)
|
||||
- nibblearray1 = lightenginethreaded.getLayerListener(LightLayer.SKY).getDataLayerData(SectionPos.of(chunkcoordintpair, i)); // Paper - diff on method change (see getAsyncSaveData)
|
||||
- } else {
|
||||
- nibblearray = asyncsavedata.blockLight[i - lightenginethreaded.getMinLightSection()];
|
||||
- nibblearray1 = asyncsavedata.skyLight[i - lightenginethreaded.getMinLightSection()];
|
||||
- }
|
||||
- // Paper end
|
||||
- DataLayer nibblearray = lightenginethreaded.getLayerListener(LightLayer.BLOCK).getDataLayerData(SectionPos.of(chunkcoordintpair, i));
|
||||
- DataLayer nibblearray1 = lightenginethreaded.getLayerListener(LightLayer.SKY).getDataLayerData(SectionPos.of(chunkcoordintpair, i));
|
||||
+ // Paper - replace light engine
|
||||
|
||||
- if (flag1 || nibblearray != null || nibblearray1 != null) {
|
||||
@ -5246,7 +5245,7 @@ index be9c15fe141ede1132dbe07ba4bfcf22036ab194..4df5853781a2ac89dd391374d34d9096
|
||||
|
||||
if (flag1) {
|
||||
LevelChunkSection chunksection = achunksection[j];
|
||||
@@ -556,13 +589,27 @@ public class ChunkSerializer {
|
||||
@@ -405,13 +453,27 @@ public class ChunkSerializer {
|
||||
nbttagcompound1.put("biomes", (Tag) dataresult1.getOrThrow(false, logger1::error));
|
||||
}
|
||||
|
||||
@ -5278,7 +5277,7 @@ index be9c15fe141ede1132dbe07ba4bfcf22036ab194..4df5853781a2ac89dd391374d34d9096
|
||||
|
||||
if (!nbttagcompound1.isEmpty()) {
|
||||
nbttagcompound1.putByte("Y", (byte) i);
|
||||
@@ -573,7 +620,8 @@ public class ChunkSerializer {
|
||||
@@ -422,7 +484,8 @@ public class ChunkSerializer {
|
||||
|
||||
nbttagcompound.put("sections", nbttaglist);
|
||||
if (flag) {
|
||||
@ -5287,4 +5286,22 @@ index be9c15fe141ede1132dbe07ba4bfcf22036ab194..4df5853781a2ac89dd391374d34d9096
|
||||
+ nbttagcompound.putBoolean("isLightOn", false); // Paper - set to false but still store, this allows us to detect --eraseCache (as eraseCache _removes_)
|
||||
}
|
||||
|
||||
// Paper start
|
||||
ListTag nbttaglist1 = new ListTag();
|
||||
@@ -497,6 +560,17 @@ public class ChunkSerializer {
|
||||
}));
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public static @Nullable ChunkStatus getStatus(@Nullable CompoundTag compound) {
|
||||
+ if (compound == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ // Note: Copied from below
|
||||
+ return ChunkStatus.getStatus(compound.getString("Status"));
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public static ChunkStatus.ChunkType getChunkTypeFromTag(@Nullable CompoundTag nbt) {
|
||||
return nbt != null ? ChunkStatus.byName(nbt.getString("Status")).getChunkType() : ChunkStatus.ChunkType.PROTOCHUNK;
|
||||
}
|
18056
patches/server/0016-Rewrite-chunk-system.patch
Normale Datei
18056
patches/server/0016-Rewrite-chunk-system.patch
Normale Datei
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -7,7 +7,7 @@ Subject: [PATCH] Add command line option to load extra plugin jars not in the
|
||||
ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index eb5c7e15366ee5902d8c754a1e9daec50d26fb17..37fefdf0d96cd2b6e23b6e69ee5a8db16f0e51da 100644
|
||||
index 2103081cf6a8db00d78618340eef514082fede6e..6723b52fd9306b0f9e3f1d0eadcbfd76d383beee 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -405,10 +405,15 @@ public final class CraftServer implements Server {
|
@ -1,89 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 18 Jun 2016 23:22:12 -0400
|
||||
Subject: [PATCH] Delay Chunk Unloads based on Player Movement
|
||||
|
||||
When players are moving in the world, doing things such as building or exploring,
|
||||
they will commonly go back and forth in a small area. This causes a ton of chunk load
|
||||
and unload activity on the edge chunks of their view distance.
|
||||
|
||||
A simple back and forth movement in 6 blocks could spam a chunk to thrash a
|
||||
loading and unload cycle over and over again.
|
||||
|
||||
This is very wasteful. This system introduces a delay of inactivity on a chunk
|
||||
before it actually unloads, which will be handled by the ticket expiry process.
|
||||
|
||||
This allows servers with smaller worlds who do less long distance exploring to stop
|
||||
wasting cpu cycles on saving/unloading/reloading chunks repeatedly.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||
index 6181f675d7addde30f7018b4cd46fe061a14da51..aaf6344d3187ceada947ce6ee0fbba91ca0271a3 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||
@@ -198,6 +198,27 @@ public abstract class DistanceManager {
|
||||
boolean removed = false; // CraftBukkit
|
||||
if (arraysetsorted.remove(ticket)) {
|
||||
removed = true; // CraftBukkit
|
||||
+ // Paper start - delay chunk unloads for player tickets
|
||||
+ long delayChunkUnloadsBy = chunkMap.level.paperConfig().chunks.delayChunkUnloadsBy.ticks();
|
||||
+ if (ticket.getType() == TicketType.PLAYER && delayChunkUnloadsBy > 0) {
|
||||
+ boolean hasPlayer = false;
|
||||
+ for (Ticket<?> ticket1 : arraysetsorted) {
|
||||
+ if (ticket1.getType() == TicketType.PLAYER) {
|
||||
+ hasPlayer = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ ChunkHolder playerChunk = chunkMap.getUpdatingChunkIfPresent(i);
|
||||
+ if (!hasPlayer && playerChunk != null && playerChunk.isFullChunkReady()) {
|
||||
+ Ticket<Long> delayUnload = new Ticket<Long>(TicketType.DELAY_UNLOAD, 33, i);
|
||||
+ delayUnload.delayUnloadBy = delayChunkUnloadsBy;
|
||||
+ delayUnload.setCreatedTick(this.ticketTickCounter);
|
||||
+ arraysetsorted.remove(delayUnload);
|
||||
+ // refresh ticket
|
||||
+ arraysetsorted.add(delayUnload);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
if (arraysetsorted.isEmpty()) {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/Ticket.java b/src/main/java/net/minecraft/server/level/Ticket.java
|
||||
index ffc43e5d3d0563c9e9c171064511b2c65ddf67e1..f1128f0d4a9a0241ac6c9bc18dd13b431c616bb1 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/Ticket.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/Ticket.java
|
||||
@@ -7,11 +7,13 @@ public final class Ticket<T> implements Comparable<Ticket<?>> {
|
||||
private final int ticketLevel;
|
||||
public final T key;
|
||||
public long createdTick;
|
||||
+ public long delayUnloadBy; // Paper
|
||||
|
||||
protected Ticket(TicketType<T> type, int level, T argument) {
|
||||
this.type = type;
|
||||
this.ticketLevel = level;
|
||||
this.key = argument;
|
||||
+ this.delayUnloadBy = type.timeout; // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,7 +62,7 @@ public final class Ticket<T> implements Comparable<Ticket<?>> {
|
||||
}
|
||||
|
||||
protected boolean timedOut(long currentTick) {
|
||||
- long l = this.type.timeout();
|
||||
+ long l = delayUnloadBy; // Paper
|
||||
return l != 0L && currentTick - this.createdTick > l;
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/TicketType.java b/src/main/java/net/minecraft/server/level/TicketType.java
|
||||
index 0d536d72ac918fbd403397ff369d10143ee9c204..dfa08dbf025ed702a864280a540e0169b9f33cbd 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/TicketType.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/TicketType.java
|
||||
@@ -26,6 +26,7 @@ public class TicketType<T> {
|
||||
public static final TicketType<ChunkPos> UNKNOWN = TicketType.create("unknown", Comparator.comparingLong(ChunkPos::toLong), 1);
|
||||
public static final TicketType<Unit> PLUGIN = TicketType.create("plugin", (a, b) -> 0); // CraftBukkit
|
||||
public static final TicketType<org.bukkit.plugin.Plugin> PLUGIN_TICKET = TicketType.create("plugin_ticket", (plugin1, plugin2) -> plugin1.getClass().getName().compareTo(plugin2.getClass().getName())); // CraftBukkit
|
||||
+ public static final TicketType<Long> DELAY_UNLOAD = create("delay_unload", Long::compareTo, 300); // Paper
|
||||
|
||||
public static <T> TicketType<T> create(String name, Comparator<T> argumentComparator) {
|
||||
return new TicketType<>(name, argumentComparator, 0L);
|
@ -5,7 +5,7 @@ Subject: [PATCH] Allow for toggling of spawn chunks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 39d64f3aeb998df5452699e098148d86fdd48c98..46d4e56ff939034de79ce045e348753d181c7ce3 100644
|
||||
index c12e2ecaea13597f56254e3ab7fd83bff129ddd3..e4dfaec6a1efa7bb44c843a283dd3c3d3a4e199c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -253,6 +253,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
@ -6,10 +6,10 @@ Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index d53fb6bba90936c1182b0687d014964cef81694f..645eaf7e6717486b583c49724c5891d5c270c38f 100644
|
||||
index 317cd6f68c2368b2f70dfb809db3e418de040f05..4d7ea3b3b8fb00b2b02c79d90a067c2f32b46988 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1432,7 +1432,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1426,7 +1426,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
@ -19,7 +19,7 @@ index d53fb6bba90936c1182b0687d014964cef81694f..645eaf7e6717486b583c49724c5891d5
|
||||
|
||||
public SystemReport fillSystemReport(SystemReport details) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 37fefdf0d96cd2b6e23b6e69ee5a8db16f0e51da..fc22de3e1bb4e01fc2c43ffd9ecd0a8cd6d40ba5 100644
|
||||
index 6723b52fd9306b0f9e3f1d0eadcbfd76d383beee..92a4deb9202fd20143b8890e781b4116e3706dd8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -246,7 +246,7 @@ import org.yaml.snakeyaml.error.MarkedYAMLException;
|
||||
@ -63,10 +63,10 @@ index ef0bbec06981afa13384fb75067599eaa1a87e33..dbdb2a30c5dbe4f02bc1d1a8ce7294d2
|
||||
net.minecraft.server.Main.main(options);
|
||||
} catch (Throwable t) {
|
||||
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
index 581cde7a74e00bee1ce69086132d5f871d206399..f8018902365e9115ae0132885a2546d115b24c36 100644
|
||||
index f1194eb6fdfba60959e00080d0562f2820d13b27..11d7ede26b46d0bf9cced65e8c3bcc41c8b66dbf 100644
|
||||
--- a/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
@@ -19,7 +19,7 @@ public class WatchdogThread extends Thread
|
||||
@@ -19,7 +19,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
|
||||
|
||||
private WatchdogThread(long timeoutTime, boolean restart)
|
||||
{
|
||||
@ -75,7 +75,7 @@ index 581cde7a74e00bee1ce69086132d5f871d206399..f8018902365e9115ae0132885a2546d1
|
||||
this.timeoutTime = timeoutTime;
|
||||
this.restart = restart;
|
||||
}
|
||||
@@ -65,14 +65,14 @@ public class WatchdogThread extends Thread
|
||||
@@ -65,14 +65,14 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
|
||||
{
|
||||
Logger log = Bukkit.getServer().getLogger();
|
||||
log.log( Level.SEVERE, "------------------------------" );
|
||||
@ -93,12 +93,12 @@ index 581cde7a74e00bee1ce69086132d5f871d206399..f8018902365e9115ae0132885a2546d1
|
||||
//
|
||||
if ( net.minecraft.world.level.Level.lastPhysicsProblem != null )
|
||||
{
|
||||
@@ -82,7 +82,7 @@ public class WatchdogThread extends Thread
|
||||
@@ -82,7 +82,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
|
||||
}
|
||||
//
|
||||
log.log( Level.SEVERE, "------------------------------" );
|
||||
- log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Spigot!):" );
|
||||
+ log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); // Paper
|
||||
com.destroystokyo.paper.io.chunk.ChunkTaskManager.dumpAllChunkLoadInfo(); // Paper
|
||||
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.dumpAllChunkLoadInfo(isLongTimeout); // Paper // Paper - rewrite chunk system
|
||||
WatchdogThread.dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log );
|
||||
log.log( Level.SEVERE, "------------------------------" );
|
@ -201,7 +201,7 @@ index 0000000000000000000000000000000000000000..aac3f66cb23d260729c2a48d8710a9de
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index c905602d23cdf3af1de7ab4419f11856b07da2ba..d70d97c65d5bdb47a17a226d65bad8ba1421b11b 100644
|
||||
index fa1ab9974859c75075f3090e36e0de58dda3e8e6..4dc5a5888f0180e1490597e43956e8e80981f8b9 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -194,6 +194,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
@ -74,10 +74,10 @@ index ab22310d5ab4ad7014b88080cbd44a2881002b55..c5b9b19763fd944b4f31c6d3c9b71d37
|
||||
|
||||
public void clientTick(Level world, BlockPos pos) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java
|
||||
index 7c5918f84d2b8f9c778258b7e7d745105effb082..cfb286020b8ee87bad7edbda4cd0b999fb607a06 100644
|
||||
index f62e4e36dd26bde067e4787fd0da1440b15a57fa..be2ec73b5900354a9c340b0a03affd59dbf55377 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/EntityGetter.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/EntityGetter.java
|
||||
@@ -70,8 +70,8 @@ public interface EntityGetter {
|
||||
@@ -82,8 +82,8 @@ public interface EntityGetter {
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ index 7c5918f84d2b8f9c778258b7e7d745105effb082..cfb286020b8ee87bad7edbda4cd0b999
|
||||
double d = -1.0D;
|
||||
Player player = null;
|
||||
|
||||
@@ -99,6 +99,27 @@ public interface EntityGetter {
|
||||
@@ -111,6 +111,27 @@ public interface EntityGetter {
|
||||
return this.getNearestPlayer(x, y, z, maxDistance, predicate);
|
||||
}
|
||||
|
||||
@ -117,10 +117,10 @@ index 7c5918f84d2b8f9c778258b7e7d745105effb082..cfb286020b8ee87bad7edbda4cd0b999
|
||||
for(Player player : this.players()) {
|
||||
if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player)) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index d5e6123622f6bbc4c3b8b91be7f9ba8e5c1c22d8..213024c868e7e33cd1ecef4173449b02f5b9b425 100644
|
||||
index 6708c2c88251f4e5f623cd785c14b2d3ed2d3de0..182881c867e68e59e89f56f8dc66001b0d2b3add 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2009,8 +2009,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2084,8 +2084,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@Override
|
||||
public String getLocale() {
|
||||
return this.getHandle().locale;
|
@ -12,7 +12,7 @@ Previous implementation did not calculate TPS correctly.
|
||||
Switch to a realistic rolling average and factor in std deviation as an extra reporting variable
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 645eaf7e6717486b583c49724c5891d5c270c38f..48a393f66013bf210ddac1e95496e1ec3727f314 100644
|
||||
index 1d4b3f02ebf918bf669647635bf236ca6094c0c7..a7e58261bc54f1177045f094678e85d00b054435 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -270,7 +270,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@ -33,7 +33,7 @@ index 645eaf7e6717486b583c49724c5891d5c270c38f..48a393f66013bf210ddac1e95496e1ec
|
||||
public final double[] recentTps = new double[ 3 ];
|
||||
// Spigot end
|
||||
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations;
|
||||
@@ -964,6 +964,57 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -945,6 +945,57 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
{
|
||||
return ( avg * exp ) + ( tps * ( 1 - exp ) );
|
||||
}
|
||||
@ -90,8 +90,8 @@ index 645eaf7e6717486b583c49724c5891d5c270c38f..48a393f66013bf210ddac1e95496e1ec
|
||||
+ // Paper End
|
||||
// Spigot End
|
||||
|
||||
protected void runServer() {
|
||||
@@ -981,26 +1032,33 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public static volatile RuntimeException chunkSystemCrash; // Paper - rewrite chunk system
|
||||
@@ -964,7 +1015,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
// Spigot start
|
||||
Arrays.fill( recentTps, 20 );
|
||||
@ -99,17 +99,18 @@ index 645eaf7e6717486b583c49724c5891d5c270c38f..48a393f66013bf210ddac1e95496e1ec
|
||||
+ long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
|
||||
+ lastTick = start - TICK_TIME; // Paper
|
||||
while (this.running) {
|
||||
// Paper start - rewrite chunk system
|
||||
// guarantee that nothing can stop the server from halting if it can at least still tick
|
||||
@@ -972,7 +1024,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
throw this.chunkSystemCrash;
|
||||
}
|
||||
// Paper end - rewrite chunk system
|
||||
- long i = (curTime = Util.getMillis()) - this.nextTickTime;
|
||||
+ long i = ((curTime = System.nanoTime()) / (1000L * 1000L)) - this.nextTickTime; // Paper
|
||||
|
||||
if (i > 5000L && this.nextTickTime - this.lastOverloadWarning >= 30000L) { // CraftBukkit
|
||||
long j = i / 50L;
|
||||
|
||||
if (this.server.getWarnOnOverload()) // CraftBukkit
|
||||
- MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", i, j);
|
||||
+ MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", i, j);
|
||||
this.nextTickTime += j * 50L;
|
||||
this.lastOverloadWarning = this.nextTickTime;
|
||||
@@ -984,12 +1036,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
|
||||
++MinecraftServer.currentTickLong; // Paper
|
||||
@ -133,7 +134,7 @@ index 645eaf7e6717486b583c49724c5891d5c270c38f..48a393f66013bf210ddac1e95496e1ec
|
||||
tickSection = curTime;
|
||||
}
|
||||
// Spigot end
|
||||
@@ -1010,7 +1068,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -999,7 +1057,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.debugCommandProfiler = new MinecraftServer.TimeProfiler(Util.getNanos(), this.tickCount);
|
||||
}
|
||||
|
||||
@ -144,7 +145,7 @@ index 645eaf7e6717486b583c49724c5891d5c270c38f..48a393f66013bf210ddac1e95496e1ec
|
||||
this.startMetricsRecordingTick();
|
||||
this.profiler.push("tick");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index fc22de3e1bb4e01fc2c43ffd9ecd0a8cd6d40ba5..56efe95512c851b965f2295d5eac7bc0c67bdb1f 100644
|
||||
index 92a4deb9202fd20143b8890e781b4116e3706dd8..58f3ee6c47313b5c3b093a03b1b759e9fb0207ee 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2409,6 +2409,17 @@ public final class CraftServer implements Server {
|
@ -5,10 +5,10 @@ Subject: [PATCH] Only refresh abilities if needed
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 213024c868e7e33cd1ecef4173449b02f5b9b425..00df00676337435e6ec62a86dc03fecde30f9819 100644
|
||||
index 182881c867e68e59e89f56f8dc66001b0d2b3add..8e6e7c5960b9273e816d7275b8a3058024190f5a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1678,12 +1678,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -1753,12 +1753,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@Override
|
||||
public void setFlying(boolean value) {
|
@ -5,10 +5,10 @@ Subject: [PATCH] Entity Origin API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 2f7646e2bcc9622d8579eec25b56615da5a84d06..f5ded21e15ca425d23af90f0e339a961c5600504 100644
|
||||
index 7c709be5d43bcd45064c79e84d5b2fff0b3d0cfe..e5fcabaaf600eabab2192e12c3c0ecce3fbecf31 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2185,6 +2185,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -2235,6 +2235,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
|
||||
entity.valid = true; // CraftBukkit
|
||||
@ -25,7 +25,7 @@ index 2f7646e2bcc9622d8579eec25b56615da5a84d06..f5ded21e15ca425d23af90f0e339a961
|
||||
|
||||
public void onTrackingEnd(Entity entity) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 9878aded49d0049b066fa608c7eaf25a55fcf12e..385c81c9e0faf7a51d24b3542713e0d57e5398dd 100644
|
||||
index 1a2ee5824c6af6b548e7006d583b73f4eba0f64a..ab2671c21f2f44973fb2507b178ac8e1e03bc8dc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -304,7 +304,27 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@ -56,7 +56,7 @@ index 9878aded49d0049b066fa608c7eaf25a55fcf12e..385c81c9e0faf7a51d24b3542713e0d5
|
||||
public float getBukkitYaw() {
|
||||
return this.yRot;
|
||||
}
|
||||
@@ -1861,6 +1881,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1913,6 +1933,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
this.bukkitEntity.storeBukkitValues(nbt);
|
||||
}
|
||||
// CraftBukkit end
|
||||
@ -72,7 +72,7 @@ index 9878aded49d0049b066fa608c7eaf25a55fcf12e..385c81c9e0faf7a51d24b3542713e0d5
|
||||
return nbt;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -1987,6 +2016,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -2039,6 +2068,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Prevent tile entity and entity crashes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 46d4e56ff939034de79ce045e348753d181c7ce3..a73684fc706beca7342786e5d92d6cae750a891c 100644
|
||||
index e4dfaec6a1efa7bb44c843a283dd3c3d3a4e199c..4c4dff95b88c4f228c9e0eb51613ed1094bec8a5 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -698,11 +698,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -703,11 +703,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
try {
|
||||
tickConsumer.accept(entity);
|
||||
} catch (Throwable throwable) {
|
||||
@ -44,10 +44,10 @@ index be08224c8107aab3e9a3645a20977dd14bfff782..c518704386f14cd033307dd976455c35
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index 893051059df51133a127b0870e27ab67461052fa..51b53bbed1dbd344d8646d4827e44ee7215524a9 100644
|
||||
index 8b65e8361918b5e6fe936fec99ee63ff9eef66f0..a4594b6b28eab545694491bc547f05a971a6ffad 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -1051,11 +1051,11 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -1166,11 +1166,11 @@ public class LevelChunk extends ChunkAccess {
|
||||
|
||||
gameprofilerfiller.pop();
|
||||
} catch (Throwable throwable) {
|
@ -5,10 +5,10 @@ Subject: [PATCH] Configurable top of nether void damage
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 385c81c9e0faf7a51d24b3542713e0d57e5398dd..f9f0cb28811e3a14bf4b5005050920b4992f868b 100644
|
||||
index ab2671c21f2f44973fb2507b178ac8e1e03bc8dc..4b5ec8921a86adf919e87ec9d7b2e58705478022 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -653,7 +653,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -705,7 +705,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
|
||||
public void checkOutOfWorld() {
|
@ -5,7 +5,7 @@ Subject: [PATCH] Check online mode before converting and renaming player data
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
index 86fb11e9e197357871d603c4f8ce778660d507cf..0132eb685dbcf3d3402096bd34513e91d2b20abd 100644
|
||||
index bf4c895794c2bc2ad65faa128c6fa92cb0656841..6909b6be840e8d4feadcc8b0c5a44fc1b9c81a54 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
@@ -56,7 +56,7 @@ public class PlayerDataStorage {
|
@ -5,7 +5,7 @@ Subject: [PATCH] Always tick falling blocks
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
index 38cf408899cef72bc9d2888109a7ac7ce0aec638..07e5ece37af6b02210920ce6cc31738274d447a9 100644
|
||||
index d3639643cda7d8ccf3c1208502605120590a2d30..e2dfc4d9a16a738dd0fe91838603e1d4370afa56 100644
|
||||
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
@@ -89,6 +89,7 @@ public class ActivationRange
|
@ -5,10 +5,10 @@ Subject: [PATCH] Configurable end credits
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 4adf2d503015cac85b12fbaae833b33eeeb44403..13bb12a2d1260b1c20ce3c8755906c2227f29f86 100644
|
||||
index 5aad3da061d391d1003bdcca95dd4f7e5c0e5ea8..301f78d1f9a0eae05096de071bda7def3a45f648 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1004,6 +1004,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -989,6 +989,7 @@ public class ServerPlayer extends Player {
|
||||
this.unRide();
|
||||
this.getLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
if (!this.wonGame) {
|
@ -10,10 +10,10 @@ This patch adds a per-tick cache that is used for storing and retrieving
|
||||
an entity's exposure during an explosion.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 48a393f66013bf210ddac1e95496e1ec3727f314..a65d86f7b48bf1fbc2186804a8c05921363c7272 100644
|
||||
index f24b2ea3932c660710f5b38e50b45f40b18e98ea..c0b8daca75feec011423ba4b4ef5900558bc4d92 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1395,6 +1395,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1389,6 +1389,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
this.profiler.pop();
|
||||
this.profiler.pop();
|
||||
@ -120,7 +120,7 @@ index 292571fc9fa999d3b92e0fdd56d07ebfb4ae7402..db7a025cd064c898e33037133b65eecc
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index a73684fc706beca7342786e5d92d6cae750a891c..2c8ea4f494c25c107bb0b0b44d84be237f77c2c8 100644
|
||||
index 4c4dff95b88c4f228c9e0eb51613ed1094bec8a5..2439c5e1eae1582196b1d2103b1ebd22140f3fc1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -161,6 +161,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
@ -5,10 +5,10 @@ Subject: [PATCH] Disable thunder
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index f5ded21e15ca425d23af90f0e339a961c5600504..e44b2662da3af5967801a21aaee0b30ef939e2ac 100644
|
||||
index c58a204d9959b0836c3d9e5025b7c63d8cf0549c..fa2b27a3876af959868fab9a1852302a87f43380 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -659,7 +659,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -692,7 +692,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
gameprofilerfiller.push("thunder");
|
||||
BlockPos blockposition;
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Disable ice and snow
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index e44b2662da3af5967801a21aaee0b30ef939e2ac..3a41a346e886918160eccaee57118747e33f6cc1 100644
|
||||
index fa2b27a3876af959868fab9a1852302a87f43380..e235531d694e3e904042f2d42641c1ffbecfd5a3 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -683,7 +683,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -716,7 +716,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
}
|
||||
|
||||
gameprofilerfiller.popPush("iceandsnow");
|
@ -5,10 +5,10 @@ Subject: [PATCH] Implement PlayerLocaleChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 13bb12a2d1260b1c20ce3c8755906c2227f29f86..db7e2207612b56b0869a947edd03a6d3f9209e22 100644
|
||||
index 301f78d1f9a0eae05096de071bda7def3a45f648..54f585f12890c665a097845acfe13108691f12b6 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1770,7 +1770,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -1755,7 +1755,7 @@ public class ServerPlayer extends Player {
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ index 13bb12a2d1260b1c20ce3c8755906c2227f29f86..db7e2207612b56b0869a947edd03a6d3
|
||||
public java.util.Locale adventure$locale = java.util.Locale.US; // Paper
|
||||
public void updateOptions(ServerboundClientInformationPacket packet) {
|
||||
// CraftBukkit start
|
||||
@@ -1778,9 +1778,10 @@ public class ServerPlayer extends Player {
|
||||
@@ -1763,9 +1763,10 @@ public class ServerPlayer extends Player {
|
||||
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT);
|
||||
this.server.server.getPluginManager().callEvent(event);
|
||||
}
|
||||
@ -30,10 +30,10 @@ index 13bb12a2d1260b1c20ce3c8755906c2227f29f86..db7e2207612b56b0869a947edd03a6d3
|
||||
this.locale = packet.language;
|
||||
// Paper start
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 00df00676337435e6ec62a86dc03fecde30f9819..9d2506a042b49089094be79b5d0ed54f088b9625 100644
|
||||
index 8e6e7c5960b9273e816d7275b8a3058024190f5a..3be63b51511fd12f295e1f07549f281246ee2dc0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2009,8 +2009,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2084,8 +2084,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@Override
|
||||
public String getLocale() {
|
@ -5,10 +5,10 @@ Subject: [PATCH] Configurable container update tick rate
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 981e60c7bf2eee52e84f9894ff689631388a7715..4d8dfe375f5b3b9e5cfc12a6af0b87ae78f9b764 100644
|
||||
index 54f585f12890c665a097845acfe13108691f12b6..2ffce1200abe7ab7b50a187069e63392c0b3bfdd 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -229,6 +229,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -228,6 +228,7 @@ public class ServerPlayer extends Player {
|
||||
private int containerCounter;
|
||||
public int latency;
|
||||
public boolean wonGame;
|
||||
@ -16,7 +16,7 @@ index 981e60c7bf2eee52e84f9894ff689631388a7715..4d8dfe375f5b3b9e5cfc12a6af0b87ae
|
||||
|
||||
// CraftBukkit start
|
||||
public String displayName;
|
||||
@@ -616,7 +617,12 @@ public class ServerPlayer extends Player {
|
||||
@@ -601,7 +602,12 @@ public class ServerPlayer extends Player {
|
||||
--this.invulnerableTime;
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Disable spigot tick limiters
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 2c8ea4f494c25c107bb0b0b44d84be237f77c2c8..7b3a81876f04c6aff370ac9cc97b0c9270f34a2e 100644
|
||||
index 2439c5e1eae1582196b1d2103b1ebd22140f3fc1..1473664f94f228abd81b8c654d105b8a76cc49e9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -664,9 +664,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -669,9 +669,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
// Spigot start
|
||||
// Iterator iterator = this.blockEntityTickers.iterator();
|
||||
int tilesThisCycle = 0;
|
@ -9,7 +9,7 @@ This is a duplicate API from spigot, so use our duplicate subclass and
|
||||
improve setPosition to use raw
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 8e0f73dcef189442450b4518437fb3a1c34b9a47..c003a1e8b4c2b2331abc4536352abdec20fef42e 100644
|
||||
index 3235d6f98794709a53208e20ef33f2164725be48..dfb53366a0b36b6a4cc43c66837f98fc372c6d2e 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -223,7 +223,7 @@ public abstract class PlayerList {
|
@ -74,7 +74,7 @@ index 22c095539425a6667b8e7f5c5f0a8ff2e87adfb5..e21a6961bab606036440f2a6bd90998b
|
||||
if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
|
||||
this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 56efe95512c851b965f2295d5eac7bc0c67bdb1f..1c6577bbbc005131661cbb4667cff6494b8fe5e4 100644
|
||||
index 58f3ee6c47313b5c3b093a03b1b759e9fb0207ee..524338428265f27aa33774a23b53c24212d98ae2 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -863,6 +863,28 @@ public final class CraftServer implements Server {
|
||||
@ -107,10 +107,10 @@ index 56efe95512c851b965f2295d5eac7bc0c67bdb1f..1c6577bbbc005131661cbb4667cff649
|
||||
return true;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index f2ada37115392466edbed8a2d331084aaaf7b774..2811d631dfd0f4013579734486c3ebbca4cfaad2 100644
|
||||
index 3be63b51511fd12f295e1f07549f281246ee2dc0..94ec829c549dac568a94c3262d9de026ff9d9a39 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -467,7 +467,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -502,7 +502,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
public void chat(String msg) {
|
||||
if (this.getHandle().connection == null) return;
|
||||
|
||||
@ -144,7 +144,7 @@ index 19c44daaa407b7c1c7a7ffe56fef8c8814c6d5b2..6a073a9dc44d93eba296a0e18a9c7be8
|
||||
} finally {
|
||||
try {
|
||||
diff --git a/src/main/java/org/spigotmc/AsyncCatcher.java b/src/main/java/org/spigotmc/AsyncCatcher.java
|
||||
index 78669fa035b7537ff7e533cf32aaf2995625424f..7585a30e8f063ac2656b5de519b1e9edaceffbc7 100644
|
||||
index 05e94702e42b8f5c35d2a112c486d57948a3acba..5409f230fdd53b70fc03c58177438534731ad4e6 100644
|
||||
--- a/src/main/java/org/spigotmc/AsyncCatcher.java
|
||||
+++ b/src/main/java/org/spigotmc/AsyncCatcher.java
|
||||
@@ -6,6 +6,7 @@ public class AsyncCatcher
|
@ -18,10 +18,10 @@ index a62f88048d8243f5b98834988c049471114c4199..7b95d18fb5edbd1575f6be92bfcbb3e0
|
||||
if (random.nextInt(10) == 0 && flag && pos.getY() < 40) {
|
||||
return checkMobSpawnRules(type, world, spawnReason, pos, random);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
index 6d44634ae6dcbc392011f248f6ab429b9845af55..bda9c6720fe0a91a4c6763795e4d6e01e6dd2747 100644
|
||||
index 29465d24b6c9160fcd6293006dcc26bcfbeb5e10..fd50cc4cfc976a9dee82d4f6ad457bba18065614 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
@@ -220,7 +220,7 @@ public class CraftChunk implements Chunk {
|
||||
@@ -176,7 +176,7 @@ public class CraftChunk implements Chunk {
|
||||
@Override
|
||||
public boolean isSlimeChunk() {
|
||||
// 987234911L is deterimined in EntitySlime when seeing if a slime can spawn in a chunk
|
@ -5,7 +5,7 @@ Subject: [PATCH] Expose server CommandMap
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 1c6577bbbc005131661cbb4667cff6494b8fe5e4..fd3ccc1726cd73e9f5be3f936115e2431c77183c 100644
|
||||
index 524338428265f27aa33774a23b53c24212d98ae2..458c9ce406421f77c9a196f9081f2f36e7e675ea 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1983,6 +1983,7 @@ public final class CraftServer implements Server {
|
@ -63,7 +63,7 @@ index bd808eb312ade7122973a47f4b96505829511da5..bf0f9cab7c66c089f35b851e799ba4a4
|
||||
// Paper end
|
||||
buf.writeComponent(this.text);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 2811d631dfd0f4013579734486c3ebbca4cfaad2..59a9168a1158d47eaa6bca223318db8c543023a0 100644
|
||||
index 94ec829c549dac568a94c3262d9de026ff9d9a39..6f5248febd3f84f2f5bc83806cbb9953600b71b6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1,5 +1,6 @@
|
||||
@ -73,7 +73,7 @@ index 2811d631dfd0f4013579734486c3ebbca4cfaad2..59a9168a1158d47eaa6bca223318db8c
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.io.BaseEncoding;
|
||||
@@ -273,6 +274,100 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -348,6 +349,100 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add configurable portal search radius
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index f9f0cb28811e3a14bf4b5005050920b4992f868b..4b5babb9fa755ba2897fc633c8eba30cfd220ea0 100644
|
||||
index 4b5ec8921a86adf919e87ec9d7b2e58705478022..71d539341c2ae8c64befc54ef974daa06a859fa5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2951,7 +2951,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -3003,7 +3003,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
double d0 = DimensionType.getTeleportationScale(this.level.dimensionType(), destination.dimensionType());
|
||||
BlockPos blockposition = worldborder.clampToBounds(this.getX() * d0, this.getY(), this.getZ() * d0);
|
||||
// CraftBukkit start
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add velocity warnings
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index fd3ccc1726cd73e9f5be3f936115e2431c77183c..c1c86dc95d610bb391191317fa0c0e4c8e41d198 100644
|
||||
index 458c9ce406421f77c9a196f9081f2f36e7e675ea..b8763c6f938319d4712222ecab3ebc132071597b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -280,6 +280,7 @@ public final class CraftServer implements Server {
|
||||
@ -62,10 +62,10 @@ index ddd0fde5c9065cc35b3bcf81defb119f5b0608d6..b9599f4f431098d63be98b5175890371
|
||||
public double getHeight() {
|
||||
return this.getHandle().getBbHeight();
|
||||
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
index f8018902365e9115ae0132885a2546d115b24c36..600c012b2bf119ddd6760b0401a2c6a22453609e 100644
|
||||
index 11d7ede26b46d0bf9cced65e8c3bcc41c8b66dbf..3ad14bf0697e682a2e777baa8faeb323d127fb13 100644
|
||||
--- a/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
@@ -80,7 +80,19 @@ public class WatchdogThread extends Thread
|
||||
@@ -80,7 +80,19 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
|
||||
log.log( Level.SEVERE, "During the run of the server, a physics stackoverflow was supressed" );
|
||||
log.log( Level.SEVERE, "near " + net.minecraft.world.level.Level.lastPhysicsProblem );
|
||||
}
|
||||
@ -85,4 +85,4 @@ index f8018902365e9115ae0132885a2546d115b24c36..600c012b2bf119ddd6760b0401a2c6a2
|
||||
+ // Paper end
|
||||
log.log( Level.SEVERE, "------------------------------" );
|
||||
log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); // Paper
|
||||
com.destroystokyo.paper.io.chunk.ChunkTaskManager.dumpAllChunkLoadInfo(); // Paper
|
||||
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.dumpAllChunkLoadInfo(isLongTimeout); // Paper // Paper - rewrite chunk system
|
@ -16,10 +16,10 @@ The wanted destination was on top of the emerald block however the player ended
|
||||
This only is the case if the player is teleporting between worlds.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 59a9168a1158d47eaa6bca223318db8c543023a0..5bc128440e2f12e2c635db70280c46dbb5f3f3c0 100644
|
||||
index 6f5248febd3f84f2f5bc83806cbb9953600b71b6..342cd3c6ffdcf46f0329e072fae446c5e9665e33 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1094,7 +1094,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -1129,7 +1129,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
if (fromWorld == toWorld) {
|
||||
entity.connection.teleport(to);
|
||||
} else {
|
@ -48,18 +48,6 @@ index 0000000000000000000000000000000000000000..f699ce18ca044f813e194ef2786b7ea8
|
||||
+ return internalTask;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 46bfaf04867d913c1782d851de101d913376c63a..4af8cee31d20e5dcec510439795e7e90fc668128 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1187,6 +1187,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
return true;
|
||||
} catch (Exception exception) {
|
||||
ChunkMap.LOGGER.error("Failed to save chunk {},{}", new Object[]{chunkcoordintpair.x, chunkcoordintpair.z, exception});
|
||||
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper
|
||||
return false;
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
|
||||
index 439ff01be1521c283d60cacb110fcb4993933057..da98f074ccd5a40c635824112c97fd174c393cb1 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java
|
||||
@ -100,7 +88,7 @@ index c6fb4c33d7ea52b88d8fc0d90748cbab7387c565..fed09b886f4fa0006d160e5f2abb00df
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 7b3a81876f04c6aff370ac9cc97b0c9270f34a2e..ee71a6cc552bd2bb82beda1bd44905ea4cc14604 100644
|
||||
index 1473664f94f228abd81b8c654d105b8a76cc49e9..65fd3a3c1f0a55d034e6f91c4f222e6454e7166c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -1,5 +1,10 @@
|
||||
@ -114,7 +102,7 @@ index 7b3a81876f04c6aff370ac9cc97b0c9270f34a2e..ee71a6cc552bd2bb82beda1bd44905ea
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.serialization.Codec;
|
||||
import java.io.IOException;
|
||||
@@ -700,6 +705,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -705,6 +710,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
// Paper start - Prevent tile entity and entity crashes
|
||||
final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level.getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
|
||||
MinecraftServer.LOGGER.error(msg, throwable);
|
||||
@ -143,7 +131,7 @@ index b37e04a0c466dacf52e74a4d4fb0885511c2abc1..878fc7f57178bff0e42fd01434f0aaa2
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index 51b53bbed1dbd344d8646d4827e44ee7215524a9..a4e121365717036dfc27eec86549d6dbac1ffc1a 100644
|
||||
index a4594b6b28eab545694491bc547f05a971a6ffad..20c9eada6f051ecdd5e45e625d7e6289d406a2f8 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -1,6 +1,7 @@
|
||||
@ -154,7 +142,7 @@ index 51b53bbed1dbd344d8646d4827e44ee7215524a9..a4e121365717036dfc27eec86549d6db
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.UnmodifiableIterator;
|
||||
import com.mojang.logging.LogUtils;
|
||||
@@ -559,10 +560,16 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -605,10 +606,16 @@ public class LevelChunk extends ChunkAccess {
|
||||
|
||||
// CraftBukkit start
|
||||
} else {
|
||||
@ -175,7 +163,7 @@ index 51b53bbed1dbd344d8646d4827e44ee7215524a9..a4e121365717036dfc27eec86549d6db
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
@@ -1054,6 +1061,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -1169,6 +1176,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
// Paper start - Prevent tile entity and entity crashes
|
||||
final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
|
||||
net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable);
|
@ -11,10 +11,10 @@ So avoid looking up scoreboards and short circuit to the "not on a team"
|
||||
logic which is most likely to be true.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 4b5babb9fa755ba2897fc633c8eba30cfd220ea0..6e8811a6a4b41d38c99ac40a2d4f0bef4713b762 100644
|
||||
index 71d539341c2ae8c64befc54ef974daa06a859fa5..e28ccb5651a793775166d51859620882ee54b641 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2589,6 +2589,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -2641,6 +2641,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
||||
@Nullable
|
||||
public Team getTeam() {
|
@ -19,18 +19,18 @@ index 8adebb8408cc22ae7e9e89721645e5dd27a41cd8..038e2177182c94baa4af24f9111cf155
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||
index 6fa0bc18ab05b9fb05521f46c5dadb695f1ec05b..4210c43104de01200b149e13ffab09dea37c5caf 100644
|
||||
index 45cec71b3b2f9444d7be7e5bf9fab166b28ea34d..ece0fd4b51d124be232e24d08f115b9267cb21cb 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||
@@ -163,6 +163,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
protected void write(ChunkPos pos, @Nullable CompoundTag nbt) throws IOException {
|
||||
RegionFile regionfile = this.getRegionFile(pos, false, true); // CraftBukkit // Paper
|
||||
@@ -167,6 +167,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
}
|
||||
// Paper end - rewrite chunk system
|
||||
try { // Paper
|
||||
+ int attempts = 0; Exception laste = null; while (attempts++ < 5) { try { // Paper
|
||||
|
||||
if (nbt == null) {
|
||||
regionfile.clear(pos);
|
||||
@@ -187,7 +188,18 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -191,7 +192,18 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
dataoutputstream.close();
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@ index e21a6961bab606036440f2a6bd90998b4129ae10..9f0a5b950a022aa2a3d3d60837fdb902
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 5bc128440e2f12e2c635db70280c46dbb5f3f3c0..3846905bafd92918349793d346aca5b3a3529e9b 100644
|
||||
index 342cd3c6ffdcf46f0329e072fae446c5e9665e33..307c76b2d06b748304d28d6634e86bb91f3ded67 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -150,6 +150,7 @@ import org.bukkit.plugin.Plugin;
|
||||
@ -45,7 +45,7 @@ index 5bc128440e2f12e2c635db70280c46dbb5f3f3c0..3846905bafd92918349793d346aca5b3
|
||||
|
||||
public CraftPlayer(CraftServer server, ServerPlayer entity) {
|
||||
super(server, entity);
|
||||
@@ -2171,6 +2176,45 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2206,6 +2211,45 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
public boolean getAffectsSpawning() {
|
||||
return this.getHandle().affectsSpawning;
|
||||
}
|
@ -16,7 +16,7 @@ modify that. Under the previous logic, plugins were unable (cleanly) override pe
|
||||
A config option has been added for those who depend on the previous behavior, but I don't expect that.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index c1c86dc95d610bb391191317fa0c0e4c8e41d198..2df58a9f40843abca02125d5f094129a8a75caf5 100644
|
||||
index b8763c6f938319d4712222ecab3ebc132071597b..4d9a5297e53b1836e3ba438bae6b869f3822dd28 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -462,6 +462,7 @@ public final class CraftServer implements Server {
|
@ -6,7 +6,7 @@ Subject: [PATCH] Allow Reloading of Custom Permissions
|
||||
https://github.com/PaperMC/Paper/issues/49
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 2df58a9f40843abca02125d5f094129a8a75caf5..d4016a8890fff0805bacab3e5a556e7316c9ab25 100644
|
||||
index 4d9a5297e53b1836e3ba438bae6b869f3822dd28..25373b05ab63e71294382c4b2a5b2658f98710a0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2537,5 +2537,23 @@ public final class CraftServer implements Server {
|
@ -7,7 +7,7 @@ Metadata is not meant to persist reload as things break badly with non primitive
|
||||
This will remove metadata on reload so it does not crash everything if a plugin uses it.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index d4016a8890fff0805bacab3e5a556e7316c9ab25..9a3b5b491256537d54c5fd0ac1646b3eb726187d 100644
|
||||
index 25373b05ab63e71294382c4b2a5b2658f98710a0..943971ce16c0c39085f029ab5b57685dda1c6b0f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -950,8 +950,16 @@ public final class CraftServer implements Server {
|
@ -6,7 +6,7 @@ Subject: [PATCH] Add World Util Methods
|
||||
Methods that can be used for other patches to help improve logic.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 3a41a346e886918160eccaee57118747e33f6cc1..7e663cb0a214d59baaa6d3da75a8e2fca05cc56d 100644
|
||||
index e235531d694e3e904042f2d42641c1ffbecfd5a3..d935fbdbee8b20f0efa09438b7d4c4a0da93abcc 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -216,7 +216,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@ -19,7 +19,7 @@ index 3a41a346e886918160eccaee57118747e33f6cc1..7e663cb0a214d59baaa6d3da75a8e2fc
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index ee71a6cc552bd2bb82beda1bd44905ea4cc14604..e89410b00c8f9ef94cd2baf621802fa847bd6456 100644
|
||||
index 65fd3a3c1f0a55d034e6f91c4f222e6454e7166c..62c54a0c789ca460ec29b0c653f5abd113736fb9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -333,6 +333,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
@ -44,10 +44,10 @@ index 5678461976a07f9afecccb1d34ea3eec24fba80e..8dc6fbbdfaecf0eb38a876d87d77f111
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 3846905bafd92918349793d346aca5b3a3529e9b..72b1429c4976b8db13d2185486c240b2fadb4ea9 100644
|
||||
index 307c76b2d06b748304d28d6634e86bb91f3ded67..4b7e5996b8b49d96f14cbd0d2167a0a09b47f4ec 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1976,6 +1976,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2011,6 +2011,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
|
||||
public void setRealHealth(double health) {
|
@ -6,7 +6,7 @@ Subject: [PATCH] Use a Shared Random for Entities
|
||||
Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 6e8811a6a4b41d38c99ac40a2d4f0bef4713b762..a9fb70e4d37162332b4b5c428ee6907a7d8c21db 100644
|
||||
index e28ccb5651a793775166d51859620882ee54b641..233c8950816521be5a9d099c29c99d0a421d30e4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -159,6 +159,79 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@ -89,7 +89,7 @@ index 6e8811a6a4b41d38c99ac40a2d4f0bef4713b762..a9fb70e4d37162332b4b5c428ee6907a
|
||||
private CraftEntity bukkitEntity;
|
||||
|
||||
public CraftEntity getBukkitEntity() {
|
||||
@@ -346,7 +419,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -398,7 +471,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
this.bb = Entity.INITIAL_AABB;
|
||||
this.stuckSpeedMultiplier = Vec3.ZERO;
|
||||
this.nextStep = 1.0F;
|
@ -5,10 +5,10 @@ Subject: [PATCH] Configurable spawn chances for skeleton horses
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 7e663cb0a214d59baaa6d3da75a8e2fca05cc56d..44600f8915f04f0baf3f877dff43d23e1b8ad93a 100644
|
||||
index d935fbdbee8b20f0efa09438b7d4c4a0da93abcc..0116fcc8de2b6bd1783db56f1062c9b590a65c34 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -663,7 +663,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -696,7 +696,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
blockposition = this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15));
|
||||
if (this.isRainingAt(blockposition)) {
|
||||
DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition);
|
@ -29,7 +29,7 @@ index 4587a3668b6be9222cdd74a38229f89f611d1af6..9f32861d791f7e4cb39d2ad01f48e191
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index e89410b00c8f9ef94cd2baf621802fa847bd6456..d3277e8aa7244ab490a6b354d863d4a9f3c60fec 100644
|
||||
index 62c54a0c789ca460ec29b0c653f5abd113736fb9..d612b59e04fcd01a8e2c4c7f43d8735fc208b520 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -276,7 +276,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@ -42,10 +42,10 @@ index e89410b00c8f9ef94cd2baf621802fa847bd6456..d3277e8aa7244ab490a6b354d863d4a9
|
||||
|
||||
public static boolean isInSpawnableBounds(BlockPos pos) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
||||
index fabc7df600c89b01d97a76eb0b1206a32407b906..6cec5cda20531aadf8e2148908a70f8b573d7d82 100644
|
||||
index 0e787d877901dfcea714b0e14e9fc4358ee30bbe..41e61e6c128f22224665af3f07cd11d69a43062b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
||||
@@ -119,6 +119,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
|
||||
@@ -160,6 +160,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
|
||||
return GameEventDispatcher.NOOP;
|
||||
}
|
||||
|
||||
@ -54,12 +54,12 @@ index fabc7df600c89b01d97a76eb0b1206a32407b906..6cec5cda20531aadf8e2148908a70f8b
|
||||
public abstract BlockState setBlockState(BlockPos pos, BlockState state, boolean moved);
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java
|
||||
index 80e383e9a2d12f9f1b0b0d9ae71a0add9b51c9d4..a9c65c8d36e5c7080133706df1363b3ce52e3370 100644
|
||||
index a78bf00d4559dd99869d93ec78b3525d24331925..b7856c420f346ac4923afa66a9f8276490f27e82 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java
|
||||
@@ -21,6 +21,12 @@ public class EmptyLevelChunk extends LevelChunk {
|
||||
this.biome = holder;
|
||||
}
|
||||
@@ -55,6 +55,12 @@ public class EmptyLevelChunk extends LevelChunk {
|
||||
public void setBlockEmptinessMap(final boolean[] emptinessMap) {}
|
||||
// Paper end - starlight
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
@ -71,10 +71,10 @@ index 80e383e9a2d12f9f1b0b0d9ae71a0add9b51c9d4..a9c65c8d36e5c7080133706df1363b3c
|
||||
public BlockState getBlockState(BlockPos pos) {
|
||||
return Blocks.VOID_AIR.defaultBlockState();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
|
||||
index 3dff0f7c3ccd04a67b2153e402d801de2341e520..7b320357973202423c29743d922b72dc4ec11efe 100644
|
||||
index ac5dff35e2df23b8790bbe65c40acc6a3c77e6ac..8ffc206a858864d277ff94de7c66ffdb07d8f491 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
|
||||
@@ -47,6 +47,12 @@ public class ImposterProtoChunk extends ProtoChunk {
|
||||
@@ -89,6 +89,12 @@ public class ImposterProtoChunk extends ProtoChunk {
|
||||
public BlockState getBlockState(BlockPos pos) {
|
||||
return this.wrapped.getBlockState(pos);
|
||||
}
|
||||
@ -88,10 +88,10 @@ index 3dff0f7c3ccd04a67b2153e402d801de2341e520..7b320357973202423c29743d922b72dc
|
||||
@Override
|
||||
public FluidState getFluidState(BlockPos pos) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index a4e121365717036dfc27eec86549d6dbac1ffc1a..4c4f44457d2066ea37cf48e37a282d8896649bc5 100644
|
||||
index 20c9eada6f051ecdd5e45e625d7e6289d406a2f8..5244a0a85d80963493d9106dd2674b1701c1919c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -296,12 +296,29 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -342,12 +342,29 @@ public class LevelChunk extends ChunkAccess {
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,10 +138,10 @@ index dddae1e226d8f58cdcfc597e25d4228cd3245cb4..ae37e97e52557b48f129cc02eeea3953
|
||||
private short tickingFluidCount;
|
||||
public final PalettedContainer<BlockState> states;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
|
||||
index 603111a52346f678aba0fd66b010d8f3026fce40..9014331e4ceac9f77a911aead87bf452d29e3fb4 100644
|
||||
index 040c6092ceed4c693a7a056c0d1a49d3d2242b19..13b62e8e6569c154547bc0d5626488c5b0839f20 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
|
||||
@@ -88,14 +88,18 @@ public class ProtoChunk extends ChunkAccess {
|
||||
@@ -94,14 +94,18 @@ public class ProtoChunk extends ChunkAccess {
|
||||
|
||||
@Override
|
||||
public BlockState getBlockState(BlockPos pos) {
|
@ -6,10 +6,10 @@ Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener
|
||||
Saves on some object allocation and processing when no plugin listens to this
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index a65d86f7b48bf1fbc2186804a8c05921363c7272..4fc75c6086c7f41414b73b901c7a90f06267a089 100644
|
||||
index c0b8daca75feec011423ba4b4ef5900558bc4d92..7dce9f0355c74828f40b07276c34e352132a2549 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1356,6 +1356,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1350,6 +1350,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
ServerLevel worldserver = (ServerLevel) iterator.next();
|
||||
@ -18,7 +18,7 @@ index a65d86f7b48bf1fbc2186804a8c05921363c7272..4fc75c6086c7f41414b73b901c7a90f0
|
||||
this.profiler.push(() -> {
|
||||
return worldserver + " " + worldserver.dimension().location();
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 44600f8915f04f0baf3f877dff43d23e1b8ad93a..79c22c0eb5adf6e08f7978272b8482fe53c4a45a 100644
|
||||
index 51603dcbe81301557757152404c33fc91e21dc1a..81d24e082ad8be36db40c0ab62db3386401aa821 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -215,6 +215,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@ -30,10 +30,10 @@ index 44600f8915f04f0baf3f877dff43d23e1b8ad93a..79c22c0eb5adf6e08f7978272b8482fe
|
||||
@Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
|
||||
return this.chunkSource.getChunk(x, z, false);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index d3277e8aa7244ab490a6b354d863d4a9f3c60fec..8359cc9cde98ffe11f2d9ede4350a404bc5086be 100644
|
||||
index d612b59e04fcd01a8e2c4c7f43d8735fc208b520..39b2071a6fc6510929416ccbdf2022cf471ab26c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -488,7 +488,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -493,7 +493,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
// CraftBukkit start
|
||||
iblockdata1.updateIndirectNeighbourShapes(this, blockposition, k, j - 1); // Don't call an event for the old block to limit event spam
|
||||
CraftWorld world = ((ServerLevel) this).getWorld();
|
@ -5,10 +5,10 @@ Subject: [PATCH] Entity AddTo/RemoveFrom World Events
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 79c22c0eb5adf6e08f7978272b8482fe53c4a45a..14f55837c8614633b9a6edf7d35af465fbf8aa17 100644
|
||||
index 81d24e082ad8be36db40c0ab62db3386401aa821..6ec90ab4ff94c103682df9b66917e897cf420f33 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2195,6 +2195,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -2245,6 +2245,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
entity.setOrigin(entity.getOriginVector().toLocation(getWorld()));
|
||||
}
|
||||
// Paper end
|
||||
@ -16,7 +16,7 @@ index 79c22c0eb5adf6e08f7978272b8482fe53c4a45a..14f55837c8614633b9a6edf7d35af465
|
||||
}
|
||||
|
||||
public void onTrackingEnd(Entity entity) {
|
||||
@@ -2270,6 +2271,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -2320,6 +2321,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
@ -11,10 +11,10 @@ For people who want all chunks to be treated equally, you can chose a fixed valu
|
||||
This allows to fine-tune vanilla gameplay.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index 4c4f44457d2066ea37cf48e37a282d8896649bc5..e63086aba2512051fe1321f6e7e72b40276f5dde 100644
|
||||
index 5244a0a85d80963493d9106dd2674b1701c1919c..5cd8755dc8db2f1fdb32d2db3a5a137ca7cad3c7 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -281,6 +281,13 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -327,6 +327,13 @@ public class LevelChunk extends ChunkAccess {
|
||||
return new ChunkAccess.TicksToSave(this.blockTicks, this.fluidTicks);
|
||||
}
|
||||
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren