Even more cleanup of mcutil patch

This commit is contained in:
Nassim Jahnke 2024-07-18 16:50:16 +02:00
parent 3c8a7fe1a4
commit a8db527449
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
59 changed files with 282 additions and 1154 deletions

File diff suppressed because it is too large Load Diff

View File

@ -28,10 +28,10 @@ index 0a05e753ff5e7b1d741c7719524715d7364cac4f..d82d1e90cbda544b3d20edcc13d1cb95
runtimeOnly(log4jPlugins.output)
alsoShade(log4jPlugins.output)
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index fbbc08c5a189b99f8047e0f0f5cd31101149dbec..b717c9d8b6edc2cafc9281140913b7bdb6108cf0 100644
index e42677a14ec8e1a42747603fb4112822e326fb70..744edd40128c910c3ad2f3657bde995612e0a1e4 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -288,7 +288,7 @@ public class SpigotConfig
@@ -284,7 +284,7 @@ public class SpigotConfig
private static void playerSample()
{
SpigotConfig.playerSample = SpigotConfig.getInt( "settings.sample-count", 12 );

View File

@ -7328,28 +7328,11 @@ index 29f94e574e39714caec95af5c176c9dba481728e..b532c72ec2c048554e496b4b63afa0e9
this.loadPlugins();
this.enablePlugins(PluginLoadOrder.STARTUP);
this.enablePlugins(PluginLoadOrder.POSTWORLD);
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java b/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java
index 909b2c98e7a9117d2f737245e4661792ffafb744..d96399e9bf1a58db5a4a22e58abb99e7660e0694 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java
@@ -42,6 +42,12 @@ public class MinecraftInternalPlugin extends PluginBase {
public PluginDescriptionFile getDescription() {
return pdf;
}
+ // Paper start
+ @Override
+ public io.papermc.paper.plugin.configuration.PluginMeta getPluginMeta() {
+ return pdf;
+ }
+ // Paper end
@Override
public FileConfiguration getConfig() {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 1bf1f10f8691922a69cd13c6a4e643b863801b4f..e8205646dbe7088e6bdece2567151bd7f64f36cb 100644
index 5a89b9ca6a62f0bfb5fe01ed4097870788cf5d83..a6de88625aeb2c5ababd476e804e9b45b1185efe 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -412,6 +412,16 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -395,6 +395,16 @@ public final class CraftMagicNumbers implements UnsafeValues {
net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
return nmsItemStack.getItem().getDescriptionId(nmsItemStack);
}

View File

@ -710,10 +710,10 @@ index 421ddf6ca955215dff77655a7eda62eb9d90aa92..1cef3614e81e751c98b504c26da4718d
String className;
boolean isInterface;
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index e8205646dbe7088e6bdece2567151bd7f64f36cb..10b5fcf6575255000e52166eb73b60f6a3f88e84 100644
index a6de88625aeb2c5ababd476e804e9b45b1185efe..7fdc5f5b8ce2401ac480dd5691d99b2d297c6168 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -357,7 +357,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -340,7 +340,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
throw new InvalidPluginException("Plugin API version " + pdf.getAPIVersion() + " is lower than the minimum allowed version. Please update or replace it.");
}
@ -722,7 +722,7 @@ index e8205646dbe7088e6bdece2567151bd7f64f36cb..10b5fcf6575255000e52166eb73b60f6
CraftLegacy.init();
}
@@ -372,6 +372,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -355,6 +355,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@Override
public byte[] processClass(PluginDescriptionFile pdf, String path, byte[] clazz) {

View File

@ -1823,7 +1823,7 @@ index 807184636a99c17fe6ed8dd1cd07e1872d613657..68b9b4aba7dba31e4526165e6efb8c40
public Player.Spigot spigot()
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 0f7c3a44acf3c59ae43605e573f9da7f7c594647..a3ccc2da0927cc49e5fcfbd863e648ad0f25cc0d 100644
index c017ce2ca1bc535795c958a2e509af2adf88efa9..6c0debe3f3b693ed90dd2a39f481cccd8e4f7634 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -1,5 +1,6 @@
@ -1833,17 +1833,7 @@ index 0f7c3a44acf3c59ae43605e573f9da7f7c594647..a3ccc2da0927cc49e5fcfbd863e648ad
import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.util.ArrayList;
@@ -196,7 +197,8 @@ public class CraftScheduler implements BukkitScheduler {
}
public BukkitTask scheduleInternalTask(Runnable run, int delay, String taskName) {
- final CraftTask task = new CraftTask(run, nextId(), taskName);
+ final CraftTask task = new CraftTask(run, nextId(), "Internal - " + (taskName != null ? taskName : "Unknown"));
+ task.internal = true;
return handle(task, delay);
}
@@ -277,7 +279,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -271,7 +272,7 @@ public class CraftScheduler implements BukkitScheduler {
}
return false;
}
@ -1852,7 +1842,7 @@ index 0f7c3a44acf3c59ae43605e573f9da7f7c594647..a3ccc2da0927cc49e5fcfbd863e648ad
this.handle(task, 0L);
for (CraftTask taskPending = this.head.getNext(); taskPending != null; taskPending = taskPending.getNext()) {
if (taskPending == task) {
@@ -312,7 +314,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -306,7 +307,7 @@ public class CraftScheduler implements BukkitScheduler {
}
}
}
@ -1861,7 +1851,7 @@ index 0f7c3a44acf3c59ae43605e573f9da7f7c594647..a3ccc2da0927cc49e5fcfbd863e648ad
this.handle(task, 0L);
for (CraftTask taskPending = this.head.getNext(); taskPending != null; taskPending = taskPending.getNext()) {
if (taskPending == task) {
@@ -419,9 +421,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -413,9 +414,7 @@ public class CraftScheduler implements BukkitScheduler {
if (task.isSync()) {
this.currentTask = task;
try {
@ -1869,9 +1859,9 @@ index 0f7c3a44acf3c59ae43605e573f9da7f7c594647..a3ccc2da0927cc49e5fcfbd863e648ad
task.run();
- task.timings.stopTiming(); // Spigot
} catch (final Throwable throwable) {
// Paper start
String msg = String.format(
@@ -455,8 +455,10 @@ public class CraftScheduler implements BukkitScheduler {
task.getOwner().getLogger().log(
Level.WARNING,
@@ -442,8 +441,10 @@ public class CraftScheduler implements BukkitScheduler {
this.runners.remove(task.getTaskId());
}
}
@ -1882,7 +1872,7 @@ index 0f7c3a44acf3c59ae43605e573f9da7f7c594647..a3ccc2da0927cc49e5fcfbd863e648ad
this.debugHead = this.debugHead.getNextHead(currentTick);
}
@@ -493,6 +495,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -480,6 +481,7 @@ public class CraftScheduler implements BukkitScheduler {
}
private void parsePending() {
@ -1890,7 +1880,7 @@ index 0f7c3a44acf3c59ae43605e573f9da7f7c594647..a3ccc2da0927cc49e5fcfbd863e648ad
CraftTask head = this.head;
CraftTask task = head.getNext();
CraftTask lastTask = head;
@@ -511,6 +514,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -498,6 +500,7 @@ public class CraftScheduler implements BukkitScheduler {
task.setNext(null);
}
this.head = lastTask;
@ -1899,7 +1889,7 @@ index 0f7c3a44acf3c59ae43605e573f9da7f7c594647..a3ccc2da0927cc49e5fcfbd863e648ad
private boolean isReady(final int currentTick) {
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
index d56abf283f38548faa790c57045033f7ade6f958..ea26d9464644b5217879b8c21b4da28e57708dcb 100644
index e4d1eb4a0ce2c9874922585f6bb0d9ead433fde1..ba369f3dcfdf498e971dc4405d39657a9b6e97cc 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
@@ -1,12 +1,15 @@
@ -1936,16 +1926,7 @@ index d56abf283f38548faa790c57045033f7ade6f958..ea26d9464644b5217879b8c21b4da28e
CraftTask() {
this(null, null, CraftTask.NO_REPEATING, CraftTask.NO_REPEATING);
}
@@ -52,7 +55,7 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
this.id = id;
this.period = CraftTask.NO_REPEATING;
this.taskName = taskName;
- this.timings = null; // Will be changed in later patch
+ this.timings = MinecraftTimings.getInternalTaskName(taskName);
}
// Paper end
@@ -73,7 +76,7 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
@@ -58,7 +61,7 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
}
this.id = id;
this.period = period;
@ -1954,7 +1935,7 @@ index d56abf283f38548faa790c57045033f7ade6f958..ea26d9464644b5217879b8c21b4da28e
}
@Override
@@ -93,11 +96,13 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
@@ -78,11 +81,13 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
@Override
public void run() {
@ -1968,7 +1949,7 @@ index d56abf283f38548faa790c57045033f7ade6f958..ea26d9464644b5217879b8c21b4da28e
}
long getCreatedAt() {
@@ -128,7 +133,7 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
@@ -113,7 +118,7 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
this.next = next;
}
@ -1977,7 +1958,7 @@ index d56abf283f38548faa790c57045033f7ade6f958..ea26d9464644b5217879b8c21b4da28e
return (this.rTask != null) ? this.rTask.getClass() : ((this.cTask != null) ? this.cTask.getClass() : null);
}
@@ -152,9 +157,4 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
@@ -137,9 +142,4 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
return true;
}
@ -2004,12 +1985,12 @@ index f97eccb6a17c7876e1e002d798eb67bbe80571a0..76effc345d362047e64d064eb64a5222
+ } // Paper
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 10b5fcf6575255000e52166eb73b60f6a3f88e84..a356d4d19e4b7a3d08c80a137609d1ed9db7c1b1 100644
index 7fdc5f5b8ce2401ac480dd5691d99b2d297c6168..3a0c10d2d3dfbd04be421225f639cbd31aa93e70 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -213,6 +213,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -196,6 +196,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
return CraftNamespacedKey.toMinecraft(mat.getKey());
}
// Paper end
// ========================================================================
+ // Paper start
+ @Override
@ -2020,7 +2001,7 @@ index 10b5fcf6575255000e52166eb73b60f6a3f88e84..a356d4d19e4b7a3d08c80a137609d1ed
public static byte toLegacyData(BlockState data) {
return CraftLegacy.toLegacyData(data);
@@ -453,6 +459,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -436,6 +442,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
public DamageSource.Builder createDamageSourceBuilder(DamageType damageType) {
return new CraftDamageSourceBuilder(damageType);
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Allow nerfed mobs to jump
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index fcc8b66702f761c443fb647a8ab6e1ab49e5acfe..bf905bc1c4918412e3c324a62d2915b57c40d2cc 100644
index 930b5002aa6eaa1137314f7b38fad99778b6edaa..0593d828c911c94c9833bf12b9c294e5dac1f4e8 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -124,6 +124,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@ -16,7 +16,7 @@ index fcc8b66702f761c443fb647a8ab6e1ab49e5acfe..bf905bc1c4918412e3c324a62d2915b5
public GoalSelector targetSelector;
@Nullable
private LivingEntity target;
@@ -890,7 +891,15 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@@ -888,7 +889,15 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@Override
protected final void serverAiStep() {
++this.noActionTime;

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add configurable entity despawn distances
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index bf905bc1c4918412e3c324a62d2915b57c40d2cc..51b33ea29af0f4010dfb8a1a7503cb7ca463209e 100644
index 0593d828c911c94c9833bf12b9c294e5dac1f4e8..5fd0e3d27f3c86f1ff767b45dfa6138c30f13e3e 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -866,14 +866,14 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@@ -864,14 +864,14 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
if (entityhuman != null) {
double d0 = entityhuman.distanceToSqr((Entity) this);

View File

@ -638,10 +638,10 @@ index 1c8049bbc08be77673d375205bd42a346ff951b8..e37a7aceae6c69083ecf81af4f750c01
net.minecraft.server.Main.main(options);
} catch (Throwable t) {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index a356d4d19e4b7a3d08c80a137609d1ed9db7c1b1..e85faddc157869824e30426a7ca2c577552aea9c 100644
index 3a0c10d2d3dfbd04be421225f639cbd31aa93e70..7af1d4685dcf1e73c5972cb25ded219e713b1f0a 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -464,6 +464,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -447,6 +447,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public String getTimingsServerName() {
return io.papermc.paper.configuration.GlobalConfiguration.get().timings.serverName;
}

View File

@ -21,10 +21,10 @@ index 3126e8cab3c40e3af47f4c8925e1c6a9523309ba..3207166061bf9c4d7bf3f38e5a9f7aff
public static Predicate<Entity> withinDistance(double x, double y, double z, double max) {
double d4 = max * max;
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 51b33ea29af0f4010dfb8a1a7503cb7ca463209e..e81a25462239dbb3993f31ff927bd809aef0a124 100644
index 5fd0e3d27f3c86f1ff767b45dfa6138c30f13e3e..a753fd0434f611d8c77270012e383e3210f1194b 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -862,7 +862,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@@ -860,7 +860,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
if (this.level().getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
} else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) {
@ -135,7 +135,7 @@ index f38f62e777d88a783e1e3b7e1a48da921cc67cf4..77ae7882a08441d9a80b50492be5e484
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 eb633256f353ddaee5098d11f0e5f50d7e5a26cd..4cc6b3162cea049134f194ed84a7552830cb85af 100644
index 68b9b4aba7dba31e4526165e6efb8c40f9e841bc..1b2ead250233d9f228bfe8e79f988026506895f9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2425,6 +2425,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@ -91,7 +91,7 @@ index 8183c26b4a5ad169a53702b8c45fd05cda934e80..36dec6cd78a0990ba3c09a4a748c259e
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 68436413645e0e33f22cdee0ea101ca01b343d75..4f5ff6849e0ea7a4f2491e0dbede7699554239dc 100644
index b4293991dddc9039c26106ac8c047e5aeec35a56..32b42d25631aecdd31db4954a8bbf38bcda98d6b 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -733,6 +733,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -171,19 +171,32 @@ index 15f273aa592828719de6e092d79a407dc8652dfe..b24e8255ab18eb5b2e4968aa62aa3d72
try {
filechannel.close();
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index a3ccc2da0927cc49e5fcfbd863e648ad0f25cc0d..dc7872afbdd06eb976bee6aee56a40b44084c24a 100644
index 6c0debe3f3b693ed90dd2a39f481cccd8e4f7634..cf9f04e005940f5dd7baf50435f3703fa7c2d4f0 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -436,6 +436,8 @@ public class CraftScheduler implements BukkitScheduler {
msg,
@@ -416,20 +416,25 @@ public class CraftScheduler implements BukkitScheduler {
try {
task.run();
} catch (final Throwable throwable) {
+ // Paper start
+ final String logMessage = String.format(
+ "Task #%s for %s generated an exception",
+ task.getTaskId(),
+ task.getOwner().getDescription().getFullName());
task.getOwner().getLogger().log(
Level.WARNING,
- String.format(
- "Task #%s for %s generated an exception",
- task.getTaskId(),
- task.getOwner().getDescription().getFullName()),
+ logMessage,
throwable);
}
+ org.bukkit.Bukkit.getServer().getPluginManager().callEvent(
+ new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerSchedulerException(msg, throwable, task)));
// Paper end
+ new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerSchedulerException(logMessage, throwable, task)));
+ // Paper end
} finally {
this.currentTask = null;
@@ -443,7 +445,7 @@ public class CraftScheduler implements BukkitScheduler {
}
this.parsePending();
} else {
this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass()));

View File

@ -9,10 +9,10 @@ One report of a suspected memory leak with the system.
This adds additional overhead to asynchronous task dispatching
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index dc7872afbdd06eb976bee6aee56a40b44084c24a..af3997e47aff9c43dc5019f1b0267effe1df5205 100644
index cf9f04e005940f5dd7baf50435f3703fa7c2d4f0..f1145585eed18be0aa5c795a50589103fdc9cc2f 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -444,7 +444,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -433,7 +433,7 @@ public class CraftScheduler implements BukkitScheduler {
}
this.parsePending();
} else {
@ -21,7 +21,7 @@ index dc7872afbdd06eb976bee6aee56a40b44084c24a..af3997e47aff9c43dc5019f1b0267eff
this.executor.execute(new com.destroystokyo.paper.ServerSchedulerReportingWrapper(task)); // Paper
// We don't need to parse pending
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
@@ -461,7 +461,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -450,7 +450,7 @@ public class CraftScheduler implements BukkitScheduler {
this.pending.addAll(temp);
temp.clear();
MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming(); // Paper
@ -30,7 +30,7 @@ index dc7872afbdd06eb976bee6aee56a40b44084c24a..af3997e47aff9c43dc5019f1b0267eff
}
private void addTask(final CraftTask task) {
@@ -525,10 +525,15 @@ public class CraftScheduler implements BukkitScheduler {
@@ -514,10 +514,15 @@ public class CraftScheduler implements BukkitScheduler {
@Override
public String toString() {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Item#canEntityPickup
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index e81a25462239dbb3993f31ff927bd809aef0a124..25fd665f3b02edfcc9fc7092b93296a7c6e43338 100644
index a753fd0434f611d8c77270012e383e3210f1194b..55aecada617bd84676928a7818f1511b2d85e7bf 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -675,6 +675,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@@ -673,6 +673,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
ItemEntity entityitem = (ItemEntity) iterator.next();
if (!entityitem.isRemoved() && !entityitem.getItem().isEmpty() && !entityitem.hasPickUpDelay() && this.wantsToPickUp(entityitem.getItem())) {

View File

@ -558,37 +558,6 @@ index 0000000000000000000000000000000000000000..7ac27392a8647ef7d0dc78efe78703e9
+
+ @NotNull GameProfile buildGameProfile();
+}
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
index c6c723d9378c593c8608d5940f63c98dff097cd0..02d6c98b7a2212b13ffd9859ebfdc0a8357ebe65 100644
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
@@ -1,5 +1,7 @@
package io.papermc.paper.util;
+import com.destroystokyo.paper.profile.CraftPlayerProfile;
+import com.destroystokyo.paper.profile.PlayerProfile;
import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import io.papermc.paper.math.BlockPosition;
@@ -18,6 +20,7 @@ import net.minecraft.world.level.ClipContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.apache.commons.lang.exception.ExceptionUtils;
+import com.mojang.authlib.GameProfile;
import org.bukkit.Location;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.CraftWorld;
@@ -363,6 +366,10 @@ public final class MCUtil {
return run.get();
}
+ public static PlayerProfile toBukkit(GameProfile profile) {
+ return CraftPlayerProfile.asBukkitMirror(profile);
+ }
+
/**
* Calculates distance between 2 entities
* @param e1
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 6afede80c10503a261d0f735c351d943597be9ff..993296f9c2457809bd6b844c309895f417eb42a5 100644
--- a/src/main/java/net/minecraft/server/Main.java

View File

@ -5,7 +5,7 @@ Subject: [PATCH] ProfileWhitelistVerifyEvent
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index d5f17d7e3b56ca87ec9070b69265ce098de61f69..fec45c058695e68a907684880c87ccf11827565d 100644
index d5f17d7e3b56ca87ec9070b69265ce098de61f69..768a5c6ebc4466aae4108a79e1564b2bfc93463a 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -624,9 +624,9 @@ public abstract class PlayerList {
@ -21,7 +21,7 @@ index d5f17d7e3b56ca87ec9070b69265ce098de61f69..fec45c058695e68a907684880c87ccf1
} else if (this.getIpBans().isBanned(socketaddress) && !this.getIpBans().get(socketaddress).hasExpired()) {
IpBanListEntry ipbanentry = this.ipBans.get(socketaddress);
@@ -993,7 +993,23 @@ public abstract class PlayerList {
@@ -993,7 +993,24 @@ public abstract class PlayerList {
}
public boolean isWhiteListed(GameProfile profile) {
@ -33,7 +33,8 @@ index d5f17d7e3b56ca87ec9070b69265ce098de61f69..fec45c058695e68a907684880c87ccf1
+ boolean isOp = this.ops.contains(gameprofile);
+ boolean isWhitelisted = !this.doWhiteList || isOp || this.whitelist.contains(gameprofile);
+ final com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent event;
+ event = new com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent(io.papermc.paper.util.MCUtil.toBukkit(gameprofile), this.doWhiteList, isWhitelisted, isOp, org.spigotmc.SpigotConfig.whitelistMessage);
+
+ event = new com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent(com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitMirror(gameprofile), this.doWhiteList, isWhitelisted, isOp, org.spigotmc.SpigotConfig.whitelistMessage);
+ event.callEvent();
+ if (!event.isWhitelisted()) {
+ if (loginEvent != null) {

View File

@ -208,10 +208,10 @@ index f08700abb005f487aca95c0457c09cefa9a81be2..532f09089b8d6798999cf3f83e852df7
}
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index ba621fdc82896245f6ce448e084847edc4d3fe08..d063d356388810fb6f0dddfbc8b5885b3e6442aa 100644
index d9e73e37b54e2f6e13313977c76cb4212c240992..b97ff4a9b69699577bf8cde0869b70353101ef46 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -289,7 +289,7 @@ public class SpigotConfig
@@ -285,7 +285,7 @@ public class SpigotConfig
public static int playerSample;
private static void playerSample()
{

View File

@ -159,10 +159,10 @@ index 0000000000000000000000000000000000000000..3c1992e212a6d6f1db4d5b807b38d719
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30bfe61bd0 100644
index f1145585eed18be0aa5c795a50589103fdc9cc2f..02835e4f0a0b262af27acff0939c981cae728db4 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -77,7 +77,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -76,7 +76,7 @@ public class CraftScheduler implements BukkitScheduler {
/**
* Main thread logic only
*/
@ -171,7 +171,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30
new Comparator<CraftTask>() {
@Override
public int compare(final CraftTask o1, final CraftTask o2) {
@@ -94,12 +94,13 @@ public class CraftScheduler implements BukkitScheduler {
@@ -93,12 +93,13 @@ public class CraftScheduler implements BukkitScheduler {
/**
* These are tasks that are currently active. It's provided for 'viewing' the current state.
*/
@ -187,7 +187,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30
private final Executor executor = Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("Craft Scheduler Thread - %d").build());
private CraftAsyncDebugger debugHead = new CraftAsyncDebugger(-1, null, null) {
@Override
@@ -108,12 +109,31 @@ public class CraftScheduler implements BukkitScheduler {
@@ -107,12 +108,31 @@ public class CraftScheduler implements BukkitScheduler {
}
};
private CraftAsyncDebugger debugTail = this.debugHead;
@ -219,7 +219,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30
@Override
public int scheduleSyncDelayedTask(final Plugin plugin, final Runnable task) {
return this.scheduleSyncDelayedTask(plugin, task, 0L);
@@ -236,7 +256,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -229,7 +249,7 @@ public class CraftScheduler implements BukkitScheduler {
} else if (period < CraftTask.NO_REPEATING) {
period = CraftTask.NO_REPEATING;
}
@ -228,7 +228,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30
}
@Override
@@ -252,6 +272,11 @@ public class CraftScheduler implements BukkitScheduler {
@@ -245,6 +265,11 @@ public class CraftScheduler implements BukkitScheduler {
if (taskId <= 0) {
return;
}
@ -240,7 +240,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30
CraftTask task = this.runners.get(taskId);
if (task != null) {
task.cancel0();
@@ -294,6 +319,11 @@ public class CraftScheduler implements BukkitScheduler {
@@ -287,6 +312,11 @@ public class CraftScheduler implements BukkitScheduler {
@Override
public void cancelTasks(final Plugin plugin) {
Preconditions.checkArgument(plugin != null, "Cannot cancel tasks of null plugin");
@ -252,7 +252,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30
final CraftTask task = new CraftTask(
new Runnable() {
@Override
@@ -333,6 +363,13 @@ public class CraftScheduler implements BukkitScheduler {
@@ -326,6 +356,13 @@ public class CraftScheduler implements BukkitScheduler {
@Override
public boolean isCurrentlyRunning(final int taskId) {
@ -266,7 +266,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30
final CraftTask task = this.runners.get(taskId);
if (task == null) {
return false;
@@ -351,6 +388,11 @@ public class CraftScheduler implements BukkitScheduler {
@@ -344,6 +381,11 @@ public class CraftScheduler implements BukkitScheduler {
if (taskId <= 0) {
return false;
}
@ -278,7 +278,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30
for (CraftTask task = this.head.getNext(); task != null; task = task.getNext()) {
if (task.getTaskId() == taskId) {
return task.getPeriod() >= CraftTask.NO_REPEATING; // The task will run
@@ -362,6 +404,12 @@ public class CraftScheduler implements BukkitScheduler {
@@ -355,6 +397,12 @@ public class CraftScheduler implements BukkitScheduler {
@Override
public List<BukkitWorker> getActiveWorkers() {
@ -291,7 +291,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30
final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
for (final CraftTask taskObj : this.runners.values()) {
// Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
@@ -399,6 +447,11 @@ public class CraftScheduler implements BukkitScheduler {
@@ -392,6 +440,11 @@ public class CraftScheduler implements BukkitScheduler {
pending.add(task);
}
}
@ -303,7 +303,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30
return pending;
}
@@ -406,6 +459,11 @@ public class CraftScheduler implements BukkitScheduler {
@@ -399,6 +452,11 @@ public class CraftScheduler implements BukkitScheduler {
* This method is designed to never block or wait for locks; an immediate execution of all current tasks.
*/
public void mainThreadHeartbeat(final int currentTick) {
@ -315,7 +315,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30
this.currentTick = currentTick;
final List<CraftTask> temp = this.temp;
this.parsePending();
@@ -445,7 +503,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -434,7 +492,7 @@ public class CraftScheduler implements BukkitScheduler {
this.parsePending();
} else {
// this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
@ -324,7 +324,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30
// We don't need to parse pending
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
}
@@ -464,7 +522,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -453,7 +511,7 @@ public class CraftScheduler implements BukkitScheduler {
//this.debugHead = this.debugHead.getNextHead(currentTick); // Paper
}
@ -333,7 +333,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30
final AtomicReference<CraftTask> tail = this.tail;
CraftTask tailTask = tail.get();
while (!tail.compareAndSet(tailTask, task)) {
@@ -473,7 +531,13 @@ public class CraftScheduler implements BukkitScheduler {
@@ -462,7 +520,13 @@ public class CraftScheduler implements BukkitScheduler {
tailTask.setNext(task);
}
@ -348,7 +348,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30
task.setNextRun(this.currentTick + delay);
this.addTask(task);
return task;
@@ -496,8 +560,8 @@ public class CraftScheduler implements BukkitScheduler {
@@ -485,8 +549,8 @@ public class CraftScheduler implements BukkitScheduler {
return id;
}
@ -359,7 +359,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30
CraftTask head = this.head;
CraftTask task = head.getNext();
CraftTask lastTask = head;
@@ -516,7 +580,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -505,7 +569,7 @@ public class CraftScheduler implements BukkitScheduler {
task.setNext(null);
}
this.head = lastTask;

View File

@ -93,10 +93,10 @@ index cccc60602360f25f0aeddbd16dad2bb63a1728a8..bf1b8ee85551ff1989369268edf80127
}
}
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 25fd665f3b02edfcc9fc7092b93296a7c6e43338..b7c216b79684a4dbb93899fd2d3bc5a9e1b04f2e 100644
index 55aecada617bd84676928a7818f1511b2d85e7bf..f56d431207323a80b7f566ac6e30eebf232ee695 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1693,7 +1693,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@@ -1691,7 +1691,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
if (f1 > 0.0F && target instanceof LivingEntity) {
LivingEntity entityliving = (LivingEntity) target;

View File

@ -53,10 +53,10 @@ index 745970d9f07ed7ca98a653bfff1b861dc4aaa177..274d7d7f36ce2eb38d2f630ca48b6aa4
@Override
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index a31953bd4dd9408f83c2ee9816d051a4a842cf6d..df3eb02bc2b5b8fc20496823055c6adf4512b4f9 100644
index b97ff4a9b69699577bf8cde0869b70353101ef46..85f3433860abd91a89961907940a807a8b190a46 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -229,7 +229,7 @@ public class SpigotConfig
@@ -225,7 +225,7 @@ public class SpigotConfig
SpigotConfig.restartScript = SpigotConfig.getString( "settings.restart-script", SpigotConfig.restartScript );
SpigotConfig.restartMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.restart", "Server is restarting" ) );
SpigotConfig.commands.put( "restart", new RestartCommand( "restart" ) );

View File

@ -229,10 +229,10 @@ index f7a77b31dc196823510f96bd3b2344058e20feac..279fa00fd9043e1995f22c79f47d0b41
public int getExpReward(@Nullable Entity entity) { // CraftBukkit
Level world = this.level();
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index b7c216b79684a4dbb93899fd2d3bc5a9e1b04f2e..4b0e269f3580c1c6dac1e5f2dd3cdac1d8e1118a 100644
index f56d431207323a80b7f566ac6e30eebf232ee695..c2b10c3dba9d4d08e48f8e8836142b85f16b14cb 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1121,6 +1121,12 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@@ -1119,6 +1119,12 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
}
@ -245,7 +245,7 @@ index b7c216b79684a4dbb93899fd2d3bc5a9e1b04f2e..4b0e269f3580c1c6dac1e5f2dd3cdac1
@Override
protected void dropCustomDeathLoot(ServerLevel world, DamageSource source, boolean causedByPlayer) {
super.dropCustomDeathLoot(world, source, causedByPlayer);
@@ -1129,6 +1135,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@@ -1127,6 +1133,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
for (int j = 0; j < i; ++j) {
EquipmentSlot enumitemslot = aenumitemslot[j];
@ -253,7 +253,7 @@ index b7c216b79684a4dbb93899fd2d3bc5a9e1b04f2e..4b0e269f3580c1c6dac1e5f2dd3cdac1
ItemStack itemstack = this.getItemBySlot(enumitemslot);
float f = this.getEquipmentDropChance(enumitemslot);
@@ -1153,7 +1160,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@@ -1151,7 +1158,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
}
this.spawnAtLocation(itemstack);

View File

@ -12,7 +12,7 @@ public net.minecraft.world.level.pathfinder.Path nodes
diff --git a/src/main/java/com/destroystokyo/paper/entity/PaperPathfinder.java b/src/main/java/com/destroystokyo/paper/entity/PaperPathfinder.java
new file mode 100644
index 0000000000000000000000000000000000000000..3dbe4cf29a7984a1976a60bdeeb3ede02316a3cb
index 0000000000000000000000000000000000000000..946cbc955683e81933e0f3c0db5f8cc4ec437a76
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/PaperPathfinder.java
@@ -0,0 +1,148 @@
@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..3dbe4cf29a7984a1976a60bdeeb3ede0
+
+ @Override
+ public Mob getEntity() {
+ return entity.getBukkitMob();
+ return (Mob) entity.getBukkitEntity();
+ }
+
+ public void setHandle(net.minecraft.world.entity.Mob entity) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 9e8938627bfd1c45a2546e221f819e20c483a9e2..00c43d7b846e97e2cc2105c93be5ce918fafd775 100644
index cdd1d8222ad1796abd0858b9ed0e2ddc9be83c93..2f1d075b8dbcf173c51f3e6396ccbc61b64f75df 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1126,6 +1126,7 @@ public abstract class PlayerList {
@@ -1127,6 +1127,7 @@ public abstract class PlayerList {
}
public void setUsingWhiteList(boolean whitelistEnabled) {

View File

@ -14,10 +14,10 @@ chunks, however it must be enabled by setting the startup flag
diff --git a/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
new file mode 100644
index 0000000000000000000000000000000000000000..404a8fd128043527d23f22ee26f7c8c739f09089
index 0000000000000000000000000000000000000000..605a4a83d0a098a9977da00c710e798396dc5256
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
@@ -0,0 +1,175 @@
@@ -0,0 +1,177 @@
+package com.destroystokyo.paper.io;
+
+import com.google.gson.JsonArray;
@ -31,6 +31,7 @@ index 0000000000000000000000000000000000000000..404a8fd128043527d23f22ee26f7c8c7
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+import net.minecraft.world.level.ChunkPos;
+import net.minecraft.world.level.Level;
+
+public class SyncLoadFinder {
@ -69,7 +70,7 @@ index 0000000000000000000000000000000000000000..404a8fd128043527d23f22ee26f7c8c7
+
+ ++valueInMap.times;
+
+ valueInMap.coordinateTimes.compute(io.papermc.paper.util.MCUtil.getCoordinateKey(chunkX, chunkZ), (Long keyInMap1, Integer valueInMap1) -> {
+ valueInMap.coordinateTimes.compute(ChunkPos.asLong(chunkX, chunkZ), (Long keyInMap1, Integer valueInMap1) -> {
+ return valueInMap1 == null ? Integer.valueOf(1) : Integer.valueOf(valueInMap1.intValue() + 1);
+ });
+
@ -122,7 +123,8 @@ index 0000000000000000000000000000000000000000..404a8fd128043527d23f22ee26f7c8c7
+ for (Long2IntMap.Entry coordinate : pair.getSecond().coordinateTimes.long2IntEntrySet()) {
+ final long key = coordinate.getLongKey();
+ final int times = coordinate.getIntValue();
+ coordinates.add("(" + io.papermc.paper.util.MCUtil.getCoordinateX(key) + "," + io.papermc.paper.util.MCUtil.getCoordinateZ(key) + "): " + times);
+ final ChunkPos chunkPos = new ChunkPos(key);
+ coordinates.add("(" + chunkPos.x + "," + chunkPos.z + "): " + times);
+ }
+
+ stacktrace.add("coordinates", coordinates);

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Add Raw Byte ItemStack Serialization
Serializes using NBT which is safer for server data migrations than bukkits format.
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index e85faddc157869824e30426a7ca2c577552aea9c..03a72e19e060cdb0dd8fcf52742da27dcfcd1356 100644
index 7af1d4685dcf1e73c5972cb25ded219e713b1f0a..c1511a45a11df8a08f1d19d7fbd2a478e1a6f44f 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -469,6 +469,53 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -452,6 +452,53 @@ public final class CraftMagicNumbers implements UnsafeValues {
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
return new com.destroystokyo.paper.PaperVersionFetcher();
}

View File

@ -7,10 +7,10 @@ Subject: [PATCH] Don't crash if player is attempted to be removed from
I suspect it deals with teleporting as it uses players current x/y/z
diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java
index 27065ffc5473c518acee3a3096b83fac61eb7860..cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2 100644
index 3d46412b307f08968bb9b96c0649e0405813462e..56aa26bb8d0bfbd3c799163fa620259e6455c89b 100644
--- a/src/main/java/net/minecraft/server/level/DistanceManager.java
+++ b/src/main/java/net/minecraft/server/level/DistanceManager.java
@@ -272,8 +272,8 @@ public abstract class DistanceManager {
@@ -270,8 +270,8 @@ public abstract class DistanceManager {
ObjectSet<ServerPlayer> objectset = (ObjectSet) this.playersPerChunk.get(i);
if (objectset == null) return; // CraftBukkit - SPIGOT-6208

View File

@ -7,10 +7,10 @@ Subject: [PATCH] Fix CraftScheduler#runTaskTimerAsynchronously(Plugin,
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index c6ce8ed5fa73ee6221332083b3376b30bfe61bd0..71a147df3bcbd5bb82934da3e6e14326746cf2e3 100644
index 02835e4f0a0b262af27acff0939c981cae728db4..d7c2d8993a172e343669228cf24a58d8992a1c10 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -198,7 +198,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -197,7 +197,7 @@ public class CraftScheduler implements BukkitScheduler {
@Override
public void runTaskTimerAsynchronously(Plugin plugin, Consumer<? super BukkitTask> task, long delay, long period) throws IllegalArgumentException {

View File

@ -60,7 +60,7 @@ index ceaa2a7048afc4955d3695af5291e83a79d83c5d..5dad1aa26a8908cba6a08398a4bad27f
}
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 d02f7a547dbe8943f82c07103b1fff203e4533c2..335f43e49d31acecfec8b6da9be9afe88cd95ca9 100644
index 34f03184f018d00be7c5884f29f98a9ebe461475..6fe078fdf619c4df664f1dce6a0f5d202c21b35e 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
@@ -154,6 +154,12 @@ public abstract class BlockBehaviour implements FeatureElement {
@ -76,7 +76,7 @@ index d02f7a547dbe8943f82c07103b1fff203e4533c2..335f43e49d31acecfec8b6da9be9afe8
protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
org.spigotmc.AsyncCatcher.catchOp("block onPlace"); // Spigot
}
@@ -1086,6 +1092,12 @@ public abstract class BlockBehaviour implements FeatureElement {
@@ -1080,6 +1086,12 @@ public abstract class BlockBehaviour implements FeatureElement {
this.getBlock().updateIndirectNeighbourShapes(this.asState(), world, pos, flags, maxUpdateDepth);
}

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 335962dfe50d8d691a2a1fc6224950641e2b5a2b..203aacc9e116c1335bde1cff4d59674bfa7a622a 100644
index 08dd2b77df5162a3b4b6941663efaa1eb0e42746..f7cfce209dde71e61009f3678c667062475cf1d4 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4509,4 +4509,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@ -21,10 +21,10 @@ index 335962dfe50d8d691a2a1fc6224950641e2b5a2b..203aacc9e116c1335bde1cff4d59674b
+ // Paper end - Expose entity id counter
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 03a72e19e060cdb0dd8fcf52742da27dcfcd1356..94ec28a4f9d12873dff6700a12fb66e29820d3d9 100644
index c1511a45a11df8a08f1d19d7fbd2a478e1a6f44f..5e20397ea379ed0df274ab73e5f8500977e08322 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -516,6 +516,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -499,6 +499,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!");
return compound;
}

View File

@ -15,10 +15,10 @@ manually reload the advancement data for all players, which
normally takes place as a part of the datapack reloading.
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 94ec28a4f9d12873dff6700a12fb66e29820d3d9..7427a81a779b82f96d34a3de228c9d59ee77fea7 100644
index 5e20397ea379ed0df274ab73e5f8500977e08322..cf666e427d95b5fd9ce4db44e1b22e5e61ba7983 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -333,7 +333,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -316,7 +316,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
Bukkit.getLogger().log(Level.SEVERE, "Error saving advancement " + key, ex);
}

View File

@ -78,10 +78,10 @@ index 30d7dd9646ba9d6a9396dc140a61eb2cac07dfc6..674713a611e709542990f748027bdc5b
default void closeRangeLeashBehaviour(Entity entity) {}
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 4b0e269f3580c1c6dac1e5f2dd3cdac1d8e1118a..3988782c51b9d517ec003185c7b64605249206e2 100644
index c2b10c3dba9d4d08e48f8e8836142b85f16b14cb..37a8e426ca65587863bd22d2b7f32fae854c322e 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1619,8 +1619,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@@ -1617,8 +1617,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
boolean flag1 = super.startRiding(entity, force);
if (flag1 && this.isLeashed()) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add getMainThreadExecutor to BukkitScheduler
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 71a147df3bcbd5bb82934da3e6e14326746cf2e3..e85b9bb3f9c225d289a4959921970b9963881199 100644
index d7c2d8993a172e343669228cf24a58d8992a1c10..2f4d6b56301195f8d39ed50dffe842464065bfe1 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -653,4 +653,15 @@ public class CraftScheduler implements BukkitScheduler {
@@ -642,4 +642,15 @@ public class CraftScheduler implements BukkitScheduler {
public BukkitTask runTaskTimerAsynchronously(Plugin plugin, BukkitRunnable task, long delay, long period) throws IllegalArgumentException {
throw new UnsupportedOperationException("Use BukkitRunnable#runTaskTimerAsynchronously(Plugin, long, long)");
}

View File

@ -67,10 +67,10 @@ index a29f4992f7927d0f241962f972dd13ce77094d97..f83eb7fd5c9b368ba0bf9e07a568d69c
// Check if a World already exists with the UID.
if (this.getWorld(world.getUID()) != null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 7427a81a779b82f96d34a3de228c9d59ee77fea7..7e538a5e742914aa496d76ffe5b450397367cf40 100644
index cf666e427d95b5fd9ce4db44e1b22e5e61ba7983..a58fb15e6e7054ee99560790bab0757231337ed6 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -527,6 +527,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -510,6 +510,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public int nextEntityId() {
return net.minecraft.world.entity.Entity.nextEntityId();
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Expose protocol version
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 7e538a5e742914aa496d76ffe5b450397367cf40..86584a2308006a5b217841a97461707ce610d32f 100644
index a58fb15e6e7054ee99560790bab0757231337ed6..3f2222bfed1b852cd68b509d16d18cda9ed30237 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -532,6 +532,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -515,6 +515,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public String getMainLevelName() {
return ((net.minecraft.server.dedicated.DedicatedServer) net.minecraft.server.MinecraftServer.getServer()).getProperties().levelName;
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack repair check API
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 86584a2308006a5b217841a97461707ce610d32f..86308d3633e02a85ea2727805990451af53033c8 100644
index 3f2222bfed1b852cd68b509d16d18cda9ed30237..ee87e3d1233a9dc776d26ef535034a2c38eed958 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -537,6 +537,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -520,6 +520,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
public int getProtocolVersion() {
return net.minecraft.SharedConstants.getCurrentVersion().getProtocolVersion();
}

View File

@ -65,10 +65,10 @@ index 66d773cadb74f9176e6cf68a565568034f52ec63..a1f2b9d40d374e8cdbaf916b25fa74b6
return defaultAttributes.build();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 86308d3633e02a85ea2727805990451af53033c8..53cb6d7c2a734e46322b746f00c2bd0f09488126 100644
index ee87e3d1233a9dc776d26ef535034a2c38eed958..e7696331e51211a4e1de9b43e7e763047d805ca0 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -396,7 +396,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -379,7 +379,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@Override
public Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(Material material, EquipmentSlot slot) {

View File

@ -428,7 +428,7 @@ index ada5016ee354e799a8241a0706ea04e236efd1eb..70b215dfbe53bd475192ca1d021032c8
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 7ef760cb1c88f557947e9b88409a2935666f86f0..0474b88416e0d016da38909196d32fe992b37d00 100644
index 0cbd4e6bc9b3695fd2ff0b943a69b8fd393e0f36..46f46685081c3c164bd4ba306dfb1220a4e13e52 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -675,7 +675,7 @@ public abstract class PlayerList {
@ -440,7 +440,7 @@ index 7ef760cb1c88f557947e9b88409a2935666f86f0..0474b88416e0d016da38909196d32fe9
}
// Instead of kicking then returning, we need to store the kick reason
@@ -1272,7 +1272,7 @@ public abstract class PlayerList {
@@ -1273,7 +1273,7 @@ public abstract class PlayerList {
// Paper end
// CraftBukkit start - disconnect safely
for (ServerPlayer player : this.players) {
@ -480,7 +480,7 @@ index f472dea0bd4f834c0c8f0aa59ae7cdae082b14af..2fa51c3a70f43cd23b8f494fc643d66c
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 6aa9a31b2bba086265c0e83c4ea9181540a0a5f6..8f78f4879dfc46d2214243b927e0cff0257b7692 100644
index 3f603688b9ad895edc2bfc07093c42bc17a35b19..6bc3209b6039ed3d33131e1c6bc56a47916be3ee 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -635,7 +635,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@ -81,10 +81,10 @@ index 0000000000000000000000000000000000000000..ec9ebd2d539333293c51b7edfa18f18b
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 53cb6d7c2a734e46322b746f00c2bd0f09488126..1e78b966da6a3fa9410ebe52ae94db9b87659c72 100644
index e7696331e51211a4e1de9b43e7e763047d805ca0..64aa0228fb81e975755bf24d1a58306d5875f9c6 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -549,6 +549,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -532,6 +532,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
return CraftMagicNumbers.getItem(itemToBeRepaired.getType()).isValidRepairItem(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial));
}

View File

@ -7,7 +7,7 @@ Subject: [PATCH] Add Raw Byte Entity Serialization
public net.minecraft.world.entity.Entity setLevel(Lnet/minecraft/world/level/Level;)V
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 28c20c14fa36470a96fad88787fc01c77592d19f..13e1b47873f0a4a974bb0763679fee6e37932b5c 100644
index 0ab29f96a50ae490117cf83053bc3803870f794b..67c0dd9677dae97104830b816e5e0ca24e7db946 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2145,6 +2145,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@ -50,10 +50,10 @@ index 7310f53747e68b918f132ee0f0a142e36537902e..6f9286e65f7ac730b808ddf9b52c344f
@Override
public boolean isInvisible() { // Paper - moved up from LivingEntity
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 1e78b966da6a3fa9410ebe52ae94db9b87659c72..21461817aa27b5b7df8af186712a54b3c80ee576 100644
index 64aa0228fb81e975755bf24d1a58306d5875f9c6..7b111a801703dc846be82fad7b225dc1de36c7fd 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -499,7 +499,33 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -482,7 +482,33 @@ public final class CraftMagicNumbers implements UnsafeValues {
return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow());
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Don't log debug logging being disabled
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index df3eb02bc2b5b8fc20496823055c6adf4512b4f9..0507182aa6d47da9693363f6b0fadd40d06d66b4 100644
index 85f3433860abd91a89961907940a807a8b190a46..4dbb109d0526afee99b9190fc256585121aac9b5 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -385,7 +385,7 @@ public class SpigotConfig
@@ -381,7 +381,7 @@ public class SpigotConfig
Bukkit.getLogger().info( "Debug logging is enabled" );
} else
{

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable max block light for monster spawning
diff --git a/src/main/java/net/minecraft/world/entity/monster/Monster.java b/src/main/java/net/minecraft/world/entity/monster/Monster.java
index 4701bf9ee203f2f15b0b68e84bbfa2c489b66631..759839e912c54598b257ad738481364940f88a18 100644
index f73604d762efbac400d40f536ec1782fca584efa..e7bfce0534c7ef3a1480a1082ae8514caf78778b 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Monster.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Monster.java
@@ -92,7 +92,7 @@ public abstract class Monster extends PathfinderMob implements Enemy {
@@ -91,7 +91,7 @@ public abstract class Monster extends PathfinderMob implements Enemy {
return false;
} else {
DimensionType dimensionType = world.dimensionType();

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Use username instead of display name in
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index d21d9a66ab7197ea4fa324a9af64a1457d8e602b..d430e6c08bae0a630e71c11c9eae26bef85bde36 100644
index 2916328a5b94783e68688756b5ad7685f180e27f..b0a1f6cf2cc96a2ddc8232f929c134501d99411e 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1388,7 +1388,7 @@ public abstract class PlayerList {
@@ -1389,7 +1389,7 @@ public abstract class PlayerList {
// CraftBukkit start
public ServerStatsCounter getPlayerStats(ServerPlayer entityhuman) {
ServerStatsCounter serverstatisticmanager = entityhuman.getStats();

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Add NamespacedKey biome methods
Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com>
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 21461817aa27b5b7df8af186712a54b3c80ee576..2aa7aad2b4b7f2e7c81ccac28a1e6151055b0ba3 100644
index 7b111a801703dc846be82fad7b225dc1de36c7fd..ba82266c6f3e9e8f325b799171e8346a32033126 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -589,6 +589,21 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -572,6 +572,21 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Improve inlining for some hot BlockBehavior and FluidState
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 335f43e49d31acecfec8b6da9be9afe88cd95ca9..d261649aa1b7b351f325f9b752bb792f952f7b25 100644
index 6fe078fdf619c4df664f1dce6a0f5d202c21b35e..9d6cc0b8dbc451dfff1ddd8e7be32d11434cdb69 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
@@ -912,15 +912,15 @@ public abstract class BlockBehaviour implements FeatureElement {
@@ -906,15 +906,15 @@ public abstract class BlockBehaviour implements FeatureElement {
return this.shapeExceedsCube; // Paper - moved into shape cache init
}
@ -28,7 +28,7 @@ index 335f43e49d31acecfec8b6da9be9afe88cd95ca9..d261649aa1b7b351f325f9b752bb792f
return this.isAir;
}
@@ -1004,7 +1004,7 @@ public abstract class BlockBehaviour implements FeatureElement {
@@ -998,7 +998,7 @@ public abstract class BlockBehaviour implements FeatureElement {
}
}
@ -37,7 +37,7 @@ index 335f43e49d31acecfec8b6da9be9afe88cd95ca9..d261649aa1b7b351f325f9b752bb792f
return this.canOcclude;
}
@@ -1220,11 +1220,11 @@ public abstract class BlockBehaviour implements FeatureElement {
@@ -1214,11 +1214,11 @@ public abstract class BlockBehaviour implements FeatureElement {
return this.getBlock().builtInRegistryHolder().is(key);
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Fix SpawnEggMeta#get/setSpawnedType
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java
index ea9937ad27817112f71e8a0a816865961ce19a61..2c6ee95edea9dc959d8d31d689dc27fea4080467 100644
index ea9937ad27817112f71e8a0a816865961ce19a61..6c2c3b514be0dab47f3e44f65bdc6a3574e59b7c 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java
@@ -94,6 +94,30 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
@ -17,8 +17,8 @@ index ea9937ad27817112f71e8a0a816865961ce19a61..2c6ee95edea9dc959d8d31d689dc27fe
+ public EntityType getCustomSpawnedType() {
+ return java.util.Optional.ofNullable(this.entityTag)
+ .map(tag -> tag.getString(ENTITY_ID.NBT))
+ .flatMap(net.minecraft.world.entity.EntityType::byString)
+ .map(org.bukkit.craftbukkit.util.CraftMagicNumbers::getEntityType)
+ .map(net.minecraft.resources.ResourceLocation::tryParse)
+ .map(key -> key.getNamespace().equals("minecraft") ? EntityType.fromName(key.getPath()) : null)
+ .orElse(null);
+ }
+

View File

@ -5,10 +5,10 @@ Subject: [PATCH] API for updating recipes on clients
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index de96d7df65713f2fa7b8f2dd068856bb5fa45a45..be6bf7afa3cea4ed48f363e89ccd079062edc8d9 100644
index f9dcbf7d51680e8dfdda1350e0632dec675f3d44..1b83d8f723410c405746faa59783e6ba7a66fd56 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1484,6 +1484,13 @@ public abstract class PlayerList {
@@ -1485,6 +1485,13 @@ public abstract class PlayerList {
}
public void reloadResources() {
@ -22,7 +22,7 @@ index de96d7df65713f2fa7b8f2dd068856bb5fa45a45..be6bf7afa3cea4ed48f363e89ccd0790
// CraftBukkit start
/*Iterator iterator = this.advancements.values().iterator();
@@ -1499,7 +1506,15 @@ public abstract class PlayerList {
@@ -1500,7 +1507,15 @@ public abstract class PlayerList {
}
// CraftBukkit end

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix custom statistic criteria creation
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 2aa7aad2b4b7f2e7c81ccac28a1e6151055b0ba3..e74f4a16d3e1e7cf716b93057c8b42e8ed0f3503 100644
index ba82266c6f3e9e8f325b799171e8346a32033126..9b98070aa4998071b0821605f1f9bc1622716938 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -604,6 +604,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -587,6 +587,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end - namespaced key biome methods

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix silent equipment change for mobs
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 3988782c51b9d517ec003185c7b64605249206e2..56873752ae1ae0d2a36cb171d2de6884e15c01a5 100644
index 37a8e426ca65587863bd22d2b7f32fae854c322e..1a2efd8b77d65606994f13980ddbe018f90d0c35 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1104,19 +1104,26 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@@ -1102,19 +1102,26 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@Override
public void setItemSlot(EquipmentSlot slot, ItemStack stack) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix UnsafeValues#loadAdvancement
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index e74f4a16d3e1e7cf716b93057c8b42e8ed0f3503..278ef7b7cd2cf95dcf38fb4cadfd2acfcc9c4dc5 100644
index 9b98070aa4998071b0821605f1f9bc1622716938..c4d1cf7399a20c2067c51c81b5107a4841a35337 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -318,9 +318,30 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -301,9 +301,30 @@ public final class CraftMagicNumbers implements UnsafeValues {
ResourceLocation minecraftkey = CraftNamespacedKey.toMinecraft(key);
JsonElement jsonelement = ServerAdvancementManager.GSON.fromJson(advancement, JsonElement.class);

View File

@ -84,10 +84,10 @@ index ff16c7196b146388c526e3100e561be771ca8a91..cbf076c5fa69d32ad3c8ea759cd9d405
if (nbt.contains("Brain", 10)) {
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 56873752ae1ae0d2a36cb171d2de6884e15c01a5..5bac748649f43d74b13e7c0b4d355e67654ad59e 100644
index 1a2efd8b77d65606994f13980ddbe018f90d0c35..8b6eed30f84dc98878deaa805e7446ae4b168400 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -605,7 +605,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@@ -603,7 +603,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
this.leashData = this.readLeashData(nbt);
this.setLeftHanded(nbt.getBoolean("LeftHanded"));
if (nbt.contains("DeathLootTable", 8)) {

View File

@ -7,7 +7,7 @@ This causes spawnAfterBreak to spawn xp by default, removing the need to manuall
For classes that use custom xp amounts, they can drop the resources with disabling
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 8337f2f1d650fc7efb830a7034e3676dc0695ee4..2f1acea765d1b6726863cdc89707ca6148548493 100644
index 3f87e60c0d43703a8450b5920dac59a970809397..471fd54edf6aa962d997878ee638974f7f594fa8 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -617,7 +617,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -68,10 +68,10 @@ index c083dc8b2a69c3747b250d13f1a28ad22b5e6119..bf52c36f31992a01a7403d8c85151327
}
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 d261649aa1b7b351f325f9b752bb792f952f7b25..936b56c116de63b38a416d5bab4223a88d0469d0 100644
index 9d6cc0b8dbc451dfff1ddd8e7be32d11434cdb69..87289d8ab94705999c67457a28538e7a5576acc3 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
@@ -1124,6 +1124,7 @@ public abstract class BlockBehaviour implements FeatureElement {
@@ -1118,6 +1118,7 @@ public abstract class BlockBehaviour implements FeatureElement {
public void spawnAfterBreak(ServerLevel world, BlockPos pos, ItemStack tool, boolean dropExperience) {
this.getBlock().spawnAfterBreak(this.asState(), world, pos, tool, dropExperience);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add api for spawn egg texture colors
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 278ef7b7cd2cf95dcf38fb4cadfd2acfcc9c4dc5..be009fe105a4fff86d592ebc8df75650aff74a29 100644
index c4d1cf7399a20c2067c51c81b5107a4841a35337..f3bc116dc9838e88a2aa9f0dfe283dbfac5b27a9 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -648,6 +648,15 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -631,6 +631,15 @@ public final class CraftMagicNumbers implements UnsafeValues {
return CraftRegistry.get(registry, namespacedKey, ApiVersion.CURRENT);
}

View File

@ -734,27 +734,11 @@ index 7ea2676397025bdbe20f88ec122bd6d545dcf959..61c19b1005dc387d671fd72331a8774c
org.spigotmc.WatchdogThread.hasStarted = false; // Paper - Disable watchdog early timeout on reload
this.reloadCount++;
this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile());
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java b/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java
index d96399e9bf1a58db5a4a22e58abb99e7660e0694..66bdac50130f523f9dc4379b103b7a469f9ca36b 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java
@@ -143,4 +143,11 @@ public class MinecraftInternalPlugin extends PluginBase {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
throw new UnsupportedOperationException("Not supported.");
}
+
+ // Paper start - lifecycle events
+ @Override
+ public @NotNull io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager<org.bukkit.plugin.Plugin> getLifecycleManager() {
+ throw new UnsupportedOperationException("Not supported.");
+ }
+ // Paper end - lifecycle events
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index be009fe105a4fff86d592ebc8df75650aff74a29..d329da33f9bfea5e30e42cd30974b7d3b775f446 100644
index f3bc116dc9838e88a2aa9f0dfe283dbfac5b27a9..054058180b938101926f6613715f4266618fed94 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -657,6 +657,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -640,6 +640,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end - spawn egg color visibility

View File

@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack Tooltip API
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index d329da33f9bfea5e30e42cd30974b7d3b775f446..fa60f4e05e3303a7fe4faab0098c1fb439a24354 100644
index 054058180b938101926f6613715f4266618fed94..9fbe938e7c1efdc256aa5303651a7f14e972e559 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -633,6 +633,21 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -616,6 +616,21 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end - fix custom stats criteria creation

View File

@ -13,7 +13,7 @@ A config is provided if you rather let players use these exploits, and let
them destroy the worlds End Portals and get on top of the nether easy.
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 69914a048987c21ee2ed2c489aab269862fda8f2..bff83fe413c7baef4ba56a3270ea4463a58c792f 100644
index 0add20466890db9d2af7c595806d5e767b7ee117..32651ed15e5961a8b27fc0dc8fb54ef05b6064fe 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -193,6 +193,7 @@ public class Explosion {
@ -25,7 +25,7 @@ index 69914a048987c21ee2ed2c489aab269862fda8f2..bff83fe413c7baef4ba56a3270ea4463
if (!this.level.isInWorldBounds(blockposition)) {
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 81bdb6e64e04641f741c2c3350236685b097ec7a..c6c9400fa155831ab11d0f059971d0123617e622 100644
index b7bf7b3b91046c81467aeb483087e12b6d9191bf..a2877f3eb206ab9ccb93e3606f1c9b3401def5d6 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -447,6 +447,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -107,7 +107,7 @@ index e6bfbe2588e0c2a1be14e38d654e889d392ad4db..e0c62227b279a5fe0f3868fbf9ce8c78
world.playSound((Player) null, pos, SoundEvents.PISTON_CONTRACT, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.15F + 0.6F);
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 936b56c116de63b38a416d5bab4223a88d0469d0..6c4a339be29bb9c07b741a1ca12de2217c8687ba 100644
index 87289d8ab94705999c67457a28538e7a5576acc3..fe7dc02ea55c2bcd39d12bfd4d315f0b8c7014c3 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
@@ -173,7 +173,7 @@ public abstract class BlockBehaviour implements FeatureElement {
@ -128,7 +128,7 @@ index 936b56c116de63b38a416d5bab4223a88d0469d0..6c4a339be29bb9c07b741a1ca12de221
}
protected boolean canBeReplaced(BlockState state, Fluid fluid) {
@@ -888,6 +888,12 @@ public abstract class BlockBehaviour implements FeatureElement {
@@ -882,6 +882,12 @@ public abstract class BlockBehaviour implements FeatureElement {
return this.legacySolid;
}
@ -141,7 +141,7 @@ index 936b56c116de63b38a416d5bab4223a88d0469d0..6c4a339be29bb9c07b741a1ca12de221
public boolean isValidSpawn(BlockGetter world, BlockPos pos, EntityType<?> type) {
return this.getBlock().properties.isValidSpawn.test(this.asState(), world, pos, type);
}
@@ -991,7 +997,7 @@ public abstract class BlockBehaviour implements FeatureElement {
@@ -985,7 +991,7 @@ public abstract class BlockBehaviour implements FeatureElement {
}
public PushReaction getPistonPushReaction() {

View File

@ -22689,7 +22689,7 @@ index 0761d5bc5f2813bb4a9f664ac7a05b9744d0a778..7d2896918ff5fed37e5de5a22c37b0c7
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 2f253f33b866ff74e959c41d9501264cf226f45e..932de172f1fd4c1b31cf8958f3d2d412c9be0af9 100644
index 9a009a688c02e990723917766c51e1c0e71e338d..4db96543e2072e47040bb25a9d97ea6a69c4a43d 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -32,46 +32,125 @@ import net.minecraft.world.level.lighting.LevelLightEngine;
@ -23167,25 +23167,6 @@ index 2f253f33b866ff74e959c41d9501264cf226f45e..932de172f1fd4c1b31cf8958f3d2d412
}
@FunctionalInterface
@@ -471,15 +398,15 @@ public class ChunkHolder extends GenerationChunkHolder {
// Paper start
public final boolean isEntityTickingReady() {
- return this.isEntityTickingReady;
+ throw new UnsupportedOperationException(); // Paper - rewrite chunk system
}
public final boolean isTickingReady() {
- return this.isTickingReady;
+ throw new UnsupportedOperationException(); // Paper - rewrite chunk system
}
public final boolean isFullChunkReady() {
- return this.isFullChunkReady;
+ throw new UnsupportedOperationException(); // Paper - rewrite chunk system
}
// Paper end
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkLevel.java b/src/main/java/net/minecraft/server/level/ChunkLevel.java
index d9ad32acdf46a43a649334a3b736aeb7b3af21d1..fae17a075d7efaf24d916877dd5968eb9652bb66 100644
--- a/src/main/java/net/minecraft/server/level/ChunkLevel.java
@ -23204,7 +23185,7 @@ index d9ad32acdf46a43a649334a3b736aeb7b3af21d1..fae17a075d7efaf24d916877dd5968eb
public static final int RADIUS_AROUND_FULL_CHUNK = FULL_CHUNK_STEP.accumulatedDependencies().getRadius();
public static final int MAX_LEVEL = 33 + RADIUS_AROUND_FULL_CHUNK;
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 7f287127faf1d3a6b4b0f77800964b327ca9123f..edb36dee707433d4f9419aef6ac6cc0bec5f285e 100644
index ee597f2393c88473a72da941169e0f99c13da6ea..f6c090513f9dcc75e04e8e5b347c27f8d4d713cc 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -122,10 +122,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -24206,7 +24187,7 @@ index 7f287127faf1d3a6b4b0f77800964b327ca9123f..edb36dee707433d4f9419aef6ac6cc0b
+ public class ChunkDistanceManager extends DistanceManager implements ca.spottedleaf.moonrise.patches.chunk_system.level.chunk.ChunkSystemDistanceManager { // Paper - public // Paper - rewrite chunk system
protected ChunkDistanceManager(final Executor workerExecutor, final Executor mainThreadExecutor) {
super(workerExecutor, mainThreadExecutor, ChunkMap.this); // Paper
super(workerExecutor, mainThreadExecutor);
}
+ // Paper start - rewrite chunk system
@ -24318,10 +24299,10 @@ index 7f287127faf1d3a6b4b0f77800964b327ca9123f..edb36dee707433d4f9419aef6ac6cc0b
this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, j, flag, this::broadcast, this.seenBy); // CraftBukkit
this.entity = entity;
diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java
index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0baefaf9f19 100644
index 56aa26bb8d0bfbd3c799163fa620259e6455c89b..2d2596f04f5addac38037a14a02c6e0622d0c485 100644
--- a/src/main/java/net/minecraft/server/level/DistanceManager.java
+++ b/src/main/java/net/minecraft/server/level/DistanceManager.java
@@ -36,66 +36,60 @@ import net.minecraft.world.level.ChunkPos;
@@ -36,64 +36,58 @@ import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.chunk.LevelChunk;
import org.slf4j.Logger;
@ -24349,39 +24330,8 @@ index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0ba
private long ticketTickCounter;
- public int simulationDistance = 10;
+ // Paper - rewrite chunk system
private final ChunkMap chunkMap; // Paper
+ // Paper start - rewrite chunk system
+ public ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkHolderManager getChunkHolderManager() {
+ return ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.moonrise$getChunkMap().level).moonrise$getChunkTaskScheduler().chunkHolderManager;
+ }
+ // Paper end - rewrite chunk system
+ // Paper start - chunk tick iteration optimisation
+ private final ca.spottedleaf.moonrise.common.misc.PositionCountingAreaMap<ServerPlayer> spawnChunkTracker = new ca.spottedleaf.moonrise.common.misc.PositionCountingAreaMap<>();
+
+ @Override
+ public final void moonrise$addPlayer(final ServerPlayer player, final SectionPos pos) {
+ this.spawnChunkTracker.add(player, pos.x(), pos.z(), ca.spottedleaf.moonrise.patches.chunk_tick_iteration.ChunkTickConstants.PLAYER_SPAWN_TRACK_RANGE);
+ }
+
+ @Override
+ public final void moonrise$removePlayer(final ServerPlayer player, final SectionPos pos) {
+ this.spawnChunkTracker.remove(player);
+ }
+
+ @Override
+ public final void moonrise$updatePlayer(final ServerPlayer player,
+ final SectionPos oldPos, final SectionPos newPos,
+ final boolean oldIgnore, final boolean newIgnore) {
+ if (newIgnore) {
+ this.spawnChunkTracker.remove(player);
+ } else {
+ this.spawnChunkTracker.addOrUpdate(player, newPos.x(), newPos.z(), ca.spottedleaf.moonrise.patches.chunk_tick_iteration.ChunkTickConstants.PLAYER_SPAWN_TRACK_RANGE);
+ }
+ }
+ // Paper end - chunk tick iteration optimisation
+
protected DistanceManager(Executor workerExecutor, Executor mainThreadExecutor, ChunkMap chunkMap) {
protected DistanceManager(Executor workerExecutor, Executor mainThreadExecutor) {
Objects.requireNonNull(mainThreadExecutor);
ProcessorHandle<Runnable> mailbox = ProcessorHandle.of("player ticket throttler", mainThreadExecutor::execute);
ChunkTaskPriorityQueueSorter chunktaskqueuesorter = new ChunkTaskPriorityQueueSorter(ImmutableList.of(mailbox), workerExecutor, 4);
@ -24391,10 +24341,9 @@ index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0ba
- this.ticketThrottlerReleaser = chunktaskqueuesorter.getReleaseProcessor(mailbox);
- this.mainThreadExecutor = mainThreadExecutor;
+ // Paper - rewrite chunk system
this.chunkMap = chunkMap; // Paper
}
protected void purgeStaleTickets() {
- protected void purgeStaleTickets() {
- ++this.ticketTickCounter;
- ObjectIterator<Entry<SortedArraySet<Ticket<?>>>> objectiterator = this.tickets.long2ObjectEntrySet().fastIterator();
-
@ -24405,27 +24354,54 @@ index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0ba
-
- while (iterator.hasNext()) {
- Ticket<?> ticket = (Ticket) iterator.next();
-
+ // Paper start - rewrite chunk system
+ public ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkHolderManager getChunkHolderManager() {
+ return ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.moonrise$getChunkMap().level).moonrise$getChunkTaskScheduler().chunkHolderManager;
+ }
+ // Paper end - rewrite chunk system
+ // Paper start - chunk tick iteration optimisation
+ private final ca.spottedleaf.moonrise.common.misc.PositionCountingAreaMap<ServerPlayer> spawnChunkTracker = new ca.spottedleaf.moonrise.common.misc.PositionCountingAreaMap<>();
- if (ticket.timedOut(this.ticketTickCounter)) {
- iterator.remove();
- flag = true;
- this.tickingTicketsTracker.removeTicket(entry.getLongKey(), ticket);
- }
- }
-
+ @Override
+ public final void moonrise$addPlayer(final ServerPlayer player, final SectionPos pos) {
+ this.spawnChunkTracker.add(player, pos.x(), pos.z(), ca.spottedleaf.moonrise.patches.chunk_tick_iteration.ChunkTickConstants.PLAYER_SPAWN_TRACK_RANGE);
+ }
- if (flag) {
- this.ticketTracker.update(entry.getLongKey(), DistanceManager.getTicketLevelAt((SortedArraySet) entry.getValue()), false);
- }
-
+ @Override
+ public final void moonrise$removePlayer(final ServerPlayer player, final SectionPos pos) {
+ this.spawnChunkTracker.remove(player);
+ }
- if (((SortedArraySet) entry.getValue()).isEmpty()) {
- objectiterator.remove();
- }
- }
+ @Override
+ public final void moonrise$updatePlayer(final ServerPlayer player,
+ final SectionPos oldPos, final SectionPos newPos,
+ final boolean oldIgnore, final boolean newIgnore) {
+ if (newIgnore) {
+ this.spawnChunkTracker.remove(player);
+ } else {
+ this.spawnChunkTracker.addOrUpdate(player, newPos.x(), newPos.z(), ca.spottedleaf.moonrise.patches.chunk_tick_iteration.ChunkTickConstants.PLAYER_SPAWN_TRACK_RANGE);
}
+ }
+ // Paper end - chunk tick iteration optimisation
+
+ protected void purgeStaleTickets() {
+ this.getChunkHolderManager().tick(); // Paper - rewrite chunk system
}
@@ -112,86 +106,15 @@ public abstract class DistanceManager {
@@ -110,86 +104,15 @@ public abstract class DistanceManager {
protected abstract ChunkHolder updateChunkScheduling(long pos, int level, @Nullable ChunkHolder holder, int k);
public boolean runAllUpdates(ChunkMap chunkLoadingManager) {
@ -24515,7 +24491,7 @@ index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0ba
}
public <T> void addTicket(TicketType<T> type, ChunkPos pos, int level, T argument) {
@@ -210,13 +133,7 @@ public abstract class DistanceManager {
@@ -208,13 +131,7 @@ public abstract class DistanceManager {
}
public <T> boolean addRegionTicketAtDistance(TicketType<T> tickettype, ChunkPos chunkcoordintpair, int i, T t0) {
@ -24530,7 +24506,7 @@ index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0ba
}
public <T> void removeRegionTicket(TicketType<T> type, ChunkPos pos, int radius, T argument) {
@@ -225,32 +142,21 @@ public abstract class DistanceManager {
@@ -223,32 +140,21 @@ public abstract class DistanceManager {
}
public <T> boolean removeRegionTicketAtDistance(TicketType<T> tickettype, ChunkPos chunkcoordintpair, int i, T t0) {
@ -24569,7 +24545,7 @@ index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0ba
}
@@ -261,9 +167,8 @@ public abstract class DistanceManager {
@@ -259,9 +165,8 @@ public abstract class DistanceManager {
((ObjectSet) this.playersPerChunk.computeIfAbsent(i, (j) -> {
return new ObjectOpenHashSet();
})).add(player);
@ -24581,7 +24557,7 @@ index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0ba
}
public void removePlayer(SectionPos pos, ServerPlayer player) {
@@ -275,151 +180,81 @@ public abstract class DistanceManager {
@@ -273,151 +178,81 @@ public abstract class DistanceManager {
if (objectset != null) objectset.remove(player); // Paper - some state corruption happens here, don't crash, clean up gracefully
if (objectset == null || objectset.isEmpty()) { // Paper
this.playersPerChunk.remove(i);
@ -24756,7 +24732,7 @@ index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0ba
private class ChunkTicketTracker extends ChunkTracker {
private static final int MAX_LEVEL = ChunkLevel.MAX_LEVEL + 1;
@@ -465,7 +300,7 @@ public abstract class DistanceManager {
@@ -463,7 +298,7 @@ public abstract class DistanceManager {
public int runDistanceUpdates(int distance) {
return this.runUpdates(distance);
}
@ -24765,7 +24741,7 @@ index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0ba
private class FixedPlayerDistanceChunkTracker extends ChunkTracker {
@@ -545,6 +380,7 @@ public abstract class DistanceManager {
@@ -543,6 +378,7 @@ public abstract class DistanceManager {
}
}
@ -24773,7 +24749,7 @@ index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0ba
private class PlayerTicketTracker extends DistanceManager.FixedPlayerDistanceChunkTracker {
private int viewDistance = 0;
@@ -639,5 +475,5 @@ public abstract class DistanceManager {
@@ -637,5 +473,5 @@ public abstract class DistanceManager {
private boolean haveTicketFor(int distance) {
return distance <= this.viewDistance;
}
@ -28951,7 +28927,7 @@ index d775ab8b0d37797f29e650842191d40691fb7afc..a7108b2be0746aa1f0e574d8c6f5ffad
public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) {}
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 6c4a339be29bb9c07b741a1ca12de2217c8687ba..0f289d8f9bda2fb2ca2cd2dfd667a975529b3e4c 100644
index fe7dc02ea55c2bcd39d12bfd4d315f0b8c7014c3..ded6d148110fe3fbb6272ce44582a28472dd49a6 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
@@ -762,7 +762,7 @@ public abstract class BlockBehaviour implements FeatureElement {
@ -29040,7 +29016,7 @@ index 6c4a339be29bb9c07b741a1ca12de2217c8687ba..0f289d8f9bda2fb2ca2cd2dfd667a975
protected BlockStateBase(Block block, Reference2ObjectArrayMap<Property<?>, Comparable<?>> propertyMap, MapCodec<BlockState> codec) {
super(block, propertyMap, codec);
this.fluidState = Fluids.EMPTY.defaultFluidState();
@@ -864,6 +934,43 @@ public abstract class BlockBehaviour implements FeatureElement {
@@ -858,6 +928,43 @@ public abstract class BlockBehaviour implements FeatureElement {
this.shapeExceedsCube = this.cache == null || this.cache.largeCollisionShape; // Paper - moved from actual method to here
this.legacySolid = this.calculateSolid();

View File

@ -29388,10 +29388,10 @@ index 1d287dd7379e56f7fd4b425880b850cd843f5789..8ab7ca373a885fbe658013c9c6a2e38d
return nbttagcompound;
});
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index fa60f4e05e3303a7fe4faab0098c1fb439a24354..ca1c0955be0d0f78972f39c4bd4afffd46c2fb45 100644
index 9fbe938e7c1efdc256aa5303651a7f14e972e559..ff60dc1eae8d3c13006b5f19e5bb64c8309fd3d3 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -516,7 +516,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -499,7 +499,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data);
final int dataVersion = compound.getInt("DataVersion");
@ -29400,7 +29400,7 @@ index fa60f4e05e3303a7fe4faab0098c1fb439a24354..ca1c0955be0d0f78972f39c4bd4afffd
return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow());
}
@@ -537,7 +537,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -520,7 +520,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data);
int dataVersion = compound.getInt("DataVersion");

View File

@ -111,7 +111,7 @@ index 978208f74b6f1d3f859165e951d41013a5f00256..1196eb573317ad01b6df0ae2d38aa17a
} else {
passenger.stopRiding();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 4f4b7e738fe604808d837a38d23bf437bc1d5329..abc217e9166bce12590f37aa0e21d6202596e786 100644
index 9f07343401a03735234b0298b92663b5b94608a8..b3e0c8c63eda497fc868f5691b585d5092eb169d 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -419,6 +419,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@ -147,7 +147,7 @@ index 4f4b7e738fe604808d837a38d23bf437bc1d5329..abc217e9166bce12590f37aa0e21d620
movement = this.maybeBackOffFromEdge(movement, movementType);
Vec3 vec3d1 = this.collide(movement);
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 5bac748649f43d74b13e7c0b4d355e67654ad59e..7b93c6a04cca2ac31d137f06ef83bb08559b10bf 100644
index 8b6eed30f84dc98878deaa805e7446ae4b168400..bd7c6ce15698aed70376c109ba36f52d6794a2f8 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -232,6 +232,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@ -171,17 +171,18 @@ index 5bac748649f43d74b13e7c0b4d355e67654ad59e..7b93c6a04cca2ac31d137f06ef83bb08
Entity entity = this.getControlledVehicle();
diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
index bd8d56aa5a3557e7a2aa1dd066b27c2054d1eef8..9c995085357eff3c3b6c9c23129c2be6ea51e371 100644
index 812aecb88641c09fb5030d145620b95aff19c9cb..ec9e76c548393235dcc6658c29e72e07e5d3510b 100644
--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java
+++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
@@ -23,6 +23,7 @@ public abstract class PathfinderMob extends Mob {
@@ -22,6 +22,8 @@ public abstract class PathfinderMob extends Mob {
super(type, world);
}
public org.bukkit.craftbukkit.entity.CraftCreature getBukkitCreature() { return (org.bukkit.craftbukkit.entity.CraftCreature) super.getBukkitEntity(); } // Paper
+ public BlockPos movingTarget = null; public BlockPos getMovingTarget() { return movingTarget; } // Paper
+ public BlockPos movingTarget; public BlockPos getMovingTarget() { return movingTarget; } // Paper
+
public float getWalkTargetValue(BlockPos pos) {
return this.getWalkTargetValue(pos, this.level());
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
index 89b8a304fe9fae4b57640afbab04b6764ce9aab8..074ef807258139f818e30494126585262c2f33c0 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
@ -340,7 +341,7 @@ index 0b7f52021441d633c37543e8ae485e81c292b747..d7f8464bf3eed0e42a5fc7f14a5b243d
+
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 77b7c252d27f527d9b51e8419abe7af1d4b51d29..ecf2f478932c9ccc5a7ac47c8f17bd44217c703b 100644
index 574175449af5b767f28e95ff8708ed37fedf4c7d..ce9350ed3c5c5fbbd9b2ade9ae2880e03305c787 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -157,6 +157,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl

View File

@ -9,7 +9,7 @@ public net.minecraft.resources.RegistryOps lookupProvider
public net.minecraft.resources.RegistryOps$HolderLookupAdapter
diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
index a5a985369199dc4528c69c52fd6819e1419a7feb..d64b8eecaf4de2aa2780b6c21335516405bbd401 100644
index ead718efde812846fefec3e86d896fef7deb3d97..722e3786f5b36f9b9ccff4028a58c3893c7960d6 100644
--- a/src/main/java/io/papermc/paper/registry/PaperRegistries.java
+++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
@@ -2,6 +2,7 @@ package io.papermc.paper.registry;
@ -1347,10 +1347,10 @@ index fc9aec589414bf8d3f672183928235b5b51d1a02..0f3c46b8bb93fc42160300c9988d04be
+ // Paper end - RegistrySet API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index ca1c0955be0d0f78972f39c4bd4afffd46c2fb45..0984843ff443ba40406839d06f83304902ee4f43 100644
index ff60dc1eae8d3c13006b5f19e5bb64c8309fd3d3..1627e141a68b5df65dbc1526d72fbe24edc2189f 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -679,6 +679,21 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -662,6 +662,21 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end - lifecycle event API

View File

@ -205,10 +205,10 @@ index 9c004e7cb46841d874ab997bf2e3b63ae763aec7..d7c8f26b21276d9ff1d5c7c9738cc112
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 0984843ff443ba40406839d06f83304902ee4f43..3137391cadef7c67019561e65fedd0664e689eae 100644
index 1627e141a68b5df65dbc1526d72fbe24edc2189f..28b3ad04e1f4b38ce21084864a59a2cd81b3992c 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -694,6 +694,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -677,6 +677,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end - hack to get tags for non server-backed registries

View File

@ -108,7 +108,7 @@ index dddd4fcdcd08e0221693071894818c7d3bae531b..5980b70e2d7273239245237189b2debc
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10;
private static final int FLY_STAT_RECORDING_SPEED = 25;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 5f20606cc2c79ad9a4c4d4d6c9e6a2a31a88b282..dfcaff15a145bf29e8a538d853bb04aec8c36179 100644
index c38c688417f769a6022dd40d6652b00e14c4df94..43eeb8ce4bc350c2b524ade11ca25d8d4d21bea5 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -569,6 +569,7 @@ public abstract class PlayerList {
@ -119,7 +119,7 @@ index 5f20606cc2c79ad9a4c4d4d6c9e6a2a31a88b282..dfcaff15a145bf29e8a538d853bb04ae
this.playerIo.save(player);
ServerStatsCounter serverstatisticmanager = (ServerStatsCounter) player.getStats(); // CraftBukkit
@@ -1182,10 +1183,22 @@ public abstract class PlayerList {
@@ -1183,10 +1184,22 @@ public abstract class PlayerList {
}
public void saveAll() {