diff --git a/patches/api/0001-Pufferfish-API-Changes.patch b/patches/api/0001-Pufferfish-API-Changes.patch new file mode 100644 index 000000000..d20f131a5 --- /dev/null +++ b/patches/api/0001-Pufferfish-API-Changes.patch @@ -0,0 +1,523 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kevin Raneri +Date: Tue, 9 Nov 2021 14:01:56 -0500 +Subject: [PATCH] Pufferfish API Changes + +Pufferfish +Copyright (C) 2022 Pufferfish Studios LLC + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +diff --git a/build.gradle.kts b/build.gradle.kts +index 3c4dd6ebc2289c44c2f5723e7920aadffdc51884..a995ecc3b1d6181c58d5b4a0a6a893178bdc40aa 100644 +--- a/build.gradle.kts ++++ b/build.gradle.kts +@@ -41,6 +41,7 @@ dependencies { + apiAndDocs("net.kyori:adventure-text-logger-slf4j") + api("org.apache.logging.log4j:log4j-api:2.17.1") + api("org.slf4j:slf4j-api:1.8.0-beta4") ++ api("io.sentry:sentry:5.4.0") // Pufferfish + + implementation("org.ow2.asm:asm:9.2") + implementation("org.ow2.asm:asm-commons:9.2") +@@ -83,6 +84,13 @@ val generateApiVersioningFile by tasks.registering { + } + } + ++// Pufferfish Start ++tasks.withType { ++ val compilerArgs = options.compilerArgs ++ compilerArgs.add("--add-modules=jdk.incubator.vector") ++} ++// Pufferfish End ++ + tasks.jar { + from(generateApiVersioningFile.map { it.outputs.files.singleFile }) { + into("META-INF/maven/${project.group}/${project.name}") +diff --git a/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java +new file mode 100644 +index 0000000000000000000000000000000000000000..10310fdd53de28efb8a8250f6d3b0c8eb08fb68a +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java +@@ -0,0 +1,161 @@ ++package gg.pufferfish.pufferfish.sentry; ++ ++import com.google.gson.Gson; ++import java.lang.reflect.Field; ++import java.lang.reflect.Modifier; ++import java.util.Map; ++import java.util.TreeMap; ++import org.apache.logging.log4j.ThreadContext; ++import org.bukkit.command.Command; ++import org.bukkit.command.CommandSender; ++import org.bukkit.entity.Player; ++import org.bukkit.event.Event; ++import org.bukkit.event.player.PlayerEvent; ++import org.bukkit.plugin.Plugin; ++import org.bukkit.plugin.RegisteredListener; ++import org.jetbrains.annotations.Nullable; ++ ++public class SentryContext { ++ ++ private static final Gson GSON = new Gson(); ++ ++ public static void setPluginContext(@Nullable Plugin plugin) { ++ if (plugin != null) { ++ ThreadContext.put("pufferfishsentry_pluginname", plugin.getName()); ++ ThreadContext.put("pufferfishsentry_pluginversion", plugin.getDescription().getVersion()); ++ } ++ } ++ ++ public static void removePluginContext() { ++ ThreadContext.remove("pufferfishsentry_pluginname"); ++ ThreadContext.remove("pufferfishsentry_pluginversion"); ++ } ++ ++ public static void setSenderContext(@Nullable CommandSender sender) { ++ if (sender != null) { ++ ThreadContext.put("pufferfishsentry_playername", sender.getName()); ++ if (sender instanceof Player player) { ++ ThreadContext.put("pufferfishsentry_playerid", player.getUniqueId().toString()); ++ } ++ } ++ } ++ ++ public static void removeSenderContext() { ++ ThreadContext.remove("pufferfishsentry_playername"); ++ ThreadContext.remove("pufferfishsentry_playerid"); ++ } ++ ++ public static void setEventContext(Event event, RegisteredListener registration) { ++ setPluginContext(registration.getPlugin()); ++ ++ try { ++ // Find the player that was involved with this event ++ Player player = null; ++ if (event instanceof PlayerEvent) { ++ player = ((PlayerEvent) event).getPlayer(); ++ } else { ++ Class eventClass = event.getClass(); ++ ++ Field playerField = null; ++ ++ for (Field field : eventClass.getDeclaredFields()) { ++ if (field.getType().equals(Player.class)) { ++ playerField = field; ++ break; ++ } ++ } ++ ++ if (playerField != null) { ++ playerField.setAccessible(true); ++ player = (Player) playerField.get(event); ++ } ++ } ++ ++ if (player != null) { ++ setSenderContext(player); ++ } ++ } catch (Exception e) {} // We can't really safely log exceptions. ++ ++ ThreadContext.put("pufferfishsentry_eventdata", GSON.toJson(serializeFields(event))); ++ } ++ ++ public static void removeEventContext() { ++ removePluginContext(); ++ removeSenderContext(); ++ ThreadContext.remove("pufferfishsentry_eventdata"); ++ } ++ ++ private static Map serializeFields(Object object) { ++ Map fields = new TreeMap<>(); ++ fields.put("_class", object.getClass().getName()); ++ for (Field declaredField : object.getClass().getDeclaredFields()) { ++ try { ++ if (Modifier.isStatic(declaredField.getModifiers())) { ++ continue; ++ } ++ ++ String fieldName = declaredField.getName(); ++ if (fieldName.equals("handlers")) { ++ continue; ++ } ++ declaredField.setAccessible(true); ++ Object value = declaredField.get(object); ++ if (value != null) { ++ fields.put(fieldName, value.toString()); ++ } else { ++ fields.put(fieldName, ""); ++ } ++ } catch (Exception e) {} // We can't really safely log exceptions. ++ } ++ return fields; ++ } ++ ++ public static class State { ++ ++ private Plugin plugin; ++ private Command command; ++ private String commandLine; ++ private Event event; ++ private RegisteredListener registeredListener; ++ ++ public Plugin getPlugin() { ++ return plugin; ++ } ++ ++ public void setPlugin(Plugin plugin) { ++ this.plugin = plugin; ++ } ++ ++ public Command getCommand() { ++ return command; ++ } ++ ++ public void setCommand(Command command) { ++ this.command = command; ++ } ++ ++ public String getCommandLine() { ++ return commandLine; ++ } ++ ++ public void setCommandLine(String commandLine) { ++ this.commandLine = commandLine; ++ } ++ ++ public Event getEvent() { ++ return event; ++ } ++ ++ public void setEvent(Event event) { ++ this.event = event; ++ } ++ ++ public RegisteredListener getRegisteredListener() { ++ return registeredListener; ++ } ++ ++ public void setRegisteredListener(RegisteredListener registeredListener) { ++ this.registeredListener = registeredListener; ++ } ++ } ++} +diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java +new file mode 100644 +index 0000000000000000000000000000000000000000..93f5d7ca36e043e6c0f959450d38e6946b348eaf +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java +@@ -0,0 +1,40 @@ ++package gg.pufferfish.pufferfish.simd; ++ ++import java.util.logging.Level; ++import java.util.logging.Logger; ++import jdk.incubator.vector.FloatVector; ++import jdk.incubator.vector.IntVector; ++import jdk.incubator.vector.VectorSpecies; ++ ++/** ++ * Basically, java is annoying and we have to push this out to its own class. ++ */ ++@Deprecated ++public class SIMDChecker { ++ ++ @Deprecated ++ public static boolean canEnable(Logger logger) { ++ try { ++ if (SIMDDetection.getJavaVersion() != 17 && SIMDDetection.getJavaVersion() != 18) { ++ return false; ++ } else { ++ SIMDDetection.testRun = true; ++ ++ VectorSpecies ISPEC = IntVector.SPECIES_PREFERRED; ++ VectorSpecies FSPEC = FloatVector.SPECIES_PREFERRED; ++ ++ logger.log(Level.INFO, "Max SIMD vector size on this system is " + ISPEC.vectorBitSize() + " bits (int)"); ++ logger.log(Level.INFO, "Max SIMD vector size on this system is " + FSPEC.vectorBitSize() + " bits (float)"); ++ ++ if (ISPEC.elementSize() < 2 || FSPEC.elementSize() < 2) { ++ logger.log(Level.WARNING, "SIMD is not properly supported on this system!"); ++ return false; ++ } ++ ++ return true; ++ } ++ } catch (NoClassDefFoundError | Exception ignored) {} // Basically, we don't do anything. This lets us detect if it's not functional and disable it. ++ return false; ++ } ++ ++} +diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a84889d3e9cfc4d7ab5f867820a6484c6070711b +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java +@@ -0,0 +1,35 @@ ++package gg.pufferfish.pufferfish.simd; ++ ++import java.util.logging.Logger; ++ ++@Deprecated ++public class SIMDDetection { ++ ++ public static boolean isEnabled = false; ++ public static boolean versionLimited = false; ++ public static boolean testRun = false; ++ ++ @Deprecated ++ public static boolean canEnable(Logger logger) { ++ try { ++ return SIMDChecker.canEnable(logger); ++ } catch (NoClassDefFoundError | Exception ignored) { ++ return false; ++ } ++ } ++ ++ @Deprecated ++ public static int getJavaVersion() { ++ // https://stackoverflow.com/a/2591122 ++ String version = System.getProperty("java.version"); ++ if(version.startsWith("1.")) { ++ version = version.substring(2, 3); ++ } else { ++ int dot = version.indexOf("."); ++ if(dot != -1) { version = version.substring(0, dot); } ++ } ++ version = version.split("-")[0]; // Azul is stupid ++ return Integer.parseInt(version); ++ } ++ ++} +diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java b/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ae2464920c9412ac90b819a540ee58be0741465f +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java +@@ -0,0 +1,83 @@ ++package gg.pufferfish.pufferfish.simd; ++ ++import java.awt.Color; ++import jdk.incubator.vector.FloatVector; ++import jdk.incubator.vector.IntVector; ++import jdk.incubator.vector.VectorMask; ++import jdk.incubator.vector.VectorSpecies; ++import org.bukkit.map.MapPalette; ++ ++@Deprecated ++public class VectorMapPalette { ++ ++ private static final VectorSpecies I_SPEC = IntVector.SPECIES_PREFERRED; ++ private static final VectorSpecies F_SPEC = FloatVector.SPECIES_PREFERRED; ++ ++ @Deprecated ++ public static void matchColorVectorized(int[] in, byte[] out) { ++ int speciesLength = I_SPEC.length(); ++ int i; ++ for (i = 0; i < in.length - speciesLength; i += speciesLength) { ++ float[] redsArr = new float[speciesLength]; ++ float[] bluesArr = new float[speciesLength]; ++ float[] greensArr = new float[speciesLength]; ++ int[] alphasArr = new int[speciesLength]; ++ ++ for (int j = 0; j < speciesLength; j++) { ++ alphasArr[j] = (in[i + j] >> 24) & 0xFF; ++ redsArr[j] = (in[i + j] >> 16) & 0xFF; ++ greensArr[j] = (in[i + j] >> 8) & 0xFF; ++ bluesArr[j] = (in[i + j] >> 0) & 0xFF; ++ } ++ ++ IntVector alphas = IntVector.fromArray(I_SPEC, alphasArr, 0); ++ FloatVector reds = FloatVector.fromArray(F_SPEC, redsArr, 0); ++ FloatVector greens = FloatVector.fromArray(F_SPEC, greensArr, 0); ++ FloatVector blues = FloatVector.fromArray(F_SPEC, bluesArr, 0); ++ IntVector resultIndex = IntVector.zero(I_SPEC); ++ VectorMask modificationMask = VectorMask.fromLong(I_SPEC, 0xffffffff); ++ ++ modificationMask = modificationMask.and(alphas.lt(128).not()); ++ FloatVector bestDistances = FloatVector.broadcast(F_SPEC, Float.MAX_VALUE); ++ ++ for (int c = 4; c < MapPalette.colors.length; c++) { ++ // We're using 32-bit floats here because it's 2x faster and nobody will know the difference. ++ // For correctness, the original algorithm uses 64-bit floats instead. Completely unnecessary. ++ FloatVector compReds = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getRed()); ++ FloatVector compGreens = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getGreen()); ++ FloatVector compBlues = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getBlue()); ++ ++ FloatVector rMean = reds.add(compReds).div(2.0f); ++ FloatVector rDiff = reds.sub(compReds); ++ FloatVector gDiff = greens.sub(compGreens); ++ FloatVector bDiff = blues.sub(compBlues); ++ ++ FloatVector weightR = rMean.div(256.0f).add(2); ++ FloatVector weightG = FloatVector.broadcast(F_SPEC, 4.0f); ++ FloatVector weightB = FloatVector.broadcast(F_SPEC, 255.0f).sub(rMean).div(256.0f).add(2.0f); ++ ++ FloatVector distance = weightR.mul(rDiff).mul(rDiff).add(weightG.mul(gDiff).mul(gDiff)).add(weightB.mul(bDiff).mul(bDiff)); ++ ++ // Now we compare to the best distance we've found. ++ // This mask contains a "1" if better, and a "0" otherwise. ++ VectorMask bestDistanceMask = distance.lt(bestDistances); ++ bestDistances = bestDistances.blend(distance, bestDistanceMask); // Update the best distances ++ ++ // Update the result array ++ // We also AND with the modification mask because we don't want to interfere if the alpha value isn't large enough. ++ resultIndex = resultIndex.blend(c, bestDistanceMask.cast(I_SPEC).and(modificationMask)); // Update the results ++ } ++ ++ for (int j = 0; j < speciesLength; j++) { ++ int index = resultIndex.lane(j); ++ out[i + j] = (byte) (index < 128 ? index : -129 + (index - 127)); ++ } ++ } ++ ++ // For the final ones, fall back to the regular method ++ for (; i < in.length; i++) { ++ out[i] = MapPalette.matchColor(new Color(in[i], true)); ++ } ++ } ++ ++} +diff --git a/src/main/java/org/bukkit/map/MapPalette.java b/src/main/java/org/bukkit/map/MapPalette.java +index 3a9aaca2e76411a9c27f9f5e0f22d060d5a66d06..9584e245144b561b4f6745b2f26a4f69a6f92891 100644 +--- a/src/main/java/org/bukkit/map/MapPalette.java ++++ b/src/main/java/org/bukkit/map/MapPalette.java +@@ -1,6 +1,7 @@ + package org.bukkit.map; + + import com.google.common.base.Preconditions; ++import gg.pufferfish.pufferfish.simd.SIMDDetection; // Pufferfish + import java.awt.Color; + import java.awt.Graphics2D; + import java.awt.Image; +@@ -40,7 +41,7 @@ public final class MapPalette { + } + + @NotNull +- static final Color[] colors = { ++ public static final Color[] colors = { // Pufferfish - public access + c(0, 0, 0, 0), c(0, 0, 0, 0), c(0, 0, 0, 0), c(0, 0, 0, 0), + c(89, 125, 39), c(109, 153, 48), c(127, 178, 56), c(67, 94, 29), + c(174, 164, 115), c(213, 201, 140), c(247, 233, 163), c(130, 123, 86), +@@ -211,9 +212,15 @@ public final class MapPalette { + temp.getRGB(0, 0, temp.getWidth(), temp.getHeight(), pixels, 0, temp.getWidth()); + + byte[] result = new byte[temp.getWidth() * temp.getHeight()]; ++ // Pufferfish start ++ if (!SIMDDetection.isEnabled) { + for (int i = 0; i < pixels.length; i++) { + result[i] = matchColor(new Color(pixels[i], true)); + } ++ } else { ++ gg.pufferfish.pufferfish.simd.VectorMapPalette.matchColorVectorized(pixels, result); ++ } ++ // Pufferfish end + return result; + } + +diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +index b012ce40d82389c29d1b841ff685425ac10a7f9e..c077e7c883613fcb6e559b4e4776e794caa3b363 100644 +--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java ++++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +@@ -625,7 +625,9 @@ public final class SimplePluginManager implements PluginManager { + + // Paper start + private void handlePluginException(String msg, Throwable ex, Plugin plugin) { ++ gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish + server.getLogger().log(Level.SEVERE, msg, ex); ++ gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish + callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerPluginEnableDisableException(msg, ex, plugin))); + } + // Paper end +@@ -684,9 +686,11 @@ public final class SimplePluginManager implements PluginManager { + )); + } + } catch (Throwable ex) { ++ gg.pufferfish.pufferfish.sentry.SentryContext.setEventContext(event, registration); // Pufferfish + // Paper start - error reporting + String msg = "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName(); + server.getLogger().log(Level.SEVERE, msg, ex); ++ gg.pufferfish.pufferfish.sentry.SentryContext.removeEventContext(); // Pufferfish + if (!(event instanceof com.destroystokyo.paper.event.server.ServerExceptionEvent)) { // We don't want to cause an endless event loop + callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event))); + } +diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +index 7e5149a21b6747f64425a277c142e69f0ef43b3f..bf93183aa76af005d5daf8cf533f908d535166e8 100644 +--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java ++++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +@@ -370,7 +370,9 @@ public final class JavaPluginLoader implements PluginLoader { + try { + jPlugin.setEnabled(true); + } catch (Throwable ex) { ++ gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish + server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); ++ gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish + // Paper start - Disable plugins that fail to load + this.server.getPluginManager().disablePlugin(jPlugin); + return; +@@ -399,7 +401,9 @@ public final class JavaPluginLoader implements PluginLoader { + try { + jPlugin.setEnabled(false); + } catch (Throwable ex) { ++ gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish + server.getLogger().log(Level.SEVERE, "Error occurred while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); ++ gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish + } + + if (cloader instanceof PluginClassLoader) { +diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +index cb3c25ef46b279ffdde87f47f729eb8aa7549c1c..6fb179c4d420eac3a6399fbff104b5af6ba448ba 100644 +--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java ++++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +@@ -46,6 +46,8 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot + private final Set seenIllegalAccess = Collections.newSetFromMap(new ConcurrentHashMap<>()); + private java.util.logging.Logger logger; // Paper - add field + ++ private boolean closed = false; // Pufferfish ++ + static { + ClassLoader.registerAsParallelCapable(); + } +@@ -177,6 +179,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot + throw new ClassNotFoundException(name); + } + ++ public boolean _airplane_hasClass(@NotNull String name) { return this.classes.containsKey(name); } // Pufferfish + @Override + protected Class findClass(String name) throws ClassNotFoundException { + if (name.startsWith("org.bukkit.") || name.startsWith("net.minecraft.")) { +@@ -184,7 +187,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot + } + Class result = classes.get(name); + +- if (result == null) { ++ if (result == null && !this.closed) { // Pufferfish + String path = name.replace('.', '/').concat(".class"); + JarEntry entry = jar.getJarEntry(path); + +@@ -231,6 +234,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot + classes.put(name, result); + } + ++ if (result == null) throw new ClassNotFoundException(name); // Pufferfish + return result; + } + +@@ -239,6 +243,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot + try { + super.close(); + } finally { ++ this.closed = true; // Pufferfish + jar.close(); + } + } diff --git a/patches/api/0001-Fix-pufferfish-issues.patch b/patches/api/0002-Fix-pufferfish-issues.patch similarity index 100% rename from patches/api/0001-Fix-pufferfish-issues.patch rename to patches/api/0002-Fix-pufferfish-issues.patch diff --git a/patches/api/0002-Build-System-Changes.patch b/patches/api/0003-Build-System-Changes.patch similarity index 85% rename from patches/api/0002-Build-System-Changes.patch rename to patches/api/0003-Build-System-Changes.patch index 65bb6f5d8..ce312461f 100644 --- a/patches/api/0002-Build-System-Changes.patch +++ b/patches/api/0003-Build-System-Changes.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Build System Changes diff --git a/build.gradle.kts b/build.gradle.kts -index f6da2209c9853bc7c5e2f8805389041946872f1b..aba9d75153445923b04a218fd85dad37a4901225 100644 +index a995ecc3b1d6181c58d5b4a0a6a893178bdc40aa..5c8dd4d3313a791d1fee00ec5d4bc595b76b7d6d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -95,6 +95,8 @@ tasks.jar { +@@ -103,6 +103,8 @@ tasks.jar { } tasks.withType { diff --git a/patches/api/0003-Purpur-config-files.patch b/patches/api/0004-Purpur-config-files.patch similarity index 100% rename from patches/api/0003-Purpur-config-files.patch rename to patches/api/0004-Purpur-config-files.patch diff --git a/patches/api/0004-Purpur-client-support.patch b/patches/api/0005-Purpur-client-support.patch similarity index 100% rename from patches/api/0004-Purpur-client-support.patch rename to patches/api/0005-Purpur-client-support.patch diff --git a/patches/api/0005-Default-permissions.patch b/patches/api/0006-Default-permissions.patch similarity index 100% rename from patches/api/0005-Default-permissions.patch rename to patches/api/0006-Default-permissions.patch diff --git a/patches/api/0006-Ridables.patch b/patches/api/0007-Ridables.patch similarity index 100% rename from patches/api/0006-Ridables.patch rename to patches/api/0007-Ridables.patch diff --git a/patches/api/0007-Allow-inventory-resizing.patch b/patches/api/0008-Allow-inventory-resizing.patch similarity index 100% rename from patches/api/0007-Allow-inventory-resizing.patch rename to patches/api/0008-Allow-inventory-resizing.patch diff --git a/patches/api/0008-Llama-API.patch b/patches/api/0009-Llama-API.patch similarity index 100% rename from patches/api/0008-Llama-API.patch rename to patches/api/0009-Llama-API.patch diff --git a/patches/api/0009-AFK-API.patch b/patches/api/0010-AFK-API.patch similarity index 100% rename from patches/api/0009-AFK-API.patch rename to patches/api/0010-AFK-API.patch diff --git a/patches/api/0010-Bring-back-server-name.patch b/patches/api/0011-Bring-back-server-name.patch similarity index 100% rename from patches/api/0010-Bring-back-server-name.patch rename to patches/api/0011-Bring-back-server-name.patch diff --git a/patches/api/0011-ExecuteCommandEvent.patch b/patches/api/0012-ExecuteCommandEvent.patch similarity index 100% rename from patches/api/0011-ExecuteCommandEvent.patch rename to patches/api/0012-ExecuteCommandEvent.patch diff --git a/patches/api/0012-LivingEntity-safeFallDistance.patch b/patches/api/0013-LivingEntity-safeFallDistance.patch similarity index 100% rename from patches/api/0012-LivingEntity-safeFallDistance.patch rename to patches/api/0013-LivingEntity-safeFallDistance.patch diff --git a/patches/api/0013-Lagging-threshold.patch b/patches/api/0014-Lagging-threshold.patch similarity index 100% rename from patches/api/0013-Lagging-threshold.patch rename to patches/api/0014-Lagging-threshold.patch diff --git a/patches/api/0014-PlayerSetSpawnerTypeWithEggEvent.patch b/patches/api/0015-PlayerSetSpawnerTypeWithEggEvent.patch similarity index 100% rename from patches/api/0014-PlayerSetSpawnerTypeWithEggEvent.patch rename to patches/api/0015-PlayerSetSpawnerTypeWithEggEvent.patch diff --git a/patches/api/0015-EMC-MonsterEggSpawnEvent.patch b/patches/api/0016-EMC-MonsterEggSpawnEvent.patch similarity index 100% rename from patches/api/0015-EMC-MonsterEggSpawnEvent.patch rename to patches/api/0016-EMC-MonsterEggSpawnEvent.patch diff --git a/patches/api/0016-Player-invulnerabilities.patch b/patches/api/0017-Player-invulnerabilities.patch similarity index 100% rename from patches/api/0016-Player-invulnerabilities.patch rename to patches/api/0017-Player-invulnerabilities.patch diff --git a/patches/api/0017-Anvil-API.patch b/patches/api/0018-Anvil-API.patch similarity index 100% rename from patches/api/0017-Anvil-API.patch rename to patches/api/0018-Anvil-API.patch diff --git a/patches/api/0018-ItemStack-convenience-methods.patch b/patches/api/0019-ItemStack-convenience-methods.patch similarity index 100% rename from patches/api/0018-ItemStack-convenience-methods.patch rename to patches/api/0019-ItemStack-convenience-methods.patch diff --git a/patches/api/0019-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch b/patches/api/0020-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch similarity index 100% rename from patches/api/0019-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch rename to patches/api/0020-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch diff --git a/patches/api/0020-ChatColor-conveniences.patch b/patches/api/0021-ChatColor-conveniences.patch similarity index 100% rename from patches/api/0020-ChatColor-conveniences.patch rename to patches/api/0021-ChatColor-conveniences.patch diff --git a/patches/api/0021-LivingEntity-broadcastItemBreak.patch b/patches/api/0022-LivingEntity-broadcastItemBreak.patch similarity index 100% rename from patches/api/0021-LivingEntity-broadcastItemBreak.patch rename to patches/api/0022-LivingEntity-broadcastItemBreak.patch diff --git a/patches/api/0022-Item-entity-immunities.patch b/patches/api/0023-Item-entity-immunities.patch similarity index 100% rename from patches/api/0022-Item-entity-immunities.patch rename to patches/api/0023-Item-entity-immunities.patch diff --git a/patches/api/0023-Spigot-Improve-output-of-plugins-command.patch b/patches/api/0024-Spigot-Improve-output-of-plugins-command.patch similarity index 100% rename from patches/api/0023-Spigot-Improve-output-of-plugins-command.patch rename to patches/api/0024-Spigot-Improve-output-of-plugins-command.patch diff --git a/patches/api/0024-Add-option-to-disable-zombie-aggressiveness-towards-.patch b/patches/api/0025-Add-option-to-disable-zombie-aggressiveness-towards-.patch similarity index 100% rename from patches/api/0024-Add-option-to-disable-zombie-aggressiveness-towards-.patch rename to patches/api/0025-Add-option-to-disable-zombie-aggressiveness-towards-.patch diff --git a/patches/api/0025-Add-predicate-to-recipe-s-ExactChoice-ingredient.patch b/patches/api/0026-Add-predicate-to-recipe-s-ExactChoice-ingredient.patch similarity index 100% rename from patches/api/0025-Add-predicate-to-recipe-s-ExactChoice-ingredient.patch rename to patches/api/0026-Add-predicate-to-recipe-s-ExactChoice-ingredient.patch diff --git a/patches/api/0026-Alphabetize-in-game-plugins-list.patch b/patches/api/0027-Alphabetize-in-game-plugins-list.patch similarity index 100% rename from patches/api/0026-Alphabetize-in-game-plugins-list.patch rename to patches/api/0027-Alphabetize-in-game-plugins-list.patch diff --git a/patches/api/0027-Rabid-Wolf-API.patch b/patches/api/0028-Rabid-Wolf-API.patch similarity index 100% rename from patches/api/0027-Rabid-Wolf-API.patch rename to patches/api/0028-Rabid-Wolf-API.patch diff --git a/patches/api/0028-PlayerBookTooLargeEvent.patch b/patches/api/0029-PlayerBookTooLargeEvent.patch similarity index 100% rename from patches/api/0028-PlayerBookTooLargeEvent.patch rename to patches/api/0029-PlayerBookTooLargeEvent.patch diff --git a/patches/api/0029-Full-netherite-armor-grants-fire-resistance.patch b/patches/api/0030-Full-netherite-armor-grants-fire-resistance.patch similarity index 100% rename from patches/api/0029-Full-netherite-armor-grants-fire-resistance.patch rename to patches/api/0030-Full-netherite-armor-grants-fire-resistance.patch diff --git a/patches/api/0030-Add-EntityTeleportHinderedEvent.patch b/patches/api/0031-Add-EntityTeleportHinderedEvent.patch similarity index 100% rename from patches/api/0030-Add-EntityTeleportHinderedEvent.patch rename to patches/api/0031-Add-EntityTeleportHinderedEvent.patch diff --git a/patches/api/0031-Add-enchantment-target-for-bows-and-crossbows.patch b/patches/api/0032-Add-enchantment-target-for-bows-and-crossbows.patch similarity index 100% rename from patches/api/0031-Add-enchantment-target-for-bows-and-crossbows.patch rename to patches/api/0032-Add-enchantment-target-for-bows-and-crossbows.patch diff --git a/patches/api/0032-Iron-golem-poppy-calms-anger.patch b/patches/api/0033-Iron-golem-poppy-calms-anger.patch similarity index 100% rename from patches/api/0032-Iron-golem-poppy-calms-anger.patch rename to patches/api/0033-Iron-golem-poppy-calms-anger.patch diff --git a/patches/api/0033-API-for-any-mob-to-burn-daylight.patch b/patches/api/0034-API-for-any-mob-to-burn-daylight.patch similarity index 100% rename from patches/api/0033-API-for-any-mob-to-burn-daylight.patch rename to patches/api/0034-API-for-any-mob-to-burn-daylight.patch diff --git a/patches/api/0034-Flying-Fall-Damage-API.patch b/patches/api/0035-Flying-Fall-Damage-API.patch similarity index 100% rename from patches/api/0034-Flying-Fall-Damage-API.patch rename to patches/api/0035-Flying-Fall-Damage-API.patch diff --git a/patches/api/0035-Add-back-player-spawned-endermite-API.patch b/patches/api/0036-Add-back-player-spawned-endermite-API.patch similarity index 100% rename from patches/api/0035-Add-back-player-spawned-endermite-API.patch rename to patches/api/0036-Add-back-player-spawned-endermite-API.patch diff --git a/patches/api/0036-Fix-default-permission-system.patch b/patches/api/0037-Fix-default-permission-system.patch similarity index 100% rename from patches/api/0036-Fix-default-permission-system.patch rename to patches/api/0037-Fix-default-permission-system.patch diff --git a/patches/api/0037-Summoner-API.patch b/patches/api/0038-Summoner-API.patch similarity index 100% rename from patches/api/0037-Summoner-API.patch rename to patches/api/0038-Summoner-API.patch diff --git a/patches/api/0038-Clean-up-version-command-output.patch b/patches/api/0039-Clean-up-version-command-output.patch similarity index 100% rename from patches/api/0038-Clean-up-version-command-output.patch rename to patches/api/0039-Clean-up-version-command-output.patch diff --git a/patches/api/0039-Extended-OfflinePlayer-API.patch b/patches/api/0040-Extended-OfflinePlayer-API.patch similarity index 100% rename from patches/api/0039-Extended-OfflinePlayer-API.patch rename to patches/api/0040-Extended-OfflinePlayer-API.patch diff --git a/patches/api/0040-Added-the-ability-to-add-combustible-items.patch b/patches/api/0041-Added-the-ability-to-add-combustible-items.patch similarity index 100% rename from patches/api/0040-Added-the-ability-to-add-combustible-items.patch rename to patches/api/0041-Added-the-ability-to-add-combustible-items.patch diff --git a/patches/api/0041-Potion-NamespacedKey.patch b/patches/api/0042-Potion-NamespacedKey.patch similarity index 100% rename from patches/api/0041-Potion-NamespacedKey.patch rename to patches/api/0042-Potion-NamespacedKey.patch diff --git a/patches/api/0042-Grindstone-API.patch b/patches/api/0043-Grindstone-API.patch similarity index 100% rename from patches/api/0042-Grindstone-API.patch rename to patches/api/0043-Grindstone-API.patch diff --git a/patches/api/0043-Shears-can-have-looting-enchantment.patch b/patches/api/0044-Shears-can-have-looting-enchantment.patch similarity index 100% rename from patches/api/0043-Shears-can-have-looting-enchantment.patch rename to patches/api/0044-Shears-can-have-looting-enchantment.patch diff --git a/patches/api/0044-Lobotomize-stuck-villagers.patch b/patches/api/0045-Lobotomize-stuck-villagers.patch similarity index 100% rename from patches/api/0044-Lobotomize-stuck-villagers.patch rename to patches/api/0045-Lobotomize-stuck-villagers.patch diff --git a/patches/api/0045-Spark-Profiler.patch b/patches/api/0046-Spark-Profiler.patch similarity index 92% rename from patches/api/0045-Spark-Profiler.patch rename to patches/api/0046-Spark-Profiler.patch index 592a33213..b86e87503 100644 --- a/patches/api/0045-Spark-Profiler.patch +++ b/patches/api/0046-Spark-Profiler.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Spark Profiler diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index b012ce40d82389c29d1b841ff685425ac10a7f9e..653961e083aec13c1551be5439ad73bbe7540bab 100644 +index c077e7c883613fcb6e559b4e4776e794caa3b363..75be5cdfeb30732975bbc38dc7aab52a0cdead9c 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java @@ -167,6 +167,12 @@ public final class SimplePluginManager implements PluginManager { diff --git a/patches/api/0046-Add-local-difficulty-api.patch b/patches/api/0047-Add-local-difficulty-api.patch similarity index 100% rename from patches/api/0046-Add-local-difficulty-api.patch rename to patches/api/0047-Add-local-difficulty-api.patch diff --git a/patches/api/0047-Remove-Timings.patch b/patches/api/0048-Remove-Timings.patch similarity index 100% rename from patches/api/0047-Remove-Timings.patch rename to patches/api/0048-Remove-Timings.patch diff --git a/patches/api/0048-Add-Bee-API.patch b/patches/api/0049-Add-Bee-API.patch similarity index 100% rename from patches/api/0048-Add-Bee-API.patch rename to patches/api/0049-Add-Bee-API.patch diff --git a/patches/api/0049-Debug-Marker-API.patch b/patches/api/0050-Debug-Marker-API.patch similarity index 100% rename from patches/api/0049-Debug-Marker-API.patch rename to patches/api/0050-Debug-Marker-API.patch diff --git a/patches/api/0050-add-Player-showCreditScreen.patch b/patches/api/0051-add-Player-showCreditScreen.patch similarity index 100% rename from patches/api/0050-add-Player-showCreditScreen.patch rename to patches/api/0051-add-Player-showCreditScreen.patch diff --git a/patches/api/0051-Add-death-screen-API.patch b/patches/api/0052-Add-death-screen-API.patch similarity index 100% rename from patches/api/0051-Add-death-screen-API.patch rename to patches/api/0052-Add-death-screen-API.patch diff --git a/patches/api/0052-Add-item-packet-serialize-event.patch b/patches/api/0053-Add-item-packet-serialize-event.patch similarity index 100% rename from patches/api/0052-Add-item-packet-serialize-event.patch rename to patches/api/0053-Add-item-packet-serialize-event.patch diff --git a/patches/api/0053-Language-API.patch b/patches/api/0054-Language-API.patch similarity index 100% rename from patches/api/0053-Language-API.patch rename to patches/api/0054-Language-API.patch diff --git a/patches/api/0054-Add-log-suppression-for-LibraryLoader.patch b/patches/api/0055-Add-log-suppression-for-LibraryLoader.patch similarity index 96% rename from patches/api/0054-Add-log-suppression-for-LibraryLoader.patch rename to patches/api/0055-Add-log-suppression-for-LibraryLoader.patch index 3917bb8a4..c6841bce3 100644 --- a/patches/api/0054-Add-log-suppression-for-LibraryLoader.patch +++ b/patches/api/0055-Add-log-suppression-for-LibraryLoader.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add log suppression for LibraryLoader diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 7e5149a21b6747f64425a277c142e69f0ef43b3f..bde06934a397ca2305407d5f23617efd02d361ac 100644 +index bf93183aa76af005d5daf8cf533f908d535166e8..d7ac5d5bb6180f97706be9c5ef25956f244bc376 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -58,6 +58,7 @@ public final class JavaPluginLoader implements PluginLoader { diff --git a/patches/api/0055-Fire-Immunity-API.patch b/patches/api/0056-Fire-Immunity-API.patch similarity index 100% rename from patches/api/0055-Fire-Immunity-API.patch rename to patches/api/0056-Fire-Immunity-API.patch diff --git a/patches/api/0056-Added-goat-ram-event.patch b/patches/api/0057-Added-goat-ram-event.patch similarity index 100% rename from patches/api/0056-Added-goat-ram-event.patch rename to patches/api/0057-Added-goat-ram-event.patch diff --git a/patches/server/0001-Pufferfish-Server-Changes.patch b/patches/server/0001-Pufferfish-Server-Changes.patch new file mode 100644 index 000000000..8919972bf --- /dev/null +++ b/patches/server/0001-Pufferfish-Server-Changes.patch @@ -0,0 +1,3665 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kevin Raneri +Date: Wed, 3 Feb 2021 23:02:38 -0600 +Subject: [PATCH] Pufferfish Server Changes + +Pufferfish +Copyright (C) 2022 Pufferfish Studios LLC + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +diff --git a/build.gradle.kts b/build.gradle.kts +index d5d49bb2b47c889e12d17dc87b8c439a60b3fe67..5752339f2d081c36944d568e0b29ec4fe24f37f9 100644 +--- a/build.gradle.kts ++++ b/build.gradle.kts +@@ -7,8 +7,12 @@ plugins { + } + + dependencies { +- implementation(project(":paper-api")) +- implementation(project(":paper-mojangapi")) ++ implementation(project(":pufferfish-api")) // Pufferfish // Paper ++ // Pufferfish start ++ implementation("io.papermc.paper:paper-mojangapi:1.19.2-R0.1-SNAPSHOT") { ++ exclude("io.papermc.paper", "paper-api") ++ } ++ // Pufferfish end + // Paper start + implementation("org.jline:jline-terminal-jansi:3.21.0") + implementation("net.minecrell:terminalconsoleappender:1.3.0") +@@ -41,6 +45,13 @@ dependencies { + runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3") + runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3") + ++ // Pufferfish start ++ implementation("org.yaml:snakeyaml:1.32") ++ implementation ("me.carleslc.Simple-YAML:Simple-Yaml:1.8.2") { ++ exclude(group="org.yaml", module="snakeyaml") ++ } ++ // Pufferfish end ++ + testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test + testImplementation("junit:junit:4.13.2") + testImplementation("org.hamcrest:hamcrest-library:1.3") +@@ -49,6 +60,14 @@ dependencies { + } + + val craftbukkitPackageVersion = "1_19_R2" // Paper ++ ++// Pufferfish Start ++tasks.withType { ++ val compilerArgs = options.compilerArgs ++ compilerArgs.add("--add-modules=jdk.incubator.vector") ++} ++// Pufferfish End ++ + tasks.jar { + archiveClassifier.set("dev") + +@@ -61,7 +80,7 @@ tasks.jar { + attributes( + "Main-Class" to "org.bukkit.craftbukkit.Main", + "Implementation-Title" to "CraftBukkit", +- "Implementation-Version" to "git-Paper-$implementationVersion", ++ "Implementation-Version" to "git-Pufferfish-$implementationVersion", // Pufferfish + "Implementation-Vendor" to date, // Paper + "Specification-Title" to "Bukkit", + "Specification-Version" to project.version, +diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java +index 06bff37e4c1fddd3be6343049a66787c63fb420c..2cc44fbf8e5bd436b6d4e19f6c06b351e750cb31 100644 +--- a/src/main/java/co/aikar/timings/TimingsExport.java ++++ b/src/main/java/co/aikar/timings/TimingsExport.java +@@ -241,7 +241,8 @@ public class TimingsExport extends Thread { + parent.put("config", createObject( + pair("spigot", mapAsJSON(Bukkit.spigot().getSpigotConfig(), null)), + pair("bukkit", mapAsJSON(Bukkit.spigot().getBukkitConfig(), null)), +- pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null)) ++ pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null)), // Pufferfish ++ pair("pufferfish", mapAsJSON(gg.pufferfish.pufferfish.PufferfishConfig.getConfigCopy(), null)) // Pufferfish + )); + + new TimingsExport(listeners, parent, history).start(); +diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java +index 7b1843e16745ca8db2244e17490d291401f22679..061716934ba0a1f01e4d85d664034f72b3c7a765 100644 +--- a/src/main/java/com/destroystokyo/paper/Metrics.java ++++ b/src/main/java/com/destroystokyo/paper/Metrics.java +@@ -593,7 +593,7 @@ public class Metrics { + boolean logFailedRequests = config.getBoolean("logFailedRequests", false); + // Only start Metrics, if it's enabled in the config + if (config.getBoolean("enabled", true)) { +- Metrics metrics = new Metrics("Paper", serverUUID, logFailedRequests, Bukkit.getLogger()); ++ Metrics metrics = new Metrics("Pufferfish", serverUUID, logFailedRequests, Bukkit.getLogger()); // Pufferfish + + metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> { + String minecraftVersion = Bukkit.getVersion(); +@@ -603,7 +603,7 @@ public class Metrics { + + metrics.addCustomChart(new Metrics.SingleLineChart("players", () -> Bukkit.getOnlinePlayers().size())); + metrics.addCustomChart(new Metrics.SimplePie("online_mode", () -> Bukkit.getOnlineMode() ? "online" : "offline")); +- metrics.addCustomChart(new Metrics.SimplePie("paper_version", () -> (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown")); ++ metrics.addCustomChart(new Metrics.SimplePie("pufferfish_version", () -> (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown")); + + metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> { + Map> map = new HashMap<>(); +diff --git a/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java +index 41b9405d6759d865e0d14dd4f95163e9690e967d..091b1ae822e1c0517e59572e7a9bda11e998c0ee 100644 +--- a/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java ++++ b/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java +@@ -26,7 +26,7 @@ public abstract class AreaMap { + + // we use linked for better iteration. + // map of: coordinate to set of objects in coordinate +- protected final Long2ObjectOpenHashMap> areaMap = new Long2ObjectOpenHashMap<>(1024, 0.7f); ++ protected Long2ObjectOpenHashMap> areaMap = new Long2ObjectOpenHashMap<>(1024, 0.7f); // Pufferfish - not actually final + protected final PooledLinkedHashSets pooledHashSets; + + protected final ChangeCallback addCallback; +@@ -160,7 +160,8 @@ public abstract class AreaMap { + protected abstract PooledLinkedHashSets.PooledObjectLinkedOpenHashSet getEmptySetFor(final E object); + + // expensive op, only for debug +- protected void validate(final E object, final int viewDistance) { ++ protected void validate0(final E object, final int viewDistance) { // Pufferfish - rename this thing just in case it gets used I'd rather a compile time error. ++ if (true) throw new UnsupportedOperationException(); // Pufferfish - not going to put in the effort to fix this if it doesn't ever get used. + int entiesGot = 0; + int expectedEntries = (2 * viewDistance + 1); + expectedEntries *= expectedEntries; +diff --git a/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java +index 46954db7ecd35ac4018fdf476df7c8020d7ce6c8..1ad890a244bdf6df48a8db68cb43450e08c788a6 100644 +--- a/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java ++++ b/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java +@@ -5,7 +5,7 @@ import net.minecraft.server.level.ServerPlayer; + /** + * @author Spottedleaf + */ +-public final class PlayerAreaMap extends AreaMap { ++public class PlayerAreaMap extends AreaMap { // Pufferfish - not actually final + + public PlayerAreaMap() { + super(); +diff --git a/src/main/java/gg/airplane/structs/FluidDirectionCache.java b/src/main/java/gg/airplane/structs/FluidDirectionCache.java +new file mode 100644 +index 0000000000000000000000000000000000000000..aa8467b9dda1f7707e41f50ac7b3e9d7343723ec +--- /dev/null ++++ b/src/main/java/gg/airplane/structs/FluidDirectionCache.java +@@ -0,0 +1,136 @@ ++package gg.airplane.structs; ++ ++import it.unimi.dsi.fastutil.HashCommon; ++ ++/** ++ * This is a replacement for the cache used in FluidTypeFlowing. ++ * The requirements for the previous cache were: ++ * - Store 200 entries ++ * - Look for the flag in the cache ++ * - If it exists, move to front of cache ++ * - If it doesn't exist, remove last entry in cache and insert in front ++ * ++ * This class accomplishes something similar, however has a few different ++ * requirements put into place to make this more optimize: ++ * ++ * - maxDistance is the most amount of entries to be checked, instead ++ * of having to check the entire list. ++ * - In combination with that, entries are all tracked by age and how ++ * frequently they're used. This enables us to remove old entries, ++ * without constantly shifting any around. ++ * ++ * Usage of the previous map would have to reset the head every single usage, ++ * shifting the entire map. Here, nothing happens except an increment when ++ * the cache is hit, and when it needs to replace an old element only a single ++ * element is modified. ++ */ ++public class FluidDirectionCache { ++ ++ private static class FluidDirectionEntry { ++ private final T data; ++ private final boolean flag; ++ private int uses = 0; ++ private int age = 0; ++ ++ private FluidDirectionEntry(T data, boolean flag) { ++ this.data = data; ++ this.flag = flag; ++ } ++ ++ public int getValue() { ++ return this.uses - (this.age >> 1); // age isn't as important as uses ++ } ++ ++ public void incrementUses() { ++ this.uses = this.uses + 1 & Integer.MAX_VALUE; ++ } ++ ++ public void incrementAge() { ++ this.age = this.age + 1 & Integer.MAX_VALUE; ++ } ++ } ++ ++ private final FluidDirectionEntry[] entries; ++ private final int mask; ++ private final int maxDistance; // the most amount of entries to check for a value ++ ++ public FluidDirectionCache(int size) { ++ int arraySize = HashCommon.nextPowerOfTwo(size); ++ this.entries = new FluidDirectionEntry[arraySize]; ++ this.mask = arraySize - 1; ++ this.maxDistance = Math.min(arraySize, 4); ++ } ++ ++ public Boolean getValue(T data) { ++ FluidDirectionEntry curr; ++ int pos; ++ ++ if ((curr = this.entries[pos = HashCommon.mix(data.hashCode()) & this.mask]) == null) { ++ return null; ++ } else if (data.equals(curr.data)) { ++ curr.incrementUses(); ++ return curr.flag; ++ } ++ ++ int checked = 1; // start at 1 because we already checked the first spot above ++ ++ while ((curr = this.entries[pos = (pos + 1) & this.mask]) != null) { ++ if (data.equals(curr.data)) { ++ curr.incrementUses(); ++ return curr.flag; ++ } else if (++checked >= this.maxDistance) { ++ break; ++ } ++ } ++ ++ return null; ++ } ++ ++ public void putValue(T data, boolean flag) { ++ FluidDirectionEntry curr; ++ int pos; ++ ++ if ((curr = this.entries[pos = HashCommon.mix(data.hashCode()) & this.mask]) == null) { ++ this.entries[pos] = new FluidDirectionEntry<>(data, flag); // add ++ return; ++ } else if (data.equals(curr.data)) { ++ curr.incrementUses(); ++ return; ++ } ++ ++ int checked = 1; // start at 1 because we already checked the first spot above ++ ++ while ((curr = this.entries[pos = (pos + 1) & this.mask]) != null) { ++ if (data.equals(curr.data)) { ++ curr.incrementUses(); ++ return; ++ } else if (++checked >= this.maxDistance) { ++ this.forceAdd(data, flag); ++ return; ++ } ++ } ++ ++ this.entries[pos] = new FluidDirectionEntry<>(data, flag); // add ++ } ++ ++ private void forceAdd(T data, boolean flag) { ++ int expectedPos = HashCommon.mix(data.hashCode()) & this.mask; ++ ++ int toRemovePos = expectedPos; ++ FluidDirectionEntry entryToRemove = this.entries[toRemovePos]; ++ ++ for (int i = expectedPos + 1; i < expectedPos + this.maxDistance; i++) { ++ int pos = i & this.mask; ++ FluidDirectionEntry entry = this.entries[pos]; ++ if (entry.getValue() < entryToRemove.getValue()) { ++ toRemovePos = pos; ++ entryToRemove = entry; ++ } ++ ++ entry.incrementAge(); // use this as a mechanism to age the other entries ++ } ++ ++ // remove the least used/oldest entry ++ this.entries[toRemovePos] = new FluidDirectionEntry(data, flag); ++ } ++} +diff --git a/src/main/java/gg/airplane/structs/ItemListWithBitset.java b/src/main/java/gg/airplane/structs/ItemListWithBitset.java +new file mode 100644 +index 0000000000000000000000000000000000000000..1b7a4ee47f4445d7f2ac91d3a73ae113edbdddb2 +--- /dev/null ++++ b/src/main/java/gg/airplane/structs/ItemListWithBitset.java +@@ -0,0 +1,114 @@ ++package gg.airplane.structs; ++ ++import net.minecraft.core.NonNullList; ++import net.minecraft.world.item.ItemStack; ++import org.apache.commons.lang.Validate; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++import java.util.AbstractList; ++import java.util.Arrays; ++import java.util.List; ++ ++public class ItemListWithBitset extends AbstractList { ++ public static ItemListWithBitset fromList(List list) { ++ if (list instanceof ItemListWithBitset ours) { ++ return ours; ++ } ++ return new ItemListWithBitset(list); ++ } ++ ++ private static ItemStack[] createArray(int size) { ++ ItemStack[] array = new ItemStack[size]; ++ Arrays.fill(array, ItemStack.EMPTY); ++ return array; ++ } ++ ++ private final ItemStack[] items; ++ ++ private long bitSet = 0; ++ private final long allBits; ++ ++ private static class OurNonNullList extends NonNullList { ++ protected OurNonNullList(List delegate) { ++ super(delegate, ItemStack.EMPTY); ++ } ++ } ++ ++ public final NonNullList nonNullList = new OurNonNullList(this); ++ ++ private ItemListWithBitset(List list) { ++ this(list.size()); ++ ++ for (int i = 0; i < list.size(); i++) { ++ this.set(i, list.get(i)); ++ } ++ } ++ ++ public ItemListWithBitset(int size) { ++ Validate.isTrue(size < Long.BYTES * 8, "size is too large"); ++ ++ this.items = createArray(size); ++ this.allBits = ((1L << size) - 1); ++ } ++ ++ public boolean isCompletelyEmpty() { ++ return this.bitSet == 0; ++ } ++ ++ public boolean hasFullStacks() { ++ return (this.bitSet & this.allBits) == allBits; ++ } ++ ++ @Override ++ public ItemStack set(int index, @NotNull ItemStack itemStack) { ++ ItemStack existing = this.items[index]; ++ ++ this.items[index] = itemStack; ++ ++ if (itemStack == ItemStack.EMPTY) { ++ this.bitSet &= ~(1L << index); ++ } else { ++ this.bitSet |= 1L << index; ++ } ++ ++ return existing; ++ } ++ ++ @NotNull ++ @Override ++ public ItemStack get(int var0) { ++ return this.items[var0]; ++ } ++ ++ @Override ++ public int size() { ++ return this.items.length; ++ } ++ ++ @Override ++ public void clear() { ++ Arrays.fill(this.items, ItemStack.EMPTY); ++ } ++ ++ // these are unsupported for block inventories which have a static size ++ @Override ++ public void add(int var0, ItemStack var1) { ++ throw new UnsupportedOperationException(); ++ } ++ ++ @Override ++ public ItemStack remove(int var0) { ++ throw new UnsupportedOperationException(); ++ } ++ ++ @Override ++ public String toString() { ++ return "ItemListWithBitset{" + ++ "items=" + Arrays.toString(items) + ++ ", bitSet=" + Long.toString(bitSet, 2) + ++ ", allBits=" + Long.toString(allBits, 2) + ++ ", size=" + this.items.length + ++ '}'; ++ } ++} +diff --git a/src/main/java/gg/airplane/structs/Long2FloatAgingCache.java b/src/main/java/gg/airplane/structs/Long2FloatAgingCache.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a7f297ebb569f7c1f205e967ca485be70013a714 +--- /dev/null ++++ b/src/main/java/gg/airplane/structs/Long2FloatAgingCache.java +@@ -0,0 +1,119 @@ ++package gg.airplane.structs; ++ ++import it.unimi.dsi.fastutil.HashCommon; ++ ++/** ++ * A replacement for the cache used in Biome. ++ */ ++public class Long2FloatAgingCache { ++ ++ private static class AgingEntry { ++ private long data; ++ private float value; ++ private int uses = 0; ++ private int age = 0; ++ ++ private AgingEntry(long data, float value) { ++ this.data = data; ++ this.value = value; ++ } ++ ++ public void replace(long data, float flag) { ++ this.data = data; ++ this.value = flag; ++ } ++ ++ public int getValue() { ++ return this.uses - (this.age >> 1); // age isn't as important as uses ++ } ++ ++ public void incrementUses() { ++ this.uses = this.uses + 1 & Integer.MAX_VALUE; ++ } ++ ++ public void incrementAge() { ++ this.age = this.age + 1 & Integer.MAX_VALUE; ++ } ++ } ++ ++ private final AgingEntry[] entries; ++ private final int mask; ++ private final int maxDistance; // the most amount of entries to check for a value ++ ++ public Long2FloatAgingCache(int size) { ++ int arraySize = HashCommon.nextPowerOfTwo(size); ++ this.entries = new AgingEntry[arraySize]; ++ this.mask = arraySize - 1; ++ this.maxDistance = Math.min(arraySize, 4); ++ } ++ ++ public float getValue(long data) { ++ AgingEntry curr; ++ int pos; ++ ++ if ((curr = this.entries[pos = HashCommon.mix(HashCommon.long2int(data)) & this.mask]) == null) { ++ return Float.NaN; ++ } else if (data == curr.data) { ++ curr.incrementUses(); ++ return curr.value; ++ } ++ ++ int checked = 1; // start at 1 because we already checked the first spot above ++ ++ while ((curr = this.entries[pos = (pos + 1) & this.mask]) != null) { ++ if (data == curr.data) { ++ curr.incrementUses(); ++ return curr.value; ++ } else if (++checked >= this.maxDistance) { ++ break; ++ } ++ } ++ ++ return Float.NaN; ++ } ++ ++ public void putValue(long data, float value) { ++ AgingEntry curr; ++ int pos; ++ ++ if ((curr = this.entries[pos = HashCommon.mix(HashCommon.long2int(data)) & this.mask]) == null) { ++ this.entries[pos] = new AgingEntry(data, value); // add ++ return; ++ } else if (data == curr.data) { ++ curr.incrementUses(); ++ return; ++ } ++ ++ int checked = 1; // start at 1 because we already checked the first spot above ++ ++ while ((curr = this.entries[pos = (pos + 1) & this.mask]) != null) { ++ if (data == curr.data) { ++ curr.incrementUses(); ++ return; ++ } else if (++checked >= this.maxDistance) { ++ this.forceAdd(data, value); ++ return; ++ } ++ } ++ ++ this.entries[pos] = new AgingEntry(data, value); // add ++ } ++ ++ private void forceAdd(long data, float value) { ++ int expectedPos = HashCommon.mix(HashCommon.long2int(data)) & this.mask; ++ AgingEntry entryToRemove = this.entries[expectedPos]; ++ ++ for (int i = expectedPos + 1; i < expectedPos + this.maxDistance; i++) { ++ int pos = i & this.mask; ++ AgingEntry entry = this.entries[pos]; ++ if (entry.getValue() < entryToRemove.getValue()) { ++ entryToRemove = entry; ++ } ++ ++ entry.incrementAge(); // use this as a mechanism to age the other entries ++ } ++ ++ // remove the least used/oldest entry ++ entryToRemove.replace(data, value); ++ } ++} +diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishCommand.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishCommand.java +new file mode 100644 +index 0000000000000000000000000000000000000000..020368da69b9a492155f6de6297f74732f4ab6ea +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishCommand.java +@@ -0,0 +1,68 @@ ++package gg.pufferfish.pufferfish; ++ ++import java.io.IOException; ++import java.util.Collections; ++import java.util.List; ++import java.util.stream.Collectors; ++import java.util.stream.Stream; ++import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.format.NamedTextColor; ++import net.md_5.bungee.api.ChatColor; ++import net.minecraft.server.MinecraftServer; ++import org.bukkit.Bukkit; ++import org.bukkit.Location; ++import org.bukkit.command.Command; ++import org.bukkit.command.CommandSender; ++ ++public class PufferfishCommand extends Command { ++ ++ public PufferfishCommand() { ++ super("pufferfish"); ++ this.description = "Pufferfish related commands"; ++ this.usageMessage = "/pufferfish [reload | version]"; ++ this.setPermission("bukkit.command.pufferfish"); ++ } ++ ++ public static void init() { ++ MinecraftServer.getServer().server.getCommandMap().register("pufferfish", "Pufferfish", new PufferfishCommand()); ++ } ++ ++ @Override ++ public List tabComplete(CommandSender sender, String alias, String[] args, Location location) throws IllegalArgumentException { ++ if (args.length == 1) { ++ return Stream.of("reload", "version") ++ .filter(arg -> arg.startsWith(args[0].toLowerCase())) ++ .collect(Collectors.toList()); ++ } ++ return Collections.emptyList(); ++ } ++ ++ @Override ++ public boolean execute(CommandSender sender, String commandLabel, String[] args) { ++ if (!testPermission(sender)) return true; ++ String prefix = ChatColor.of("#12fff6") + "" + ChatColor.BOLD + "Pufferfish ยป " + ChatColor.of("#e8f9f9"); ++ ++ if (args.length != 1) { ++ sender.sendMessage(prefix + "Usage: " + usageMessage); ++ args = new String[]{"version"}; ++ } ++ ++ if (args[0].equalsIgnoreCase("reload")) { ++ MinecraftServer console = MinecraftServer.getServer(); ++ try { ++ PufferfishConfig.load(); ++ } catch (IOException e) { ++ sender.sendMessage(Component.text("Failed to reload.", NamedTextColor.RED)); ++ e.printStackTrace(); ++ return true; ++ } ++ console.server.reloadCount++; ++ ++ Command.broadcastCommandMessage(sender, prefix + "Pufferfish configuration has been reloaded."); ++ } else if (args[0].equalsIgnoreCase("version")) { ++ Command.broadcastCommandMessage(sender, prefix + "This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")"); ++ } ++ ++ return true; ++ } ++} +diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java +new file mode 100644 +index 0000000000000000000000000000000000000000..4232585ab3048dcfd934569beca2f2f21d95f382 +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java +@@ -0,0 +1,283 @@ ++package gg.pufferfish.pufferfish; ++ ++import gg.pufferfish.pufferfish.simd.SIMDDetection; ++import java.io.File; ++import java.io.IOException; ++import java.util.Collections; ++import net.minecraft.core.registries.BuiltInRegistries; ++import java.util.Locale; ++import java.util.Map; ++import net.minecraft.server.MinecraftServer; ++import net.minecraft.tags.TagKey; ++import org.apache.logging.log4j.Level; ++import org.bukkit.configuration.ConfigurationSection; ++import net.minecraft.world.entity.EntityType; ++import java.lang.reflect.Method; ++import java.lang.reflect.Modifier; ++import java.util.List; ++import net.minecraft.server.MinecraftServer; ++import org.apache.logging.log4j.Level; ++import org.bukkit.configuration.ConfigurationSection; ++import org.bukkit.configuration.MemoryConfiguration; ++import org.jetbrains.annotations.Nullable; ++import org.simpleyaml.configuration.comments.CommentType; ++import org.simpleyaml.configuration.file.YamlFile; ++import org.simpleyaml.exceptions.InvalidConfigurationException; ++ ++public class PufferfishConfig { ++ ++ private static final YamlFile config = new YamlFile(); ++ private static int updates = 0; ++ ++ private static ConfigurationSection convertToBukkit(org.simpleyaml.configuration.ConfigurationSection section) { ++ ConfigurationSection newSection = new MemoryConfiguration(); ++ for (String key : section.getKeys(false)) { ++ if (section.isConfigurationSection(key)) { ++ newSection.set(key, convertToBukkit(section.getConfigurationSection(key))); ++ } else { ++ newSection.set(key, section.get(key)); ++ } ++ } ++ return newSection; ++ } ++ ++ public static ConfigurationSection getConfigCopy() { ++ return convertToBukkit(config); ++ } ++ ++ public static int getUpdates() { ++ return updates; ++ } ++ ++ public static void load() throws IOException { ++ File configFile = new File("pufferfish.yml"); ++ ++ if (configFile.exists()) { ++ try { ++ config.load(configFile); ++ } catch (InvalidConfigurationException e) { ++ throw new IOException(e); ++ } ++ } ++ ++ getString("info.version", "1.0"); ++ setComment("info", ++ "Pufferfish Configuration", ++ "Check out Pufferfish Host for maximum performance server hosting: https://pufferfish.host", ++ "Join our Discord for support: https://discord.gg/reZw4vQV9H", ++ "Download new builds at https://ci.pufferfish.host/job/Pufferfish"); ++ ++ for (Method method : PufferfishConfig.class.getDeclaredMethods()) { ++ if (Modifier.isStatic(method.getModifiers()) && Modifier.isPrivate(method.getModifiers()) && method.getParameterCount() == 0 && ++ method.getReturnType() == Void.TYPE && !method.getName().startsWith("lambda")) { ++ method.setAccessible(true); ++ try { ++ method.invoke(null); ++ } catch (Throwable t) { ++ MinecraftServer.LOGGER.warn("Failed to load configuration option from " + method.getName(), t); ++ } ++ } ++ } ++ ++ updates++; ++ ++ config.save(configFile); ++ ++ // Attempt to detect vectorization ++ try { ++ SIMDDetection.isEnabled = SIMDDetection.canEnable(PufferfishLogger.LOGGER); ++ SIMDDetection.versionLimited = SIMDDetection.getJavaVersion() != 17 && SIMDDetection.getJavaVersion() != 18; ++ } catch (NoClassDefFoundError | Exception ignored) {} ++ ++ if (SIMDDetection.isEnabled) { ++ PufferfishLogger.LOGGER.info("SIMD operations detected as functional. Will replace some operations with faster versions."); ++ } else if (SIMDDetection.versionLimited) { ++ PufferfishLogger.LOGGER.warning("Will not enable SIMD! These optimizations are only safely supported on Java 17 and Java 18."); ++ } else { ++ PufferfishLogger.LOGGER.warning("SIMD operations are available for your server, but are not configured!"); ++ PufferfishLogger.LOGGER.warning("To enable additional optimizations, add \"--add-modules=jdk.incubator.vector\" to your startup flags, BEFORE the \"-jar\"."); ++ PufferfishLogger.LOGGER.warning("If you have already added this flag, then SIMD operations are not supported on your JVM or CPU."); ++ PufferfishLogger.LOGGER.warning("Debug: Java: " + System.getProperty("java.version") + ", test run: " + SIMDDetection.testRun); ++ } ++ } ++ ++ private static void setComment(String key, String... comment) { ++ if (config.contains(key)) { ++ config.setComment(key, String.join("\n", comment), CommentType.BLOCK); ++ } ++ } ++ ++ private static void ensureDefault(String key, Object defaultValue, String... comment) { ++ if (!config.contains(key)) { ++ config.set(key, defaultValue); ++ config.setComment(key, String.join("\n", comment), CommentType.BLOCK); ++ } ++ } ++ ++ private static boolean getBoolean(String key, boolean defaultValue, String... comment) { ++ return getBoolean(key, null, defaultValue, comment); ++ } ++ ++ private static boolean getBoolean(String key, @Nullable String oldKey, boolean defaultValue, String... comment) { ++ ensureDefault(key, defaultValue, comment); ++ return config.getBoolean(key, defaultValue); ++ } ++ ++ private static int getInt(String key, int defaultValue, String... comment) { ++ return getInt(key, null, defaultValue, comment); ++ } ++ ++ private static int getInt(String key, @Nullable String oldKey, int defaultValue, String... comment) { ++ ensureDefault(key, defaultValue, comment); ++ return config.getInt(key, defaultValue); ++ } ++ ++ private static double getDouble(String key, double defaultValue, String... comment) { ++ return getDouble(key, null, defaultValue, comment); ++ } ++ ++ private static double getDouble(String key, @Nullable String oldKey, double defaultValue, String... comment) { ++ ensureDefault(key, defaultValue, comment); ++ return config.getDouble(key, defaultValue); ++ } ++ ++ private static String getString(String key, String defaultValue, String... comment) { ++ return getOldString(key, null, defaultValue, comment); ++ } ++ ++ private static String getOldString(String key, @Nullable String oldKey, String defaultValue, String... comment) { ++ ensureDefault(key, defaultValue, comment); ++ return config.getString(key, defaultValue); ++ } ++ ++ private static List getStringList(String key, List defaultValue, String... comment) { ++ return getStringList(key, null, defaultValue, comment); ++ } ++ ++ private static List getStringList(String key, @Nullable String oldKey, List defaultValue, String... comment) { ++ ensureDefault(key, defaultValue, comment); ++ return config.getStringList(key); ++ } ++ ++ public static String sentryDsn; ++ private static void sentry() { ++ String sentryEnvironment = System.getenv("SENTRY_DSN"); ++ String sentryConfig = getString("sentry-dsn", "", "Sentry DSN for improved error logging, leave blank to disable", "Obtain from https://sentry.io/"); ++ ++ sentryDsn = sentryEnvironment == null ? sentryConfig : sentryEnvironment; ++ if (sentryDsn != null && !sentryDsn.isBlank()) { ++ gg.pufferfish.pufferfish.sentry.SentryManager.init(); ++ } ++ } ++ ++ public static boolean enableBooks; ++ private static void books() { ++ enableBooks = getBoolean("enable-books", true, ++ "Whether or not books should be writeable.", ++ "Servers that anticipate being a target for duping may want to consider", ++ "disabling this option.", ++ "This can be overridden per-player with the permission pufferfish.usebooks"); ++ } ++ ++ public static boolean enableSuffocationOptimization; ++ private static void suffocationOptimization() { ++ enableSuffocationOptimization = getBoolean("enable-suffocation-optimization", true, ++ "Optimizes the suffocation check by selectively skipping", ++ "the check in a way that still appears vanilla. This should", ++ "be left enabled on most servers, but is provided as a", ++ "configuration option if the vanilla deviation is undesirable."); ++ } ++ ++ public static boolean enableAsyncMobSpawning; ++ public static boolean asyncMobSpawningInitialized; ++ private static void asyncMobSpawning() { ++ boolean temp = getBoolean("enable-async-mob-spawning", true, ++ "Whether or not asynchronous mob spawning should be enabled.", ++ "On servers with many entities, this can improve performance by up to 15%. You must have", ++ "paper's per-player-mob-spawns setting set to true for this to work.", ++ "One quick note - this does not actually spawn mobs async (that would be very unsafe).", ++ "This just offloads some expensive calculations that are required for mob spawning."); ++ ++ // This prevents us from changing the value during a reload. ++ if (!asyncMobSpawningInitialized) { ++ asyncMobSpawningInitialized = true; ++ enableAsyncMobSpawning = temp; ++ } ++ } ++ ++ public static int maxProjectileLoadsPerTick; ++ public static int maxProjectileLoadsPerProjectile; ++ private static void projectileLoading() { ++ maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick."); ++ maxProjectileLoadsPerProjectile = getInt("projectile.max-loads-per-projectile", 10, "Controls how many chunks a projectile", "can load in its lifetime before it gets", "automatically removed."); ++ ++ setComment("projectile", "Optimizes projectile settings"); ++ } ++ ++ ++ public static boolean dearEnabled; ++ public static int startDistance; ++ public static int startDistanceSquared; ++ public static int maximumActivationPrio; ++ public static int activationDistanceMod; ++ ++ private static void dynamicActivationOfBrains() throws IOException { ++ dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", true); ++ startDistance = getInt("dab.start-distance", "activation-range.start-distance", 12, ++ "This value determines how far away an entity has to be", ++ "from the player to start being effected by DEAR."); ++ startDistanceSquared = startDistance * startDistance; ++ maximumActivationPrio = getInt("dab.max-tick-freq", "activation-range.max-tick-freq", 20, ++ "This value defines how often in ticks, the furthest entity", ++ "will get their pathfinders and behaviors ticked. 20 = 1s"); ++ activationDistanceMod = getInt("dab.activation-dist-mod", "activation-range.activation-dist-mod", 8, ++ "This value defines how much distance modifies an entity's", ++ "tick frequency. freq = (distanceToPlayer^2) / (2^value)", ++ "If you want further away entities to tick less often, use 7.", ++ "If you want further away entities to tick more often, try 9."); ++ ++ for (EntityType entityType : BuiltInRegistries.ENTITY_TYPE) { ++ entityType.dabEnabled = true; // reset all, before setting the ones to true ++ } ++ getStringList("dab.blacklisted-entities", "activation-range.blacklisted-entities", Collections.emptyList(), "A list of entities to ignore for activation") ++ .forEach(name -> EntityType.byString(name).ifPresentOrElse(entityType -> { ++ entityType.dabEnabled = false; ++ }, () -> MinecraftServer.LOGGER.warn("Unknown entity \"" + name + "\""))); ++ ++ setComment("dab", "Optimizes entity brains when", "they're far away from the player"); ++ } ++ ++ public static Map projectileTimeouts; ++ private static void projectileTimeouts() { ++ // Set some defaults ++ getInt("entity_timeouts.SNOWBALL", -1); ++ getInt("entity_timeouts.LLAMA_SPIT", -1); ++ setComment("entity_timeouts", ++ "These values define a entity's maximum lifespan. If an", ++ "entity is in this list and it has survived for longer than", ++ "that number of ticks, then it will be removed. Setting a value to", ++ "-1 disables this feature."); ++ ++ for (EntityType entityType : BuiltInRegistries.ENTITY_TYPE) { ++ String type = EntityType.getKey(entityType).getPath().toUpperCase(Locale.ROOT); ++ entityType.ttl = config.getInt("entity_timeouts." + type, -1); ++ } ++ } ++ ++ public static boolean throttleInactiveGoalSelectorTick; ++ private static void inactiveGoalSelectorThrottle() { ++ getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", true, ++ "Throttles the AI goal selector in entity inactive ticks.", ++ "This can improve performance by a few percent, but has minor gameplay implications."); ++ } ++ ++ ++ public static boolean disableMethodProfiler; ++ public static boolean disableOutOfOrderChat; ++ private static void miscSettings() { ++ disableMethodProfiler = getBoolean("misc.disable-method-profiler", true); ++ disableOutOfOrderChat = getBoolean("misc.disable-out-of-order-chat", false); ++ setComment("misc", "Settings for things that don't belong elsewhere"); ++ } ++ ++} +diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishLogger.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishLogger.java +new file mode 100644 +index 0000000000000000000000000000000000000000..53f2df00c6809618a9ee3d2ea72e85e8052fbcf1 +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishLogger.java +@@ -0,0 +1,16 @@ ++package gg.pufferfish.pufferfish; ++ ++import java.util.logging.Level; ++import java.util.logging.Logger; ++import org.bukkit.Bukkit; ++ ++public class PufferfishLogger extends Logger { ++ public static final PufferfishLogger LOGGER = new PufferfishLogger(); ++ ++ private PufferfishLogger() { ++ super("Pufferfish", null); ++ ++ setParent(Bukkit.getLogger()); ++ setLevel(Level.ALL); ++ } ++} +diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishVersionFetcher.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishVersionFetcher.java +new file mode 100644 +index 0000000000000000000000000000000000000000..e877921370f6009a4bd204d9b17d2d58834b8822 +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishVersionFetcher.java +@@ -0,0 +1,136 @@ ++package gg.pufferfish.pufferfish; ++ ++import static net.kyori.adventure.text.Component.text; ++import static net.kyori.adventure.text.format.NamedTextColor.GREEN; ++import static net.kyori.adventure.text.format.NamedTextColor.RED; ++ ++import com.destroystokyo.paper.VersionHistoryManager; ++import com.destroystokyo.paper.util.VersionFetcher; ++import com.google.gson.Gson; ++import com.google.gson.JsonObject; ++import java.io.IOException; ++import java.net.URI; ++import java.net.http.HttpClient; ++import java.net.http.HttpRequest; ++import java.net.http.HttpResponse; ++import java.nio.charset.StandardCharsets; ++import java.util.concurrent.TimeUnit; ++import java.util.logging.Level; ++import java.util.logging.Logger; ++import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.JoinConfiguration; ++import net.kyori.adventure.text.format.NamedTextColor; ++import net.kyori.adventure.text.format.TextDecoration; ++import org.bukkit.craftbukkit.CraftServer; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++public class PufferfishVersionFetcher implements VersionFetcher { ++ ++ private static final Logger LOGGER = Logger.getLogger("PufferfishVersionFetcher"); ++ private static final HttpClient client = HttpClient.newHttpClient(); ++ ++ private static final URI JENKINS_URI = URI.create("https://ci.pufferfish.host/job/Pufferfish-1.19/lastSuccessfulBuild/buildNumber"); ++ private static final String GITHUB_FORMAT = "https://api.github.com/repos/pufferfish-gg/Pufferfish/compare/ver/1.19...%s"; ++ ++ private static final HttpResponse.BodyHandler JSON_OBJECT_BODY_HANDLER = responseInfo -> HttpResponse.BodySubscribers ++ .mapping( ++ HttpResponse.BodySubscribers.ofString(StandardCharsets.UTF_8), ++ string -> new Gson().fromJson(string, JsonObject.class) ++ ); ++ ++ @Override ++ public long getCacheTime() { ++ return TimeUnit.MINUTES.toMillis(30); ++ } ++ ++ @Override ++ public @NotNull Component getVersionMessage(final @NotNull String serverVersion) { ++ final String[] parts = CraftServer.class.getPackage().getImplementationVersion().split("-"); ++ @NotNull Component component; ++ ++ if (parts.length != 3) { ++ component = text("Unknown server version.", RED); ++ } else { ++ final String versionString = parts[2]; ++ ++ try { ++ component = this.fetchJenkinsVersion(Integer.parseInt(versionString)); ++ } catch (NumberFormatException e) { ++ component = this.fetchGithubVersion(versionString.substring(1, versionString.length() - 1)); ++ } ++ } ++ ++ final @Nullable Component history = this.getHistory(); ++ return history != null ? Component ++ .join(JoinConfiguration.noSeparators(), component, Component.newline(), this.getHistory()) : component; ++ } ++ ++ private @NotNull Component fetchJenkinsVersion(final int versionNumber) { ++ final HttpRequest request = HttpRequest.newBuilder(JENKINS_URI).build(); ++ try { ++ final HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); ++ if (response.statusCode() != 200) { ++ return text("Received invalid status code (" + response.statusCode() + ") from server.", RED); ++ } ++ ++ int latestVersionNumber; ++ try { ++ latestVersionNumber = Integer.parseInt(response.body()); ++ } catch (NumberFormatException e) { ++ LOGGER.log(Level.WARNING, "Received invalid response from Jenkins \"" + response.body() + "\"."); ++ return text("Received invalid response from server.", RED); ++ } ++ ++ final int versionDiff = latestVersionNumber - versionNumber; ++ return this.getResponseMessage(versionDiff); ++ } catch (IOException | InterruptedException e) { ++ LOGGER.log(Level.WARNING, "Failed to look up version from Jenkins", e); ++ return text("Failed to retrieve version from server.", RED); ++ } ++ } ++ ++ // Based off code contributed by Techcable in Paper/GH-65 ++ private @NotNull Component fetchGithubVersion(final @NotNull String hash) { ++ final URI uri = URI.create(String.format(GITHUB_FORMAT, hash)); ++ final HttpRequest request = HttpRequest.newBuilder(uri).build(); ++ try { ++ final HttpResponse response = client.send(request, JSON_OBJECT_BODY_HANDLER); ++ if (response.statusCode() != 200) { ++ return text("Received invalid status code (" + response.statusCode() + ") from server.", RED); ++ } ++ ++ final JsonObject obj = response.body(); ++ final int versionDiff = obj.get("behind_by").getAsInt(); ++ ++ return this.getResponseMessage(versionDiff); ++ } catch (IOException | InterruptedException e) { ++ LOGGER.log(Level.WARNING, "Failed to look up version from GitHub", e); ++ return text("Failed to retrieve version from server.", RED); ++ } ++ } ++ ++ private @NotNull Component getResponseMessage(final int versionDiff) { ++ return switch (Math.max(-1, Math.min(1, versionDiff))) { ++ case -1 -> text("You are running an unsupported version of Pufferfish.", RED); ++ case 0 -> text("You are on the latest version!", GREEN); ++ default -> text("You are running " + versionDiff + " version" + (versionDiff == 1 ? "" : "s") + " beyond. " + ++ "Please update your server when possible to maintain stability, security, and receive the latest optimizations.", ++ RED); ++ }; ++ } ++ ++ private @Nullable Component getHistory() { ++ final VersionHistoryManager.VersionData data = VersionHistoryManager.INSTANCE.getVersionData(); ++ if (data == null) { ++ return null; ++ } ++ ++ final String oldVersion = data.getOldVersion(); ++ if (oldVersion == null) { ++ return null; ++ } ++ ++ return Component.text("Previous version: " + oldVersion, NamedTextColor.GRAY, TextDecoration.ITALIC); ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/gg/pufferfish/pufferfish/sentry/PufferfishSentryAppender.java b/src/main/java/gg/pufferfish/pufferfish/sentry/PufferfishSentryAppender.java +new file mode 100644 +index 0000000000000000000000000000000000000000..731ef11c7a025ae95ed8a757b530d834733d0621 +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/sentry/PufferfishSentryAppender.java +@@ -0,0 +1,135 @@ ++package gg.pufferfish.pufferfish.sentry; ++ ++import com.google.common.reflect.TypeToken; ++import com.google.gson.Gson; ++import io.sentry.Breadcrumb; ++import io.sentry.Sentry; ++import io.sentry.SentryEvent; ++import io.sentry.SentryLevel; ++import io.sentry.protocol.Message; ++import io.sentry.protocol.User; ++import java.util.Map; ++import org.apache.logging.log4j.Level; ++import org.apache.logging.log4j.LogManager; ++import org.apache.logging.log4j.Marker; ++import org.apache.logging.log4j.core.LogEvent; ++import org.apache.logging.log4j.core.Logger; ++import org.apache.logging.log4j.core.appender.AbstractAppender; ++import org.apache.logging.log4j.core.filter.AbstractFilter; ++ ++public class PufferfishSentryAppender extends AbstractAppender { ++ ++ private static final org.apache.logging.log4j.Logger logger = LogManager.getLogger(PufferfishSentryAppender.class); ++ private static final Gson GSON = new Gson(); ++ ++ public PufferfishSentryAppender() { ++ super("PufferfishSentryAdapter", new SentryFilter(), null); ++ } ++ ++ @Override ++ public void append(LogEvent logEvent) { ++ if (logEvent.getThrown() != null && logEvent.getLevel().isMoreSpecificThan(Level.WARN)) { ++ try { ++ logException(logEvent); ++ } catch (Exception e) { ++ logger.warn("Failed to log event with sentry", e); ++ } ++ } else { ++ try { ++ logBreadcrumb(logEvent); ++ } catch (Exception e) { ++ logger.warn("Failed to log event with sentry", e); ++ } ++ } ++ } ++ ++ private void logException(LogEvent e) { ++ SentryEvent event = new SentryEvent(e.getThrown()); ++ ++ Message sentryMessage = new Message(); ++ sentryMessage.setMessage(e.getMessage().getFormattedMessage()); ++ ++ event.setThrowable(e.getThrown()); ++ event.setLevel(getLevel(e.getLevel())); ++ event.setLogger(e.getLoggerName()); ++ event.setTransaction(e.getLoggerName()); ++ event.setExtra("thread_name", e.getThreadName()); ++ ++ boolean hasContext = e.getContextData() != null; ++ ++ if (hasContext && e.getContextData().containsKey("pufferfishsentry_playerid")) { ++ User user = new User(); ++ user.setId(e.getContextData().getValue("pufferfishsentry_playerid")); ++ user.setUsername(e.getContextData().getValue("pufferfishsentry_playername")); ++ event.setUser(user); ++ } ++ ++ if (hasContext && e.getContextData().containsKey("pufferfishsentry_pluginname")) { ++ event.setExtra("plugin.name", e.getContextData().getValue("pufferfishsentry_pluginname")); ++ event.setExtra("plugin.version", e.getContextData().getValue("pufferfishsentry_pluginversion")); ++ event.setTransaction(e.getContextData().getValue("pufferfishsentry_pluginname")); ++ } ++ ++ if (hasContext && e.getContextData().containsKey("pufferfishsentry_eventdata")) { ++ Map eventFields = GSON.fromJson((String) e.getContextData().getValue("pufferfishsentry_eventdata"), new TypeToken>() {}.getType()); ++ if (eventFields != null) { ++ event.setExtra("event", eventFields); ++ } ++ } ++ ++ Sentry.captureEvent(event); ++ } ++ ++ private void logBreadcrumb(LogEvent e) { ++ Breadcrumb breadcrumb = new Breadcrumb(); ++ ++ breadcrumb.setLevel(getLevel(e.getLevel())); ++ breadcrumb.setCategory(e.getLoggerName()); ++ breadcrumb.setType(e.getLoggerName()); ++ breadcrumb.setMessage(e.getMessage().getFormattedMessage()); ++ ++ Sentry.addBreadcrumb(breadcrumb); ++ } ++ ++ private SentryLevel getLevel(Level level) { ++ switch (level.getStandardLevel()) { ++ case TRACE: ++ case DEBUG: ++ return SentryLevel.DEBUG; ++ case WARN: ++ return SentryLevel.WARNING; ++ case ERROR: ++ return SentryLevel.ERROR; ++ case FATAL: ++ return SentryLevel.FATAL; ++ case INFO: ++ default: ++ return SentryLevel.INFO; ++ } ++ } ++ ++ private static class SentryFilter extends AbstractFilter { ++ ++ @Override ++ public Result filter(Logger logger, org.apache.logging.log4j.Level level, Marker marker, String msg, ++ Object... params) { ++ return this.filter(logger.getName()); ++ } ++ ++ @Override ++ public Result filter(Logger logger, org.apache.logging.log4j.Level level, Marker marker, Object msg, Throwable t) { ++ return this.filter(logger.getName()); ++ } ++ ++ @Override ++ public Result filter(LogEvent event) { ++ return this.filter(event == null ? null : event.getLoggerName()); ++ } ++ ++ private Result filter(String loggerName) { ++ return loggerName != null && loggerName.startsWith("gg.castaway.pufferfish.sentry") ? Result.DENY ++ : Result.NEUTRAL; ++ } ++ ++ } ++} +diff --git a/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java +new file mode 100644 +index 0000000000000000000000000000000000000000..1b29210ad0bbb4ada150f23357f0c80d331c996d +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java +@@ -0,0 +1,40 @@ ++package gg.pufferfish.pufferfish.sentry; ++ ++import gg.pufferfish.pufferfish.PufferfishConfig; ++import io.sentry.Sentry; ++import org.apache.logging.log4j.LogManager; ++import org.apache.logging.log4j.Logger; ++ ++public class SentryManager { ++ ++ private static final Logger logger = LogManager.getLogger(SentryManager.class); ++ ++ private SentryManager() { ++ ++ } ++ ++ private static boolean initialized = false; ++ ++ public static synchronized void init() { ++ if (initialized) { ++ return; ++ } ++ try { ++ initialized = true; ++ ++ Sentry.init(options -> { ++ options.setDsn(PufferfishConfig.sentryDsn); ++ options.setMaxBreadcrumbs(100); ++ }); ++ ++ PufferfishSentryAppender appender = new PufferfishSentryAppender(); ++ appender.start(); ++ ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()).addAppender(appender); ++ logger.info("Sentry logging started!"); ++ } catch (Exception e) { ++ logger.warn("Failed to initialize sentry!", e); ++ initialized = false; ++ } ++ } ++ ++} +diff --git a/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java b/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java +new file mode 100644 +index 0000000000000000000000000000000000000000..8e5323d5d9af25c8a85c4b34a6be76cfc54384cf +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java +@@ -0,0 +1,73 @@ ++package gg.pufferfish.pufferfish.util; ++ ++import com.google.common.collect.Queues; ++import gg.pufferfish.pufferfish.PufferfishLogger; ++import java.util.Queue; ++import java.util.concurrent.locks.Condition; ++import java.util.concurrent.locks.Lock; ++import java.util.concurrent.locks.ReentrantLock; ++import java.util.logging.Level; ++ ++public class AsyncExecutor implements Runnable { ++ ++ private final Queue jobs = Queues.newArrayDeque(); ++ private final Lock mutex = new ReentrantLock(); ++ private final Condition cond = mutex.newCondition(); ++ private final Thread thread; ++ private volatile boolean killswitch = false; ++ ++ public AsyncExecutor(String threadName) { ++ this.thread = new Thread(this, threadName); ++ } ++ ++ public void start() { ++ thread.start(); ++ } ++ ++ public void kill() { ++ killswitch = true; ++ cond.signalAll(); ++ } ++ ++ public void submit(Runnable runnable) { ++ mutex.lock(); ++ try { ++ jobs.offer(runnable); ++ cond.signalAll(); ++ } finally { ++ mutex.unlock(); ++ } ++ } ++ ++ @Override ++ public void run() { ++ while (!killswitch) { ++ try { ++ Runnable runnable = takeRunnable(); ++ if (runnable != null) { ++ runnable.run(); ++ } ++ } catch (InterruptedException e) { ++ Thread.currentThread().interrupt(); ++ } catch (Exception e) { ++ PufferfishLogger.LOGGER.log(Level.SEVERE, e, () -> "Failed to execute async job for thread " + thread.getName()); ++ } ++ } ++ } ++ ++ private Runnable takeRunnable() throws InterruptedException { ++ mutex.lock(); ++ try { ++ while (jobs.isEmpty() && !killswitch) { ++ cond.await(); ++ } ++ ++ if (jobs.isEmpty()) return null; // We've set killswitch ++ ++ return jobs.remove(); ++ } finally { ++ mutex.unlock(); ++ } ++ } ++ ++} +diff --git a/src/main/java/gg/pufferfish/pufferfish/util/AsyncPlayerAreaMap.java b/src/main/java/gg/pufferfish/pufferfish/util/AsyncPlayerAreaMap.java +new file mode 100644 +index 0000000000000000000000000000000000000000..fdcb62d12164024a5f354d60cc863821a18d1b2a +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/util/AsyncPlayerAreaMap.java +@@ -0,0 +1,31 @@ ++package gg.pufferfish.pufferfish.util; ++ ++import com.destroystokyo.paper.util.misc.PlayerAreaMap; ++import com.destroystokyo.paper.util.misc.PooledLinkedHashSets; ++import java.util.concurrent.ConcurrentHashMap; ++import net.minecraft.server.level.ServerPlayer; ++ ++public final class AsyncPlayerAreaMap extends PlayerAreaMap { ++ ++ public AsyncPlayerAreaMap() { ++ super(); ++ this.areaMap = new Long2ObjectOpenHashMapWrapper<>(new ConcurrentHashMap<>(1024, 0.7f)); ++ } ++ ++ public AsyncPlayerAreaMap(final PooledLinkedHashSets pooledHashSets) { ++ super(pooledHashSets); ++ this.areaMap = new Long2ObjectOpenHashMapWrapper<>(new ConcurrentHashMap<>(1024, 0.7f)); ++ } ++ ++ public AsyncPlayerAreaMap(final PooledLinkedHashSets pooledHashSets, final ChangeCallback addCallback, ++ final ChangeCallback removeCallback) { ++ this(pooledHashSets, addCallback, removeCallback, null); ++ } ++ ++ public AsyncPlayerAreaMap(final PooledLinkedHashSets pooledHashSets, final ChangeCallback addCallback, ++ final ChangeCallback removeCallback, final ChangeSourceCallback changeSourceCallback) { ++ super(pooledHashSets, addCallback, removeCallback, changeSourceCallback); ++ this.areaMap = new Long2ObjectOpenHashMapWrapper<>(new ConcurrentHashMap<>(1024, 0.7f)); ++ } ++ ++} +diff --git a/src/main/java/gg/pufferfish/pufferfish/util/IterableWrapper.java b/src/main/java/gg/pufferfish/pufferfish/util/IterableWrapper.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c1929840254a3e6d721816f4a20415bea1742580 +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/util/IterableWrapper.java +@@ -0,0 +1,20 @@ ++package gg.pufferfish.pufferfish.util; ++ ++import java.util.Iterator; ++import org.jetbrains.annotations.NotNull; ++ ++public class IterableWrapper implements Iterable { ++ ++ private final Iterator iterator; ++ ++ public IterableWrapper(Iterator iterator) { ++ this.iterator = iterator; ++ } ++ ++ @NotNull ++ @Override ++ public Iterator iterator() { ++ return iterator; ++ } ++ ++} +diff --git a/src/main/java/gg/pufferfish/pufferfish/util/Long2ObjectOpenHashMapWrapper.java b/src/main/java/gg/pufferfish/pufferfish/util/Long2ObjectOpenHashMapWrapper.java +new file mode 100644 +index 0000000000000000000000000000000000000000..facd55463d44cb7e3d2ca6892982f5497b8dded1 +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/util/Long2ObjectOpenHashMapWrapper.java +@@ -0,0 +1,40 @@ ++package gg.pufferfish.pufferfish.util; ++ ++import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; ++import java.util.Map; ++import org.jetbrains.annotations.Nullable; ++ ++public class Long2ObjectOpenHashMapWrapper extends Long2ObjectOpenHashMap { ++ ++ private final Map backingMap; ++ ++ public Long2ObjectOpenHashMapWrapper(Map map) { ++ backingMap = map; ++ } ++ ++ @Override ++ public V put(Long key, V value) { ++ return backingMap.put(key, value); ++ } ++ ++ @Override ++ public V get(Object key) { ++ return backingMap.get(key); ++ } ++ ++ @Override ++ public V remove(Object key) { ++ return backingMap.remove(key); ++ } ++ ++ @Nullable ++ @Override ++ public V putIfAbsent(Long key, V value) { ++ return backingMap.putIfAbsent(key, value); ++ } ++ ++ @Override ++ public int size() { ++ return backingMap.size(); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +index 63ec2ebb71aa0e0dbb64bbce7cd3c9494e9ce2e7..d03551e81e3ef37935cb1d963aba3df316f48ef5 100644 +--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java ++++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +@@ -7,6 +7,7 @@ import net.kyori.adventure.text.Component; + import net.kyori.adventure.text.format.NamedTextColor; + import net.minecraft.network.protocol.Packet; + import net.minecraft.network.protocol.game.ServerboundPlaceRecipePacket; ++import org.bukkit.Bukkit; // Pufferfish + import org.checkerframework.checker.nullness.qual.Nullable; + import org.spongepowered.configurate.objectmapping.ConfigSerializable; + import org.spongepowered.configurate.objectmapping.meta.Comment; +@@ -16,6 +17,7 @@ import org.spongepowered.configurate.objectmapping.meta.Setting; + import java.util.List; + import java.util.Map; + import java.util.Objects; ++import java.util.logging.Level; // Pufferfish + + @SuppressWarnings({"CanBeFinal", "FieldCanBeLocal", "FieldMayBeFinal", "NotNullFieldNotInitialized", "InnerClassMayBeStatic"}) + public class GlobalConfiguration extends ConfigurationPart { +@@ -51,6 +53,7 @@ public class GlobalConfiguration extends ConfigurationPart { + + public class Timings extends ConfigurationPart.Post { + public boolean enabled = true; ++ public boolean reallyEnabled = false; + public boolean verbose = true; + public String url = "https://timings.aikar.co/"; + public boolean serverNamePrivacy = false; +@@ -64,6 +67,14 @@ public class GlobalConfiguration extends ConfigurationPart { + + @Override + public void postProcess() { ++ // Pufferfish start ++ if (enabled && !reallyEnabled) { ++ Bukkit.getLogger().log(Level.WARNING, "[Pufferfish] To improve performance, timings have been disabled by default"); ++ Bukkit.getLogger().log(Level.WARNING, "[Pufferfish] You can still use timings by using /timings on, but they will not start on server startup unless you set timings.really-enabled to true in paper.yml"); ++ Bukkit.getLogger().log(Level.WARNING, "[Pufferfish] If you would like to disable this message, either set timings.really-enabled to true or timings.enabled to false."); ++ } ++ enabled = reallyEnabled; ++ // Pufferfish end + MinecraftTimings.processConfig(this); + } + } +diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java +index dacb00c7cb2702ae8e9c6be61ca08e41bd6009e4..b5d4c53bf1046fa52da5398491258b94f1e0fcd0 100644 +--- a/src/main/java/io/papermc/paper/util/MCUtil.java ++++ b/src/main/java/io/papermc/paper/util/MCUtil.java +@@ -209,7 +209,7 @@ public final class MCUtil { + } + + public static long getCoordinateKey(final Entity entity) { +- return ((long)(MCUtil.fastFloor(entity.getZ()) >> 4) << 32) | ((MCUtil.fastFloor(entity.getX()) >> 4) & 0xFFFFFFFFL); ++ return ((long)(entity.blockPosition.getZ() >> 4) << 32) | ((entity.blockPosition.getX() >> 4) & 0xFFFFFFFFL); // Pufferfish - eliminate double->long cast in hotpath + } + + public static long getCoordinateKey(final ChunkPos pair) { +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 710ca7d3a5659953f64bc6dccdd93b43300961cc..68d16efaf9c2d997afabadcf1ee24c5de685b5b3 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -309,6 +309,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop S spin(Function serverFactory) { + AtomicReference atomicreference = new AtomicReference(); +@@ -1654,7 +1656,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop // Spigot - Spigot > // CraftBukkit - cb > vanilla! ++ return "Pufferfish"; // Pufferfish - Pufferfish > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla! + } + + public SystemReport fillSystemReport(SystemReport details) { +@@ -2239,6 +2241,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop passengers = parent.getPassengers(); ++ ++ for (int i = 0, size = passengers.size(); i < size; i++) { ++ Entity entity = passengers.get(i); ++ int range = entity.getType().clientTrackingRange() * 16; ++ range = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, range); // Paper ++ ++ if (range > highest) { // Paper - we need the lowest range thanks to the fact that our tracker doesn't account for passenger logic // Tuinity - not anymore! ++ highest = range; ++ } ++ ++ highest = getHighestRange(entity, highest); ++ } ++ ++ return highest; ++ } ++ + private int getEffectiveRange() { + int i = this.range; ++ // Pufferfish start - remove iterators and streams ++ /* + Iterator iterator = this.entity.getIndirectPassengers().iterator(); + + while (iterator.hasNext()) { +@@ -1637,6 +1657,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + i = j; + } + } ++ */ ++ i = getHighestRange(this.entity, i); ++ // Pufferfish end + + return this.scaledRange(i); + } +diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +index ca84eddbdb1e198b899750e5f6b3eafd25ce970f..c6f5d6756fa0e068a462d9c0ded12e0771abba37 100644 +--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java ++++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +@@ -76,6 +76,9 @@ public class ServerChunkCache extends ChunkSource { + final it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap loadedChunkMap = new it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<>(8192, 0.5f); + + private final LevelChunk[] lastLoadedChunks = new LevelChunk[4 * 4]; ++ ++ public boolean firstRunSpawnCounts = true; // Pufferfish ++ public final java.util.concurrent.atomic.AtomicBoolean _pufferfish_spawnCountsReady = new java.util.concurrent.atomic.AtomicBoolean(false); // Pufferfish - optimize countmobs + + private static int getChunkCacheKey(int x, int z) { + return x & 3 | ((z & 3) << 2); +@@ -703,6 +706,7 @@ public class ServerChunkCache extends ChunkSource { + ProfilerFiller gameprofilerfiller = this.level.getProfiler(); + + gameprofilerfiller.push("pollingChunks"); ++ this.level.resetIceAndSnowTick(); // Pufferfish - reset ice & snow tick random + int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); + boolean flag1 = level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && worlddata.getGameTime() % level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit + +@@ -712,18 +716,25 @@ public class ServerChunkCache extends ChunkSource { + // Paper start - per player mob spawning + NaturalSpawner.SpawnState spawnercreature_d; // moved down + if ((this.spawnFriendlies || this.spawnEnemies) && this.chunkMap.playerMobDistanceMap != null) { // don't count mobs when animals and monsters are disabled +- // re-set mob counts +- for (ServerPlayer player : this.level.players) { +- Arrays.fill(player.mobCounts, 0); ++ // Pufferfish start - moved down when async processing ++ if (!gg.pufferfish.pufferfish.PufferfishConfig.enableAsyncMobSpawning) { ++ // re-set mob counts ++ for (ServerPlayer player : this.level.players) { ++ Arrays.fill(player.mobCounts, 0); ++ } ++ lastSpawnState = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, null, true); + } +- spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, null, true); ++ // Pufferfish end + } else { +- spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, this.chunkMap.playerMobDistanceMap == null ? new LocalMobCapCalculator(this.chunkMap) : null, false); ++ // Pufferfish start - this is only implemented for per-player mob spawning so this makes everything work if this setting is disabled. ++ lastSpawnState = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, this.chunkMap.playerMobDistanceMap == null ? new LocalMobCapCalculator(this.chunkMap) : null, false); ++ _pufferfish_spawnCountsReady.set(true); ++ // Pufferfish end + } + // Paper end + this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings + +- this.lastSpawnState = spawnercreature_d; ++ //this.lastSpawnState = spawnercreature_d; // Pufferfish - this is managed asynchronously + gameprofilerfiller.popPush("filteringLoadedChunks"); + // Paper - moved down + this.level.timings.chunkTicks.startTiming(); // Paper +@@ -761,8 +772,8 @@ public class ServerChunkCache extends ChunkSource { + + if ((true || this.level.isNaturalSpawningAllowed(chunkcoordintpair)) && this.chunkMap.anyPlayerCloseEnoughForSpawning(holder, chunkcoordintpair, false)) { // Paper - optimise anyPlayerCloseEnoughForSpawning // Paper - the chunk is known ticking + chunk1.incrementInhabitedTime(j); +- if (flag2 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(holder, chunkcoordintpair, true)) { // Spigot // Paper - optimise anyPlayerCloseEnoughForSpawning & optimise chunk tick iteration +- NaturalSpawner.spawnForChunk(this.level, chunk1, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag1); ++ if (flag2 && (!gg.pufferfish.pufferfish.PufferfishConfig.enableAsyncMobSpawning || _pufferfish_spawnCountsReady.get()) && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(holder, chunkcoordintpair, true)) { // Spigot // Paper - optimise anyPlayerCloseEnoughForSpawning & optimise chunk tick iteration ++ NaturalSpawner.spawnForChunk(this.level, chunk1, lastSpawnState, this.spawnFriendlies, this.spawnEnemies, flag1); // Pufferfish + } + + if (true || this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { // Paper - the chunk is known ticking +@@ -824,6 +835,30 @@ public class ServerChunkCache extends ChunkSource { + } + // Paper end - controlled flush for entity tracker packets + } ++ ++ // Pufferfish start - optimize mob spawning ++ if (gg.pufferfish.pufferfish.PufferfishConfig.enableAsyncMobSpawning) { ++ for (ServerPlayer player : this.level.players) { ++ Arrays.fill(player.mobCounts, 0); ++ } ++ if (firstRunSpawnCounts) { ++ firstRunSpawnCounts = false; ++ _pufferfish_spawnCountsReady.set(true); ++ } ++ if (chunkMap.playerMobDistanceMap != null && _pufferfish_spawnCountsReady.getAndSet(false)) { ++ net.minecraft.server.MinecraftServer.getServer().mobSpawnExecutor.submit(() -> { ++ int mapped = distanceManager.getNaturalSpawnChunkCount(); ++ io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet.Iterator objectiterator = ++ level.entityTickList.entities.iterator(io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet.ITERATOR_FLAG_SEE_ADDITIONS); ++ gg.pufferfish.pufferfish.util.IterableWrapper wrappedIterator = ++ new gg.pufferfish.pufferfish.util.IterableWrapper<>(objectiterator); ++ lastSpawnState = NaturalSpawner.createState(mapped, wrappedIterator, this::getFullChunk, null, true); ++ objectiterator.finishedIterating(); ++ _pufferfish_spawnCountsReady.set(true); ++ }); ++ } ++ } ++ // Pufferfish end + } + + private void getFullChunk(long pos, Consumer chunkConsumer) { +diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java +index 190e9761087baec5827d722a8281f0ffb6798341..50cf4d200bc2892f2140c9929193b4b20ad2bd17 100644 +--- a/src/main/java/net/minecraft/server/level/ServerEntity.java ++++ b/src/main/java/net/minecraft/server/level/ServerEntity.java +@@ -170,6 +170,7 @@ public class ServerEntity { + boolean flag4 = k < -32768L || k > 32767L || l < -32768L || l > 32767L || i1 < -32768L || i1 > 32767L; + + if (!flag4 && this.teleportDelay <= 400 && !this.wasRiding && this.wasOnGround == this.entity.isOnGround() && !(io.papermc.paper.configuration.GlobalConfiguration.get().collisions.sendFullPosForHardCollidingEntities && this.entity.hardCollides())) { // Paper - send full pos for hard colliding entities to prevent collision problems due to desync ++ if (flag2 || flag3 || this.entity instanceof AbstractArrow) { // Pufferfish + if ((!flag2 || !flag3) && !(this.entity instanceof AbstractArrow)) { + if (flag2) { + packet1 = new ClientboundMoveEntityPacket.Pos(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), this.entity.isOnGround()); +@@ -179,6 +180,7 @@ public class ServerEntity { + } else { + packet1 = new ClientboundMoveEntityPacket.PosRot(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), (byte) i, (byte) j, this.entity.isOnGround()); + } ++ } // Pufferfish + } else { + this.wasOnGround = this.entity.isOnGround(); + this.teleportDelay = 0; +diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java +index f3a19d00f78e19aa98c57461efb90d79f656a992..54a51fc23563ca7843c72c169b1e0d7f51c42412 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -711,6 +711,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + org.spigotmc.ActivationRange.activateEntities(this); // Spigot + timings.entityTick.startTiming(); // Spigot + this.entityTickList.forEach((entity) -> { ++ entity.activatedPriorityReset = false; // Pufferfish - DAB + if (!entity.isRemoved()) { + if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed + entity.discard(); +@@ -730,7 +731,20 @@ public class ServerLevel extends Level implements WorldGenLevel { + } + + gameprofilerfiller.push("tick"); +- this.guardEntityTick(this::tickNonPassenger, entity); ++ // Pufferfish start - copied from this.guardEntityTick ++ try { ++ this.tickNonPassenger(entity); // Pufferfish - changed ++ MinecraftServer.getServer().executeMidTickTasks(); // Tuinity - execute chunk tasks mid tick ++ } catch (Throwable throwable) { ++ if (throwable instanceof ThreadDeath) throw throwable; // Paper ++ // Paper start - Prevent tile entity and entity crashes ++ final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level.getWorld().getName(), entity.getX(), entity.getY(), entity.getZ()); ++ MinecraftServer.LOGGER.error(msg, throwable); ++ getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, throwable))); ++ entity.discard(); ++ // Paper end ++ } ++ // Pufferfish end + gameprofilerfiller.pop(); + } + } +@@ -795,9 +809,11 @@ public class ServerLevel extends Level implements WorldGenLevel { + } + // Paper start - optimise random block ticking + private final BlockPos.MutableBlockPos chunkTickMutablePosition = new BlockPos.MutableBlockPos(); +- private final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(this.random.nextLong()); ++ // private final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(); // Pufferfish - moved to super + // Paper end + ++ private int currentIceAndSnowTick = 0; protected void resetIceAndSnowTick() { this.currentIceAndSnowTick = this.randomTickRandom.nextInt(16); } // Pufferfish ++ + public void tickChunk(LevelChunk chunk, int randomTickSpeed) { + ChunkPos chunkcoordintpair = chunk.getPos(); + boolean flag = this.isRaining(); +@@ -808,7 +824,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + gameprofilerfiller.push("thunder"); + final BlockPos.MutableBlockPos blockposition = this.chunkTickMutablePosition; // Paper - use mutable to reduce allocation rate, final to force compile fail on change + +- if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - disable thunder ++ if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && /*this.random.nextInt(this.spigotConfig.thunderChance) == 0 &&*/ chunk.shouldDoLightning(this.random)) { // Spigot // Paper - disable thunder // Pufferfish - replace random with shouldDoLightning + blockposition.set(this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15))); // Paper + if (this.isRainingAt(blockposition)) { + DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition); +@@ -838,7 +854,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + gameprofilerfiller.popPush("iceandsnow"); + int l; + +- if (!this.paperConfig().environment.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow ++ if (!this.paperConfig().environment.disableIceAndSnow && (this.currentIceAndSnowTick++ & 15) == 0) { // Paper - Disable ice and snow // Paper - optimise random ticking // Pufferfish - optimize further random ticking + // Paper start - optimise chunk ticking + this.getRandomBlockPosition(j, 0, k, 15, blockposition); + int normalY = chunk.getHeight(Heightmap.Types.MOTION_BLOCKING, blockposition.getX() & 15, blockposition.getZ() & 15) + 1; +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index 57a62a5d6e05b6e05214b5aef96c5f2411e9f424..aa23559719357f2678e3aa759d58ba4bde18bdd4 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -1208,6 +1208,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + + @Override + public void handleEditBook(ServerboundEditBookPacket packet) { ++ if (!gg.pufferfish.pufferfish.PufferfishConfig.enableBooks && !this.player.getBukkitEntity().hasPermission("pufferfish.usebooks")) return; // Pufferfish + // Paper start + if (!this.cserver.isPrimaryThread()) { + List pageList = packet.getPages(); +@@ -2354,6 +2355,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + } + + private boolean updateChatOrder(Instant timestamp) { ++ if (gg.pufferfish.pufferfish.PufferfishConfig.disableOutOfOrderChat) return true; + Instant instant1; + + do { +diff --git a/src/main/java/net/minecraft/world/CompoundContainer.java b/src/main/java/net/minecraft/world/CompoundContainer.java +index 241fec02e6869c638d3a160819b32173a081467b..6a8f9e8f5bf108674c47018def28906e2d0a729c 100644 +--- a/src/main/java/net/minecraft/world/CompoundContainer.java ++++ b/src/main/java/net/minecraft/world/CompoundContainer.java +@@ -1,5 +1,6 @@ + package net.minecraft.world; + ++import net.minecraft.core.Direction; // Pufferfish + import net.minecraft.world.entity.player.Player; + import net.minecraft.world.item.ItemStack; + +@@ -64,6 +65,23 @@ public class CompoundContainer implements Container { + this.container2 = second; + } + ++ // Pufferfish start ++ @Override ++ public boolean hasEmptySlot(Direction enumdirection) { ++ return this.container1.hasEmptySlot(null) || this.container2.hasEmptySlot(null); ++ } ++ ++ @Override ++ public boolean isCompletelyFull(Direction enumdirection) { ++ return this.container1.isCompletelyFull(null) && this.container2.isCompletelyFull(null); ++ } ++ ++ @Override ++ public boolean isCompletelyEmpty(Direction enumdirection) { ++ return this.container1.isCompletelyEmpty(null) && this.container2.isCompletelyEmpty(null); ++ } ++ // Pufferfish end ++ + @Override + public int getContainerSize() { + return this.container1.getContainerSize() + this.container2.getContainerSize(); +diff --git a/src/main/java/net/minecraft/world/Container.java b/src/main/java/net/minecraft/world/Container.java +index 540bc9500c35c0db719b00aa26f6fb3a1b08ed9f..806cb760822a99316b08ad95ff8922df717050e2 100644 +--- a/src/main/java/net/minecraft/world/Container.java ++++ b/src/main/java/net/minecraft/world/Container.java +@@ -2,6 +2,8 @@ package net.minecraft.world; + + import java.util.Set; + import java.util.function.Predicate; ++ ++import net.minecraft.core.Direction; // Pufferfish + import net.minecraft.world.entity.player.Player; + import net.minecraft.world.item.Item; + import net.minecraft.world.item.ItemStack; +@@ -10,6 +12,63 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity; + // CraftBukkit end + + public interface Container extends Clearable { ++ // Pufferfish start - allow the inventory to override and optimize these frequent calls ++ default boolean hasEmptySlot(@org.jetbrains.annotations.Nullable Direction enumdirection) { // there is a slot with 0 items in it ++ if (this instanceof WorldlyContainer worldlyContainer) { ++ for (int i : worldlyContainer.getSlotsForFace(enumdirection)) { ++ if (this.getItem(i).isEmpty()) { ++ return true; ++ } ++ } ++ } else { ++ int size = this.getContainerSize(); ++ for (int i = 0; i < size; i++) { ++ if (this.getItem(i).isEmpty()) { ++ return true; ++ } ++ } ++ } ++ return false; ++ } ++ ++ default boolean isCompletelyFull(@org.jetbrains.annotations.Nullable Direction enumdirection) { // every stack is maxed ++ if (this instanceof WorldlyContainer worldlyContainer) { ++ for (int i : worldlyContainer.getSlotsForFace(enumdirection)) { ++ ItemStack itemStack = this.getItem(i); ++ if (itemStack.getCount() < itemStack.getMaxStackSize()) { ++ return false; ++ } ++ } ++ } else { ++ int size = this.getContainerSize(); ++ for (int i = 0; i < size; i++) { ++ ItemStack itemStack = this.getItem(i); ++ if (itemStack.getCount() < itemStack.getMaxStackSize()) { ++ return false; ++ } ++ } ++ } ++ return true; ++ } ++ ++ default boolean isCompletelyEmpty(@org.jetbrains.annotations.Nullable Direction enumdirection) { ++ if (this instanceof WorldlyContainer worldlyContainer) { ++ for (int i : worldlyContainer.getSlotsForFace(enumdirection)) { ++ if (!this.getItem(i).isEmpty()) { ++ return false; ++ } ++ } ++ } else { ++ int size = this.getContainerSize(); ++ for (int i = 0; i < size; i++) { ++ if (!this.getItem(i).isEmpty()) { ++ return false; ++ } ++ } ++ } ++ return true; ++ } ++ // Pufferfish end + + int LARGE_MAX_STACK_SIZE = 64; + +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 7f94da8059147760cbdc2476d0e8beda4a105f40..caa4d38d620717e78df9ad29fe9752213f1cda1b 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -291,7 +291,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + public double yo; + public double zo; + private Vec3 position; +- private BlockPos blockPosition; ++ public BlockPos blockPosition; // Pufferfish - private->public + private ChunkPos chunkPosition; + private Vec3 deltaMovement; + private float yRot; +@@ -413,6 +413,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + return this.originWorld; + } + // Paper end ++ // Pufferfish start ++ public boolean activatedPriorityReset = false; // DAB ++ public int activatedPriority = gg.pufferfish.pufferfish.PufferfishConfig.maximumActivationPrio; // golf score ++ public final BlockPos.MutableBlockPos cachedBlockPos = new BlockPos.MutableBlockPos(); // used where needed ++ // Pufferfish end ++ + public float getBukkitYaw() { + return this.yRot; + } +@@ -487,17 +493,36 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + this.isLegacyTrackingEntity = isLegacyTrackingEntity; + } + ++ private org.spigotmc.TrackingRange.TrackingRangeType getFurthestEntity(Entity entity, net.minecraft.server.level.ChunkMap chunkMap, org.spigotmc.TrackingRange.TrackingRangeType type, int range) { ++ List passengers = entity.getPassengers(); ++ for (int i = 0, size = passengers.size(); i < size; i++) { ++ Entity passenger = passengers.get(i); ++ org.spigotmc.TrackingRange.TrackingRangeType passengerType = passenger.trackingRangeType; ++ int passengerRange = chunkMap.getEntityTrackerRange(passengerType.ordinal()); ++ if (passengerRange > range) { ++ type = passengerType; ++ range = passengerRange; ++ } ++ ++ type = this.getFurthestEntity(passenger, chunkMap, type, range); ++ } ++ ++ return type; ++ } ++ + public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet getPlayersInTrackRange() { + // determine highest range of passengers + if (this.passengers.isEmpty()) { + return ((ServerLevel)this.level).getChunkSource().chunkMap.playerEntityTrackerTrackMaps[this.trackingRangeType.ordinal()] + .getObjectsInRange(MCUtil.getCoordinateKey(this)); + } +- Iterable passengers = this.getIndirectPassengers(); ++ //Iterable passengers = this.getIndirectPassengers(); // Pufferfish + net.minecraft.server.level.ChunkMap chunkMap = ((ServerLevel)this.level).getChunkSource().chunkMap; + org.spigotmc.TrackingRange.TrackingRangeType type = this.trackingRangeType; + int range = chunkMap.getEntityTrackerRange(type.ordinal()); + ++ // Pufferfish start - use getFurthestEntity to skip getIndirectPassengers ++ /* + for (Entity passenger : passengers) { + org.spigotmc.TrackingRange.TrackingRangeType passengerType = passenger.trackingRangeType; + int passengerRange = chunkMap.getEntityTrackerRange(passengerType.ordinal()); +@@ -506,6 +531,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + range = passengerRange; + } + } ++ */ ++ type = this.getFurthestEntity(this, chunkMap, type, range); ++ // Pufferfish end + + return chunkMap.playerEntityTrackerTrackMaps[type.ordinal()].getObjectsInRange(MCUtil.getCoordinateKey(this)); + } +@@ -787,6 +815,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + // CraftBukkit end + + public void baseTick() { ++ // Pufferfish start - entity TTL ++ if (type != EntityType.PLAYER && type.ttl >= 0 && this.tickCount >= type.ttl) { ++ remove(RemovalReason.DISCARDED); ++ return; ++ } ++ // Pufferfish end - entity TTL + this.level.getProfiler().push("entityBaseTick"); + if (firstTick && this instanceof net.minecraft.world.entity.NeutralMob neutralMob) neutralMob.tickInitialPersistentAnger(level); // Paper - Update last hurt when ticking + this.feetBlockState = null; +@@ -4075,16 +4109,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + } + + public boolean updateFluidHeightAndDoFluidPushing(TagKey tag, double speed) { +- if (this.touchingUnloadedChunk()) { ++ if (false && this.touchingUnloadedChunk()) { // Pufferfish - cost of a lookup here is the same cost as below, so skip + return false; + } else { + AABB axisalignedbb = this.getBoundingBox().deflate(0.001D); +- int i = Mth.floor(axisalignedbb.minX); +- int j = Mth.ceil(axisalignedbb.maxX); +- int k = Mth.floor(axisalignedbb.minY); +- int l = Mth.ceil(axisalignedbb.maxY); +- int i1 = Mth.floor(axisalignedbb.minZ); +- int j1 = Mth.ceil(axisalignedbb.maxZ); ++ // Pufferfish start - rename ++ int minBlockX = Mth.floor(axisalignedbb.minX); ++ int maxBlockX = Mth.ceil(axisalignedbb.maxX); ++ int minBlockY = Mth.floor(axisalignedbb.minY); ++ int maxBlockY = Mth.ceil(axisalignedbb.maxY); ++ int minBlockZ = Mth.floor(axisalignedbb.minZ); ++ int maxBlockZ = Mth.ceil(axisalignedbb.maxZ); ++ // Pufferfish end + double d1 = 0.0D; + boolean flag = this.isPushedByFluid(); + boolean flag1 = false; +@@ -4092,14 +4128,61 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + int k1 = 0; + BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos(); + +- for (int l1 = i; l1 < j; ++l1) { +- for (int i2 = k; i2 < l; ++i2) { +- for (int j2 = i1; j2 < j1; ++j2) { +- blockposition_mutableblockposition.set(l1, i2, j2); +- FluidState fluid = this.level.getFluidState(blockposition_mutableblockposition); ++ // Pufferfish start - based off CollisionUtil.getCollisionsForBlocksOrWorldBorder ++ final int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this.level); ++ final int maxSection = io.papermc.paper.util.WorldUtil.getMaxSection(this.level); ++ final int minBlock = minSection << 4; ++ final int maxBlock = (maxSection << 4) | 15; ++ ++ // special cases: ++ if (minBlockY > maxBlock || maxBlockY < minBlock) { ++ // no point in checking ++ return false; ++ } ++ ++ int minYIterate = Math.max(minBlock, minBlockY); ++ int maxYIterate = Math.min(maxBlock, maxBlockY); ++ ++ int minChunkX = minBlockX >> 4; ++ int maxChunkX = maxBlockX >> 4; ++ ++ int minChunkZ = minBlockZ >> 4; ++ int maxChunkZ = maxBlockZ >> 4; ++ ++ for (int currChunkZ = minChunkZ; currChunkZ <= maxChunkZ; ++currChunkZ) { ++ int minZ = currChunkZ == minChunkZ ? minBlockZ & 15 : 0; // coordinate in chunk ++ int maxZ = currChunkZ == maxChunkZ ? maxBlockZ & 15 : 16; // coordinate in chunk ++ ++ for (int currChunkX = minChunkX; currChunkX <= maxChunkX; ++currChunkX) { ++ int minX = currChunkX == minChunkX ? minBlockX & 15 : 0; // coordinate in chunk ++ int maxX = currChunkX == maxChunkX ? maxBlockX & 15 : 16; // coordinate in chunk ++ ++ net.minecraft.world.level.chunk.ChunkAccess chunk = this.level.getChunkIfLoadedImmediately(currChunkX, currChunkZ); ++ if (chunk == null) { ++ return false; // if we're touching an unloaded chunk then it's false ++ } ++ ++ net.minecraft.world.level.chunk.LevelChunkSection[] sections = chunk.getSections(); ++ ++ for (int currY = minYIterate; currY < maxYIterate; ++currY) { ++ net.minecraft.world.level.chunk.LevelChunkSection section = sections[(currY >> 4) - minSection]; ++ ++ if (section == null || section.hasOnlyAir() || section.fluidStateCount == 0) { // if no fluids, nothing in this section ++ // empty ++ // skip to next section ++ currY = (currY & ~(15)) + 15; // increment by 15: iterator loop increments by the extra one ++ continue; ++ } ++ ++ net.minecraft.world.level.chunk.PalettedContainer blocks = section.states; ++ ++ for (int currZ = minZ; currZ < maxZ; ++currZ) { ++ for (int currX = minX; currX < maxX; ++currX) { ++ FluidState fluid = blocks.get(currX & 15, currY & 15, currZ & 15).getFluidState(); + + if (fluid.is(tag)) { +- double d2 = (double) ((float) i2 + fluid.getHeight(this.level, blockposition_mutableblockposition)); ++ blockposition_mutableblockposition.set((currChunkX << 4) + currX, currY, (currChunkZ << 4) + currZ); ++ double d2 = (double) ((float) currY + fluid.getHeight(this.level, blockposition_mutableblockposition)); + + if (d2 >= axisalignedbb.minY) { + flag1 = true; +@@ -4121,9 +4204,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + // CraftBukkit end + } + } ++ } ++ } + } + } + } ++ // Pufferfish end + + if (vec3d.length() > 0.0D) { + if (k1 > 0) { +diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java +index e5cd4b7609243669c9d84ff8a4988c209e6101aa..4f3708f5f5dcb6af8225bda1cc9204a6d974665f 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityType.java ++++ b/src/main/java/net/minecraft/world/entity/EntityType.java +@@ -293,6 +293,8 @@ public class EntityType implements FeatureElement, EntityTypeT + private final boolean canSpawnFarFromPlayer; + private final int clientTrackingRange; + private final int updateInterval; ++ public boolean dabEnabled = false; // Pufferfish ++ public int ttl = -1; // Pufferfish + @Nullable + private String descriptionId; + @Nullable +diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java +index 9e075de3542bda8ae086c9ca68bcd00b16d565d0..d134e88ae9aa2bd0b2b51056bfcc37941c713002 100644 +--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java ++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +@@ -143,7 +143,6 @@ import org.bukkit.event.entity.EntityTeleportEvent; + import org.bukkit.event.player.PlayerItemConsumeEvent; + // CraftBukkit end + +-import co.aikar.timings.MinecraftTimings; // Paper + + public abstract class LivingEntity extends Entity { + +@@ -402,7 +401,7 @@ public abstract class LivingEntity extends Entity { + boolean flag = this instanceof net.minecraft.world.entity.player.Player; + + if (!this.level.isClientSide) { +- if (this.isInWall()) { ++ if ((!gg.pufferfish.pufferfish.PufferfishConfig.enableSuffocationOptimization || (tickCount % 10 == 0 && couldPossiblyBeHurt(1.0F))) && this.isInWall()) { // Pufferfish - optimize suffocation + this.hurt(DamageSource.IN_WALL, 1.0F); + } else if (flag && !this.level.getWorldBorder().isWithinBounds(this.getBoundingBox())) { + double d0 = this.level.getWorldBorder().getDistanceToBorder(this) + this.level.getWorldBorder().getDamageSafeZone(); +@@ -1327,6 +1326,15 @@ public abstract class LivingEntity extends Entity { + return this.getHealth() <= 0.0F; + } + ++ // Pufferfish start - optimize suffocation ++ public boolean couldPossiblyBeHurt(float amount) { ++ if ((float) this.invulnerableTime > (float) this.invulnerableDuration / 2.0F && amount <= this.lastHurt) { ++ return false; ++ } ++ return true; ++ } ++ // Pufferfish end ++ + @Override + public boolean hurt(DamageSource source, float amount) { + if (this.isInvulnerableTo(source)) { +@@ -1934,6 +1942,20 @@ public abstract class LivingEntity extends Entity { + return this.lastClimbablePos; + } + ++ ++ // Pufferfish start ++ private boolean cachedOnClimable = false; ++ private BlockPos lastClimbingPosition = null; ++ ++ public boolean onClimableCached() { ++ if (!this.blockPosition().equals(this.lastClimbingPosition)) { ++ this.cachedOnClimable = this.onClimbable(); ++ this.lastClimbingPosition = this.blockPosition(); ++ } ++ return this.cachedOnClimable; ++ } ++ // Pufferfish end ++ + public boolean onClimbable() { + if (this.isSpectator()) { + return false; +@@ -3647,7 +3669,10 @@ public abstract class LivingEntity extends Entity { + Vec3 vec3d1 = new Vec3(entity.getX(), entity.getEyeY(), entity.getZ()); + + // Paper - diff on change - used in CraftLivingEntity#hasLineOfSight(Location) and CraftWorld#lineOfSightExists +- return vec3d1.distanceToSqr(vec3d) > 128D * 128D ? false : this.level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this)).getType() == HitResult.Type.MISS; // Paper - use distanceToSqr ++ // Pufferfish start ++ //return vec3d1.distanceToSqr(vec3d) > 128D * 128D ? false : this.level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this)).getType() == HitResult.Type.MISS; // Paper - use distanceToSqr ++ return vec3d1.distanceToSqr(vec3d) > 128D * 128D ? false : this.level.rayTraceDirect(vec3d, vec3d1, net.minecraft.world.phys.shapes.CollisionContext.of(this)) == net.minecraft.world.phys.BlockHitResult.Type.MISS; ++ // Pufferfish end + } + } + +diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java +index 49b983064ea810382b6112f5dc7f93ba4e5710bd..94b45579dc371ee980565aed2f5dee78ebd44427 100644 +--- a/src/main/java/net/minecraft/world/entity/Mob.java ++++ b/src/main/java/net/minecraft/world/entity/Mob.java +@@ -210,14 +210,16 @@ public abstract class Mob extends LivingEntity { + return this.lookControl; + } + ++ int _pufferfish_inactiveTickDisableCounter = 0; // Pufferfish - throttle inactive goal selector ticking + // Paper start + @Override + public void inactiveTick() { + super.inactiveTick(); +- if (this.goalSelector.inactiveTick()) { ++ boolean isThrottled = gg.pufferfish.pufferfish.PufferfishConfig.throttleInactiveGoalSelectorTick && _pufferfish_inactiveTickDisableCounter++ % 20 != 0; // Pufferfish - throttle inactive goal selector ticking ++ if (this.goalSelector.inactiveTick(this.activatedPriority, true) && !isThrottled) { // Pufferfish - pass activated priroity // Pufferfish - throttle inactive goal selector ticking + this.goalSelector.tick(); + } +- if (this.targetSelector.inactiveTick()) { ++ if (this.targetSelector.inactiveTick(this.activatedPriority, true)) { // Pufferfish - pass activated priority + this.targetSelector.tick(); + } + } +@@ -878,16 +880,20 @@ public abstract class Mob extends LivingEntity { + + if (i % 2 != 0 && this.tickCount > 1) { + this.level.getProfiler().push("targetSelector"); ++ if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking + this.targetSelector.tickRunningGoals(false); + this.level.getProfiler().pop(); + this.level.getProfiler().push("goalSelector"); ++ if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking + this.goalSelector.tickRunningGoals(false); + this.level.getProfiler().pop(); + } else { + this.level.getProfiler().push("targetSelector"); ++ if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking + this.targetSelector.tick(); + this.level.getProfiler().pop(); + this.level.getProfiler().push("goalSelector"); ++ if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking + this.goalSelector.tick(); + this.level.getProfiler().pop(); + } +diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java +index dd1102d5291ef6f18e82400a6d8a0a376cc071e9..e283eb57c25f7de222f9d09dca851169f5f6e488 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java ++++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java +@@ -23,9 +23,11 @@ public class AttributeMap { + private final Map attributes = Maps.newHashMap(); + private final Set dirtyAttributes = Sets.newHashSet(); + private final AttributeSupplier supplier; ++ private final java.util.function.Function createInstance; // Pufferfish + + public AttributeMap(AttributeSupplier defaultAttributes) { + this.supplier = defaultAttributes; ++ this.createInstance = attribute -> this.supplier.createInstance(this::onAttributeModified, attribute); // Pufferfish + } + + private void onAttributeModified(AttributeInstance instance) { +@@ -45,11 +47,10 @@ public class AttributeMap { + }).collect(Collectors.toList()); + } + ++ + @Nullable + public AttributeInstance getInstance(Attribute attribute) { +- return this.attributes.computeIfAbsent(attribute, (attributex) -> { +- return this.supplier.createInstance(this::onAttributeModified, attributex); +- }); ++ return this.attributes.computeIfAbsent(attribute, this.createInstance); // Pufferfish - cache lambda, as for some reason java allocates it anyways + } + + @Nullable +diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java +index d4c91e0a0c64fcb7f1145de3f30134cb1f1f8ee6..fe502445a77afe7e3807afae48d7bf03f370e290 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java ++++ b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java +@@ -47,6 +47,7 @@ public class AcquirePoi { + return false; + } else { + mutableLong.setValue(time + 20L + (long)world.getRandom().nextInt(20)); ++ if (entity.getNavigation().isStuck()) mutableLong.add(200); // Pufferfish - wait an additional 10s to check again if they're stuck + PoiManager poiManager = world.getPoiManager(); + long2ObjectMap.long2ObjectEntrySet().removeIf((entry) -> { + return !entry.getValue().isStillValid(time); +diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java b/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java +index 646d9a121d908a2fc3e4e302484dd5cd1bfc6804..e546ecdccde352502e26a8668eaaafe048d6e282 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java ++++ b/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java +@@ -37,7 +37,11 @@ public class VillagerPanicTrigger extends Behavior { + + @Override + protected void tick(ServerLevel world, Villager entity, long time) { +- if (time % 100L == 0L) { ++ // Pufferfish start ++ if (entity.nextGolemPanic < 0) entity.nextGolemPanic = time + 100; ++ if (--entity.nextGolemPanic < time) { ++ entity.nextGolemPanic = -1; ++ // Pufferfish end + entity.spawnGolemIfNeeded(world, time, 3); + } + +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 b738ee2d3801fadfd09313f05ae24593e56b0ec6..1635818fc4b1788c0d397085239df6dd75b210ab 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java +@@ -53,9 +53,12 @@ public class GoalSelector { + } + + // Paper start +- public boolean inactiveTick() { ++ public boolean inactiveTick(int tickRate, boolean inactive) { // Pufferfish start ++ if (inactive && !gg.pufferfish.pufferfish.PufferfishConfig.dearEnabled) tickRate = 4; // reset to Paper's ++ tickRate = Math.min(tickRate, this.newGoalRate); + this.curRate++; +- return this.curRate % this.newGoalRate == 0; ++ return this.curRate % tickRate == 0; ++ // Pufferfish end + } + public boolean hasTasks() { + for (WrappedGoal task : this.availableGoals) { +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java +index 26bf383caea68834c654b25653ced9017f1b1b22..615eb55e24d365d994fbfe9d45d2be387fd5d561 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java +@@ -119,6 +119,7 @@ public abstract class MoveToBlockGoal extends Goal { + for(int m = 0; m <= l; m = m > 0 ? -m : 1 - m) { + for(int n = m < l && m > -l ? l : 0; n <= l; n = n > 0 ? -n : 1 - n) { + mutableBlockPos.setWithOffset(blockPos, m, k - 1, n); ++ if (!this.mob.level.hasChunkAt(mutableBlockPos)) continue; // Pufferfish - if this block isn't loaded, continue + if (this.mob.isWithinRestriction(mutableBlockPos) && this.isValidTarget(this.mob.level, mutableBlockPos)) { + this.blockPos = mutableBlockPos; + setTargetPosition(mutableBlockPos.immutable()); // Paper +diff --git a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java +index a7575b5ef56af6f53448d391abb4956e130148ca..e752c83df50fb9b670ecea2abc95426c2a009b6f 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java ++++ b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java +@@ -75,9 +75,18 @@ public class TargetingConditions { + } + + if (this.range > 0.0D) { +- double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0D; +- double e = Math.max((this.useFollowRange ? this.getFollowRange(baseEntity) : this.range) * d, 2.0D); // Paper ++ // Pufferfish start - check range before getting visibility ++ // d = invisibility percent, e = follow range adjusted for invisibility, f = distance + double f = baseEntity.distanceToSqr(targetEntity.getX(), targetEntity.getY(), targetEntity.getZ()); ++ double followRangeRaw = this.useFollowRange ? this.getFollowRange(baseEntity) : this.range; ++ ++ if (f > followRangeRaw * followRangeRaw) { // the actual follow range will always be this value or smaller, so if the distance is larger then it never will return true after getting invis ++ return false; ++ } ++ ++ double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0D; ++ double e = Math.max((followRangeRaw) * d, 2.0D); // Paper ++ // Pufferfish end + if (f > e * e) { + return false; + } +diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java +index 320c558bbe80d4bbc641e895ec43cfa2b45e8d70..1572a81ce1718964d795f2a2a411402f88901c73 100644 +--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java ++++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java +@@ -256,13 +256,22 @@ public class Bat extends AmbientCreature { + } + } + ++ // Pufferfish start - only check for spooky season once an hour ++ private static boolean isSpookySeason = false; ++ private static final int ONE_HOUR = 20 * 60 * 60; ++ private static int lastSpookyCheck = -ONE_HOUR; + private static boolean isHalloween() { ++ if (net.minecraft.server.MinecraftServer.currentTick - lastSpookyCheck > ONE_HOUR) { + LocalDate localdate = LocalDate.now(); + int i = localdate.get(ChronoField.DAY_OF_MONTH); + int j = localdate.get(ChronoField.MONTH_OF_YEAR); + +- return j == 10 && i >= 20 || j == 11 && i <= 3; ++ isSpookySeason = j == 10 && i >= 20 || j == 11 && i <= 3; ++ lastSpookyCheck = net.minecraft.server.MinecraftServer.currentTick; ++ } ++ return isSpookySeason; + } ++ // Pufferfish end + + @Override + protected float getStandingEyeHeight(Pose pose, EntityDimensions dimensions) { +diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java +index c0084b1f146a4697194c421519537e612ff737c0..c66a214dfbde7fd8e7a68efaa82ac260178f297f 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java ++++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java +@@ -228,9 +228,11 @@ public class Allay extends PathfinderMob implements InventoryCarrier { + return 0.4F; + } + ++ private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep() { + this.level.getProfiler().push("allayBrain"); ++ if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish + this.getBrain().tick((ServerLevel) this.level, this); + this.level.getProfiler().pop(); + this.level.getProfiler().push("allayActivityUpdate"); +diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java +index 0d7f951e3837de7553d93f3d4525276048feb405..02219f5ca614fefffa1ceb3c7036dfe1c90c8676 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java ++++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java +@@ -285,9 +285,11 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder { + return this.getDeltaMovement().horizontalDistanceSqr() > 1.0E-6D && this.isInWaterOrBubble(); + } + ++ private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep() { + this.level.getProfiler().push("frogBrain"); ++ if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish + this.getBrain().tick((ServerLevel)this.level, this); + this.level.getProfiler().pop(); + this.level.getProfiler().push("frogActivityUpdate"); +diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java +index e8574bd4b412c1db82aaec9dced47b63de9dbf28..35594c5c107e83e5e025233036ae6d060f77c408 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java ++++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java +@@ -76,9 +76,11 @@ public class Tadpole extends AbstractFish { + return SoundEvents.TADPOLE_FLOP; + } + ++ private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep() { + this.level.getProfiler().push("tadpoleBrain"); ++ if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish + this.getBrain().tick((ServerLevel) this.level, this); + this.level.getProfiler().pop(); + this.level.getProfiler().push("tadpoleActivityUpdate"); +diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java +index e9f7c08ae3ea9c578971b1ede88788572c20e277..0f365b9dbb160d90ddf5fcd40895305df48ce916 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java ++++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java +@@ -188,9 +188,11 @@ public class Goat extends Animal { + return (Brain) super.getBrain(); // CraftBukkit - decompile error + } + ++ private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep() { + this.level.getProfiler().push("goatBrain"); ++ if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish + this.getBrain().tick((ServerLevel) this.level, this); + this.level.getProfiler().pop(); + this.level.getProfiler().push("goatActivityUpdate"); +diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +index f0ccdfbd7d7be8c6e302609accf8fe9cac8885c4..c58496c84b2b3f86890050813041fa49711f3a01 100644 +--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java ++++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +@@ -255,10 +255,16 @@ public class ItemEntity extends Entity { + if (entityitem.isMergable()) { + // Paper Start - Fix items merging through walls + if (this.level.paperConfig().fixes.fixItemsMergingThroughWalls) { ++ // Pufferfish start - skip the allocations ++ /* + net.minecraft.world.level.ClipContext rayTrace = new net.minecraft.world.level.ClipContext(this.position(), entityitem.position(), + net.minecraft.world.level.ClipContext.Block.COLLIDER, net.minecraft.world.level.ClipContext.Fluid.NONE, this); + net.minecraft.world.phys.BlockHitResult rayTraceResult = level.clip(rayTrace); + if (rayTraceResult.getType() == net.minecraft.world.phys.HitResult.Type.BLOCK) continue; ++ */ ++ if (level.rayTraceDirect(this.position(), entityitem.position(), net.minecraft.world.phys.shapes.CollisionContext.of(this)) == ++ net.minecraft.world.phys.HitResult.Type.BLOCK) continue; ++ // Pufferfish end + } + // Paper End + this.tryToMerge(entityitem); +diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +index f4002ac7cba7d5e41b4f11b98212c625f6a92a65..ff0e09a7387e7dc9ca136d3e48e640b9e9cb4bf3 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +@@ -322,11 +322,17 @@ public class EnderMan extends Monster implements NeutralMob { + private boolean teleport(double x, double y, double z) { + BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos(x, y, z); + +- while (blockposition_mutableblockposition.getY() > this.level.getMinBuildHeight() && !this.level.getBlockState(blockposition_mutableblockposition).getMaterial().blocksMotion()) { ++ // Pufferfish start - single chunk lookup ++ net.minecraft.world.level.chunk.LevelChunk chunk = this.level.getChunkIfLoaded(blockposition_mutableblockposition); ++ if (chunk == null) { ++ return false; ++ } ++ // Pufferfish end ++ while (blockposition_mutableblockposition.getY() > this.level.getMinBuildHeight() && !chunk.getBlockState(blockposition_mutableblockposition).getMaterial().blocksMotion()) { // Pufferfish + blockposition_mutableblockposition.move(Direction.DOWN); + } + +- BlockState iblockdata = this.level.getBlockState(blockposition_mutableblockposition); ++ BlockState iblockdata = chunk.getBlockState(blockposition_mutableblockposition); // Pufferfish + boolean flag = iblockdata.getMaterial().blocksMotion(); + boolean flag1 = iblockdata.getFluidState().is(FluidTags.WATER); + +diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java +index 45741410a13cffe3419e34b5607b048bbcf1c3ff..5d487f1613b1fc5807283c20e5cc23a432d08f42 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java ++++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java +@@ -126,9 +126,11 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { + return (Brain) super.getBrain(); // Paper - decompile fix + } + ++ private int behaviorTick; // Pufferfish + @Override + protected void customServerAiStep() { + this.level.getProfiler().push("hoglinBrain"); ++ if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish + this.getBrain().tick((ServerLevel)this.level, this); + this.level.getProfiler().pop(); + HoglinAi.updateActivity(this); +diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java +index afa7ecfa8453da510ec5ccecb1ceeb1d9893d259..b401fb4f276ca81b4bb18426ee56abed8a9f7a7b 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java ++++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java +@@ -308,9 +308,11 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento + return !this.cannotHunt; + } + ++ private int behaviorTick; // Pufferfish + @Override + protected void customServerAiStep() { + this.level.getProfiler().push("piglinBrain"); ++ if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish + this.getBrain().tick((ServerLevel) this.level, this); + this.level.getProfiler().pop(); + PiglinAi.updateActivity(this); +diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java +index 1ae7408048f951cb94d7cfbea60efc5567b1af84..904826ea563bd2eb469f403df459def62cc1b5e6 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java ++++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java +@@ -270,11 +270,13 @@ public class Warden extends Monster implements VibrationListener.VibrationListen + + } + ++ private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep() { + ServerLevel worldserver = (ServerLevel) this.level; + + worldserver.getProfiler().push("wardenBrain"); ++ if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish + this.getBrain().tick(worldserver, this); + this.level.getProfiler().pop(); + super.customServerAiStep(); +diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java +index 18eac340386a396c9850f53f30d20a41c1437788..76a9da8209d557b913c49ccd281bf147b9ac4fa4 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java ++++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java +@@ -140,6 +140,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + return holder.is(PoiTypes.MEETING); + }); + ++ public long nextGolemPanic = -1; // Pufferfish ++ + public Villager(EntityType entityType, Level world) { + this(entityType, world, VillagerType.PLAINS); + } +@@ -243,11 +245,17 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + } + // Spigot End + ++ private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep() { mobTick(false); } + protected void mobTick(boolean inactive) { + this.level.getProfiler().push("villagerBrain"); +- if (!inactive) this.getBrain().tick((ServerLevel) this.level, this); // Paper ++ // Pufferfish start ++ if (!inactive) { ++ if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish ++ this.getBrain().tick((ServerLevel) this.level, this); // Paper ++ } ++ // Pufferfish end + this.level.getProfiler().pop(); + if (this.assignProfessionWhenSpawned) { + this.assignProfessionWhenSpawned = false; +diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java +index 5bc033bf59d49eda1f8f2574165bbcbeab7faa0f..004091f2026f3c58d9bce49f1b07f6441df8da8a 100644 +--- a/src/main/java/net/minecraft/world/entity/player/Inventory.java ++++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java +@@ -681,6 +681,8 @@ public class Inventory implements Container, Nameable { + } + + public boolean contains(ItemStack stack) { ++ // Pufferfish start - don't allocate iterators ++ /* + Iterator iterator = this.compartments.iterator(); + + while (iterator.hasNext()) { +@@ -695,6 +697,18 @@ public class Inventory implements Container, Nameable { + } + } + } ++ */ ++ for (int i = 0; i < this.compartments.size(); i++) { ++ List list = this.compartments.get(i); ++ for (int j = 0; j < list.size(); j++) { ++ ItemStack itemstack1 = list.get(j); ++ ++ if (!itemstack1.isEmpty() && itemstack1.sameItem(stack)) { ++ return true; ++ } ++ } ++ } ++ // Pufferfish end + + return false; + } +diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +index 66476b33cede1e44db5ec166a0cea81f82ffe47a..5ccd7dc0a093277d3ea09c0fe8be03c0073ee1a8 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +@@ -43,6 +43,36 @@ public abstract class Projectile extends Entity { + super(type, world); + } + ++ // Pufferfish start ++ private static int loadedThisTick = 0; ++ private static int loadedTick; ++ ++ private int loadedLifetime = 0; ++ @Override ++ public void setPos(double x, double y, double z) { ++ int currentTick = net.minecraft.server.MinecraftServer.currentTick; ++ if (loadedTick != currentTick) { ++ loadedTick = currentTick; ++ loadedThisTick = 0; ++ } ++ int previousX = Mth.floor(this.getX()) >> 4, previousZ = Mth.floor(this.getZ()) >> 4; ++ int newX = Mth.floor(x) >> 4, newZ = Mth.floor(z) >> 4; ++ if (previousX != newX || previousZ != newZ) { ++ boolean isLoaded = ((net.minecraft.server.level.ServerChunkCache) this.level.getChunkSource()).getChunkAtIfLoadedMainThread(newX, newZ) != null; ++ if (!isLoaded) { ++ if (Projectile.loadedThisTick > gg.pufferfish.pufferfish.PufferfishConfig.maxProjectileLoadsPerTick) { ++ if (++this.loadedLifetime > gg.pufferfish.pufferfish.PufferfishConfig.maxProjectileLoadsPerProjectile) { ++ this.discard(); ++ } ++ return; ++ } ++ Projectile.loadedThisTick++; ++ } ++ } ++ super.setPos(x, y, z); ++ } ++ // Pufferfish start ++ + public void setOwner(@Nullable Entity entity) { + if (entity != null) { + this.ownerUUID = entity.getUUID(); +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java +index b8fb7b5a347298ada16bc8b818edf1863e3f6040..43b4c4f9630bfa451d135139236ac6fce034ec15 100644 +--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java +@@ -27,7 +27,10 @@ import org.bukkit.inventory.InventoryHolder; + + public abstract class AbstractMinecartContainer extends AbstractMinecart implements ContainerEntity { + ++ // Pufferfish start + private NonNullList itemStacks; ++ private gg.airplane.structs.ItemListWithBitset itemStacksOptimized; ++ // Pufferfish end + @Nullable + public ResourceLocation lootTable; + public long lootTableSeed; +@@ -89,12 +92,18 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme + + protected AbstractMinecartContainer(EntityType type, Level world) { + super(type, world); +- this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); // CraftBukkit - SPIGOT-3513 ++ // Pufferfish start ++ this.itemStacksOptimized = new gg.airplane.structs.ItemListWithBitset(this.getContainerSize()); // CraftBukkit - SPIGOT-3513 ++ this.itemStacks = this.itemStacksOptimized.nonNullList; ++ // Pufferfish end + } + + protected AbstractMinecartContainer(EntityType type, double x, double y, double z, Level world) { + super(type, world, x, y, z); +- this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); // CraftBukkit - SPIGOT-3513 ++ // Pufferfish start ++ this.itemStacksOptimized = new gg.airplane.structs.ItemListWithBitset(this.getContainerSize()); // CraftBukkit - SPIGOT-3513 ++ this.itemStacks = this.itemStacksOptimized.nonNullList; ++ // Pufferfish end + } + + @Override +@@ -156,6 +165,10 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme + protected void readAdditionalSaveData(CompoundTag nbt) { + super.readAdditionalSaveData(nbt); + this.lootableData.loadNbt(nbt); // Paper ++ // Pufferfish start ++ this.itemStacksOptimized = new gg.airplane.structs.ItemListWithBitset(this.getContainerSize()); ++ this.itemStacks = this.itemStacksOptimized.nonNullList; ++ // Pufferfish end + this.readChestVehicleSaveData(nbt); + } + +diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java +index e7c06d98532160499f2610f69de27e30a326b16f..830622bd92431df5bc4a57fe6785689f8585e14b 100644 +--- a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java ++++ b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java +@@ -26,8 +26,13 @@ public class ShapelessRecipe implements CraftingRecipe { + final CraftingBookCategory category; + final ItemStack result; + final NonNullList ingredients; ++ private final boolean isBukkit; // Pufferfish + ++ // Pufferfish start + public ShapelessRecipe(ResourceLocation id, String group, CraftingBookCategory category, ItemStack output, NonNullList input) { ++ this(id, group, category, output, input, false); ++ } ++ public ShapelessRecipe(ResourceLocation id, String group, CraftingBookCategory category, ItemStack output, NonNullList input, boolean isBukkit) { this.isBukkit = isBukkit; // Pufferfish end + this.id = id; + this.group = group; + this.category = category; +@@ -81,6 +86,28 @@ public class ShapelessRecipe implements CraftingRecipe { + } + + public boolean matches(CraftingContainer inventory, Level world) { ++ // Pufferfish start ++ if (!this.isBukkit) { ++ java.util.List ingredients = com.google.common.collect.Lists.newArrayList(this.ingredients.toArray(new Ingredient[0])); ++ ++ inventory: for (int index = 0; index < inventory.getContainerSize(); index++) { ++ ItemStack itemStack = inventory.getItem(index); ++ ++ if (!itemStack.isEmpty()) { ++ for (int i = 0; i < ingredients.size(); i++) { ++ if (ingredients.get(i).test(itemStack)) { ++ ingredients.remove(i); ++ continue inventory; ++ } ++ } ++ return false; ++ } ++ } ++ ++ return ingredients.isEmpty(); ++ } ++ // Pufferfish end ++ + StackedContents autorecipestackmanager = new StackedContents(); + int i = 0; + +diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java +index d1eefa6ef3e9abfe7af4d8310aa64465fa2d5463..0f4aa330e5b179bb706a31917c671f165e22b9cd 100644 +--- a/src/main/java/net/minecraft/world/level/BlockGetter.java ++++ b/src/main/java/net/minecraft/world/level/BlockGetter.java +@@ -73,6 +73,16 @@ public interface BlockGetter extends LevelHeightAccessor { + }); + } + ++ // Pufferfish start - broken down variant of below rayTraceBlock, used by World#rayTraceDirect ++ default net.minecraft.world.phys.BlockHitResult.Type rayTraceBlockDirect(Vec3 vec3d, Vec3 vec3d1, BlockPos blockposition, BlockState iblockdata, net.minecraft.world.phys.shapes.CollisionContext voxelshapecoll) { ++ if (iblockdata.isAir()) return null; // Tuinity - optimise air cases ++ VoxelShape voxelshape = ClipContext.Block.COLLIDER.get(iblockdata, this, blockposition, voxelshapecoll); ++ net.minecraft.world.phys.BlockHitResult movingobjectpositionblock = this.clipWithInteractionOverride(vec3d, vec3d1, blockposition, voxelshape, iblockdata); ++ ++ return movingobjectpositionblock == null ? null : movingobjectpositionblock.getType(); ++ } ++ // Pufferfish end ++ + // CraftBukkit start - moved block handling into separate method for use by Block#rayTrace + default BlockHitResult clip(ClipContext raytrace1, BlockPos blockposition) { + // Paper start - Prevent raytrace from loading chunks +diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java +index 663c1d8c1611af915a1bae733920dd75ad73feb1..c15e4d95baacd30f9614dc5526dc8fc12ae5bd06 100644 +--- a/src/main/java/net/minecraft/world/level/GameRules.java ++++ b/src/main/java/net/minecraft/world/level/GameRules.java +@@ -98,6 +98,7 @@ public class GameRules { + public static final GameRules.Key RULE_LAVA_SOURCE_CONVERSION = GameRules.register("lavaSourceConversion", GameRules.Category.UPDATES, GameRules.BooleanValue.create(false)); + public static final GameRules.Key RULE_GLOBAL_SOUND_EVENTS = GameRules.register("globalSoundEvents", GameRules.Category.MISC, GameRules.BooleanValue.create(true)); + private final Map, GameRules.Value> rules; ++ private final GameRules.Value[] gameruleArray; + + private static > GameRules.Key register(String name, GameRules.Category category, GameRules.Type type) { + GameRules.Key gamerules_gamerulekey = new GameRules.Key<>(name, category); +@@ -116,17 +117,33 @@ public class GameRules { + } + + public GameRules() { +- this.rules = (Map) GameRules.GAME_RULE_TYPES.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry) -> { ++ // Pufferfish start - use this to ensure gameruleArray is initialized ++ this((Map) GameRules.GAME_RULE_TYPES.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry) -> { + return ((GameRules.Type) entry.getValue()).createRule(); +- })); ++ }))); ++ // Pufferfish end + } + + private GameRules(Map, GameRules.Value> rules) { + this.rules = rules; ++ ++ // Pufferfish start ++ int arraySize = rules.keySet().stream().mapToInt(key -> key.gameRuleIndex).max().orElse(-1) + 1; ++ GameRules.Value[] values = new GameRules.Value[arraySize]; ++ ++ for (Entry, GameRules.Value> entry : rules.entrySet()) { ++ values[entry.getKey().gameRuleIndex] = entry.getValue(); ++ } ++ ++ this.gameruleArray = values; ++ // Pufferfish end + } + + public > T getRule(GameRules.Key key) { +- return (T) this.rules.get(key); // CraftBukkit - decompile error ++ // Pufferfish start ++ return key == null ? null : (T) this.gameruleArray[key.gameRuleIndex]; ++ //return (T) this.rules.get(key); // CraftBukkit - decompile error ++ // Pufferfish end + } + + public CompoundTag createTag() { +@@ -185,6 +202,10 @@ public class GameRules { + } + + public static final class Key> { ++ // Pufferfish start ++ private static int lastGameRuleIndex = 0; ++ public final int gameRuleIndex = lastGameRuleIndex++; ++ // Pufferfish end + + final String id; + private final GameRules.Category category; +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index 3cbf801b2e5420c0e870f73788deb550e49ad54d..edd2c236ca7c37e1a3aec0048b8974f4cd62f2cc 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -270,6 +270,17 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + + public abstract ResourceKey getTypeKey(); + ++ protected final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(java.util.concurrent.ThreadLocalRandom.current().nextLong()); public net.minecraft.util.RandomSource getThreadUnsafeRandom() { return this.randomTickRandom; } // Pufferfish - move thread unsafe random initialization // Pufferfish - getter ++ ++ // Pufferfish start - ensure these get inlined ++ private final int minBuildHeight, minSection, height, maxBuildHeight, maxSection; ++ @Override public final int getMaxBuildHeight() { return this.maxBuildHeight; } ++ @Override public final int getMinSection() { return this.minSection; } ++ @Override public final int getMaxSection() { return this.maxSection; } ++ @Override public final int getMinBuildHeight() { return this.minBuildHeight; } ++ @Override public final int getHeight() { return this.height; } ++ // Pufferfish end ++ + protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, Holder holder, Supplier supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor + this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot + this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper +@@ -292,6 +303,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + }); + final DimensionType dimensionmanager = (DimensionType) holder.value(); + ++ // Pufferfish start ++ this.minBuildHeight = dimensionmanager.minY(); ++ this.minSection = SectionPos.blockToSectionCoord(this.minBuildHeight); ++ this.height = dimensionmanager.height(); ++ this.maxBuildHeight = this.minBuildHeight + this.height; ++ this.maxSection = SectionPos.blockToSectionCoord(this.maxBuildHeight - 1) + 1; ++ // Pufferfish end + this.dimension = resourcekey; + this.isClientSide = flag; + if (dimensionmanager.coordinateScale() != 1.0D) { +@@ -407,6 +425,91 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + return null; + } + ++ // Pufferfish start - broken down method of raytracing for EntityLiving#hasLineOfSight, replaces IBlockAccess#rayTrace(RayTrace) ++ public net.minecraft.world.phys.BlockHitResult.Type rayTraceDirect(net.minecraft.world.phys.Vec3 vec3d, net.minecraft.world.phys.Vec3 vec3d1, net.minecraft.world.phys.shapes.CollisionContext voxelshapecoll) { ++ // most of this code comes from IBlockAccess#a(RayTrace, BiFunction, Function), but removes the needless functions ++ if (vec3d.equals(vec3d1)) { ++ return net.minecraft.world.phys.BlockHitResult.Type.MISS; ++ } ++ ++ double endX = Mth.lerp(-1.0E-7D, vec3d1.x, vec3d.x); ++ double endY = Mth.lerp(-1.0E-7D, vec3d1.y, vec3d.y); ++ double endZ = Mth.lerp(-1.0E-7D, vec3d1.z, vec3d.z); ++ ++ double startX = Mth.lerp(-1.0E-7D, vec3d.x, vec3d1.x); ++ double startY = Mth.lerp(-1.0E-7D, vec3d.y, vec3d1.y); ++ double startZ = Mth.lerp(-1.0E-7D, vec3d.z, vec3d1.z); ++ ++ int currentX = Mth.floor(startX); ++ int currentY = Mth.floor(startY); ++ int currentZ = Mth.floor(startZ); ++ ++ BlockPos.MutableBlockPos currentBlock = new BlockPos.MutableBlockPos(currentX, currentY, currentZ); ++ ++ LevelChunk chunk = this.getChunkIfLoaded(currentBlock); ++ if (chunk == null) { ++ return net.minecraft.world.phys.BlockHitResult.Type.MISS; ++ } ++ ++ net.minecraft.world.phys.BlockHitResult.Type initialCheck = this.rayTraceBlockDirect(vec3d, vec3d1, currentBlock, chunk.getBlockState(currentBlock), voxelshapecoll); ++ ++ if (initialCheck != null) { ++ return initialCheck; ++ } ++ ++ double diffX = endX - startX; ++ double diffY = endY - startY; ++ double diffZ = endZ - startZ; ++ ++ int xDirection = Mth.sign(diffX); ++ int yDirection = Mth.sign(diffY); ++ int zDirection = Mth.sign(diffZ); ++ ++ double normalizedX = xDirection == 0 ? Double.MAX_VALUE : (double) xDirection / diffX; ++ double normalizedY = yDirection == 0 ? Double.MAX_VALUE : (double) yDirection / diffY; ++ double normalizedZ = zDirection == 0 ? Double.MAX_VALUE : (double) zDirection / diffZ; ++ ++ double normalizedXDirection = normalizedX * (xDirection > 0 ? 1.0D - Mth.frac(startX) : Mth.frac(startX)); ++ double normalizedYDirection = normalizedY * (yDirection > 0 ? 1.0D - Mth.frac(startY) : Mth.frac(startY)); ++ double normalizedZDirection = normalizedZ * (zDirection > 0 ? 1.0D - Mth.frac(startZ) : Mth.frac(startZ)); ++ ++ net.minecraft.world.phys.BlockHitResult.Type result; ++ ++ do { ++ if (normalizedXDirection > 1.0D && normalizedYDirection > 1.0D && normalizedZDirection > 1.0D) { ++ return net.minecraft.world.phys.BlockHitResult.Type.MISS; ++ } ++ ++ if (normalizedXDirection < normalizedYDirection) { ++ if (normalizedXDirection < normalizedZDirection) { ++ currentX += xDirection; ++ normalizedXDirection += normalizedX; ++ } else { ++ currentZ += zDirection; ++ normalizedZDirection += normalizedZ; ++ } ++ } else if (normalizedYDirection < normalizedZDirection) { ++ currentY += yDirection; ++ normalizedYDirection += normalizedY; ++ } else { ++ currentZ += zDirection; ++ normalizedZDirection += normalizedZ; ++ } ++ ++ currentBlock.set(currentX, currentY, currentZ); ++ if (chunk.getPos().x != currentBlock.getX() >> 4 || chunk.getPos().z != currentBlock.getZ() >> 4) { ++ chunk = this.getChunkIfLoaded(currentBlock); ++ if (chunk == null) { ++ return net.minecraft.world.phys.BlockHitResult.Type.MISS; ++ } ++ } ++ result = this.rayTraceBlockDirect(vec3d, vec3d1, currentBlock, chunk.getBlockState(currentBlock), voxelshapecoll); ++ } while (result == null); ++ ++ return result; ++ } ++ // Pufferfish end ++ + public boolean isInWorldBounds(BlockPos pos) { + return pos.isInsideBuildHeightAndWorldBoundsHorizontal(this); // Paper - use better/optimized check + } +@@ -917,13 +1020,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + try { + tickConsumer.accept(entity); + MinecraftServer.getServer().executeMidTickTasks(); // Paper - execute chunk tasks mid tick +- } catch (Throwable throwable) { ++ } catch (Throwable throwable) { // Pufferfish - diff on change ServerLevel.tick + if (throwable instanceof ThreadDeath) throw throwable; // Paper + // Paper start - Prevent tile entity and entity crashes + final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level.getWorld().getName(), entity.getX(), entity.getY(), entity.getZ()); + MinecraftServer.LOGGER.error(msg, throwable); + getCraftServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable))); +- entity.discard(); ++ entity.discard(); // Pufferfish - diff on change ServerLevel.tick + // Paper end + } + } +@@ -1450,6 +1553,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + } + + public ProfilerFiller getProfiler() { ++ if (gg.pufferfish.pufferfish.PufferfishConfig.disableMethodProfiler) return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Pufferfish + return (ProfilerFiller) this.profiler.get(); + } + +diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +index 01b21f520ef1c834b9bafc3de85c1fa4fcf539d6..5521418fa307b3eeb4f02a10c39f05b360d1d06e 100644 +--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java ++++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +@@ -417,12 +417,12 @@ public final class NaturalSpawner { + } + } + +- private static BlockPos getRandomPosWithin(Level world, LevelChunk chunk) { ++ private static BlockPos getRandomPosWithin(ServerLevel world, LevelChunk chunk) { // Pufferfish - accept serverlevel + ChunkPos chunkcoordintpair = chunk.getPos(); +- int i = chunkcoordintpair.getMinBlockX() + world.random.nextInt(16); +- int j = chunkcoordintpair.getMinBlockZ() + world.random.nextInt(16); ++ int i = chunkcoordintpair.getMinBlockX() + world.getThreadUnsafeRandom().nextInt(16); // Pufferfish - use thread unsafe random ++ int j = chunkcoordintpair.getMinBlockZ() + world.getThreadUnsafeRandom().nextInt(16); // Pufferfish + int k = chunk.getHeight(Heightmap.Types.WORLD_SURFACE, i, j) + 1; +- int l = Mth.randomBetweenInclusive(world.random, world.getMinBuildHeight(), k); ++ int l = Mth.randomBetweenInclusive(world.getThreadUnsafeRandom(), world.getMinBuildHeight(), k); // Pufferfish + + return new BlockPos(i, l, j); + } +diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java +index c4f1173aab1e53412a65793e06238e637910475a..a4c484cacbf6cec7b9225f3f66a05827bf8ef7a3 100644 +--- a/src/main/java/net/minecraft/world/level/biome/Biome.java ++++ b/src/main/java/net/minecraft/world/level/biome/Biome.java +@@ -66,14 +66,20 @@ public final class Biome { + private final BiomeGenerationSettings generationSettings; + private final MobSpawnSettings mobSettings; + private final BiomeSpecialEffects specialEffects; +- private final ThreadLocal temperatureCache = ThreadLocal.withInitial(() -> { ++ // Pufferfish start - use our cache ++ private final ThreadLocal temperatureCache = ThreadLocal.withInitial(() -> { + return Util.make(() -> { ++ /* + Long2FloatLinkedOpenHashMap long2FloatLinkedOpenHashMap = new Long2FloatLinkedOpenHashMap(1024, 0.25F) { + protected void rehash(int i) { + } + }; + long2FloatLinkedOpenHashMap.defaultReturnValue(Float.NaN); + return long2FloatLinkedOpenHashMap; ++ ++ */ ++ return new gg.airplane.structs.Long2FloatAgingCache(TEMPERATURE_CACHE_SIZE); ++ // Pufferfish end + }); + }); + +@@ -114,17 +120,15 @@ public final class Biome { + @Deprecated + public float getTemperature(BlockPos blockPos) { + long l = blockPos.asLong(); +- Long2FloatLinkedOpenHashMap long2FloatLinkedOpenHashMap = this.temperatureCache.get(); +- float f = long2FloatLinkedOpenHashMap.get(l); ++ // Pufferfish start ++ gg.airplane.structs.Long2FloatAgingCache cache = this.temperatureCache.get(); ++ float f = cache.getValue(l); + if (!Float.isNaN(f)) { + return f; + } else { + float g = this.getHeightAdjustedTemperature(blockPos); +- if (long2FloatLinkedOpenHashMap.size() == 1024) { +- long2FloatLinkedOpenHashMap.removeFirstFloat(); +- } +- +- long2FloatLinkedOpenHashMap.put(l, g); ++ cache.putValue(l, g); ++ // Pufferfish end + return g; + } + } +diff --git a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java +index a71414397bd45ee7bcacfeef0041d80dfa25f114..d66806565770cb03a21794f99e5c4b0f3040b26a 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java +@@ -31,7 +31,10 @@ import org.bukkit.entity.HumanEntity; + public class ChestBlockEntity extends RandomizableContainerBlockEntity implements LidBlockEntity { + + private static final int EVENT_SET_OPEN_COUNT = 1; ++ // Pufferfish start + private NonNullList items; ++ private gg.airplane.structs.ItemListWithBitset optimizedItems; ++ // Pufferfish end + public final ContainerOpenersCounter openersCounter; + private final ChestLidController chestLidController; + +@@ -65,9 +68,13 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement + } + // CraftBukkit end + ++ private final boolean isNative = getClass().equals(ChestBlockEntity.class); // Pufferfish + protected ChestBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); +- this.items = NonNullList.withSize(27, ItemStack.EMPTY); ++ // Pufferfish start ++ this.optimizedItems = new gg.airplane.structs.ItemListWithBitset(27); ++ this.items = this.optimizedItems.nonNullList; ++ // Pufferfish end + this.openersCounter = new ContainerOpenersCounter() { + @Override + protected void onOpen(Level world, BlockPos pos, BlockState state) { +@@ -98,6 +105,23 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement + this.chestLidController = new ChestLidController(); + } + ++ // Pufferfish start ++ @Override ++ public boolean hasEmptySlot(Direction enumdirection) { ++ return isNative ? !this.optimizedItems.hasFullStacks() : super.hasEmptySlot(enumdirection); ++ } ++ ++ @Override ++ public boolean isCompletelyFull(Direction enumdirection) { ++ return isNative ? this.optimizedItems.hasFullStacks() && super.isCompletelyFull(enumdirection) : super.isCompletelyFull(enumdirection); ++ } ++ ++ @Override ++ public boolean isCompletelyEmpty(Direction enumdirection) { ++ return isNative && this.optimizedItems.isCompletelyEmpty() || super.isCompletelyEmpty(enumdirection); ++ } ++ // Pufferfish end ++ + public ChestBlockEntity(BlockPos pos, BlockState state) { + this(BlockEntityType.CHEST, pos, state); + } +@@ -115,7 +139,10 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement + @Override + public void load(CompoundTag nbt) { + super.load(nbt); +- this.items = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); ++ // Pufferfish start ++ this.optimizedItems = new gg.airplane.structs.ItemListWithBitset(this.getContainerSize()); ++ this.items = this.optimizedItems.nonNullList; ++ // Pufferfish end + if (!this.tryLoadLootTable(nbt)) { + ContainerHelper.loadAllItems(nbt, this.items); + } +@@ -187,7 +214,10 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement + + @Override + protected void setItems(NonNullList list) { +- this.items = list; ++ // Pufferfish start ++ this.optimizedItems = gg.airplane.structs.ItemListWithBitset.fromList(list); ++ this.items = this.optimizedItems.nonNullList; ++ // Pufferfish end + } + + @Override +diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +index ccad692aba2ed77259f6814d88f01b91ed9d229b..698a0ac71cf9fb409d609a81cc2958121260a46d 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +@@ -43,7 +43,10 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen + + public static final int MOVE_ITEM_SPEED = 8; + public static final int HOPPER_CONTAINER_SIZE = 5; ++ // Pufferfish start + private NonNullList items; ++ private gg.airplane.structs.ItemListWithBitset optimizedItems; // Pufferfish ++ // Pufferfish end + private int cooldownTime; + private long tickedGameTime; + +@@ -79,14 +82,37 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen + + public HopperBlockEntity(BlockPos pos, BlockState state) { + super(BlockEntityType.HOPPER, pos, state); +- this.items = NonNullList.withSize(5, ItemStack.EMPTY); ++ // Pufferfish start ++ this.optimizedItems = new gg.airplane.structs.ItemListWithBitset(5); ++ this.items = this.optimizedItems.nonNullList; ++ // Pufferfish end + this.cooldownTime = -1; + } + ++ // Pufferfish start ++ @Override ++ public boolean hasEmptySlot(Direction enumdirection) { ++ return !this.optimizedItems.hasFullStacks(); ++ } ++ ++ @Override ++ public boolean isCompletelyFull(Direction enumdirection) { ++ return this.optimizedItems.hasFullStacks() && super.isCompletelyFull(enumdirection); ++ } ++ ++ @Override ++ public boolean isCompletelyEmpty(Direction enumdirection) { ++ return this.optimizedItems.isCompletelyEmpty() || super.isCompletelyEmpty(enumdirection); ++ } ++ // Pufferfish end ++ + @Override + public void load(CompoundTag nbt) { + super.load(nbt); +- this.items = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); ++ // Pufferfish start ++ this.optimizedItems = new gg.airplane.structs.ItemListWithBitset(this.getContainerSize()); ++ this.items = this.optimizedItems.nonNullList; ++ // Pufferfish end + if (!this.tryLoadLootTable(nbt)) { + ContainerHelper.loadAllItems(nbt, this.items); + } +@@ -158,7 +184,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen + flag = HopperBlockEntity.ejectItems(world, pos, state, (Container) blockEntity, blockEntity); // CraftBukkit + } + +- if (!blockEntity.inventoryFull()) { ++ if (!blockEntity.optimizedItems.hasFullStacks() || !blockEntity.inventoryFull()) { // Pufferfish - use bitset first + flag |= booleansupplier.getAsBoolean(); + } + +@@ -197,7 +223,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen + skipPushModeEventFire = skipHopperEvents; + boolean foundItem = false; + for (int i = 0; i < hopper.getContainerSize(); ++i) { +- ItemStack item = hopper.getItem(i); ++ ItemStack item = hopper.getItem(i); // Pufferfish + if (!item.isEmpty()) { + foundItem = true; + ItemStack origItemStack = item; +@@ -400,12 +426,18 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen + } + + private static boolean isFullContainer(Container inventory, Direction direction) { +- return allMatch(inventory, direction, STACK_SIZE_TEST); // Paper - no streams ++ // Pufferfish start - use bitsets ++ //return allMatch(inventory, direction, STACK_SIZE_TEST); // Paper - no streams ++ return inventory.isCompletelyFull(direction); ++ // Pufferfish end + } + + private static boolean isEmptyContainer(Container inv, Direction facing) { + // Paper start +- return allMatch(inv, facing, IS_EMPTY_TEST); ++ // Pufferfish start - use bitsets ++ //return allMatch(inv, facing, IS_EMPTY_TEST); ++ return inv.isCompletelyEmpty(facing); ++ // Pufferfish end + } + private static boolean allMatch(Container iinventory, Direction enumdirection, java.util.function.BiPredicate test) { + if (iinventory instanceof WorldlyContainer) { +@@ -582,7 +614,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen + + if (HopperBlockEntity.canPlaceItemInContainer(to, stack, slot, side)) { + boolean flag = false; +- boolean flag1 = to.isEmpty(); ++ boolean flag1 = to.isCompletelyEmpty(side); // Pufferfish + + if (itemstack1.isEmpty()) { + // Spigot start - SPIGOT-6693, InventorySubcontainer#setItem +@@ -730,7 +762,10 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen + + @Override + protected void setItems(NonNullList list) { +- this.items = list; ++ // Pufferfish start ++ this.optimizedItems = gg.airplane.structs.ItemListWithBitset.fromList(list); ++ this.items = this.optimizedItems.nonNullList; ++ // Pufferfish end + } + + public static void entityInside(Level world, BlockPos pos, BlockState state, Entity entity, HopperBlockEntity blockEntity) { +diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java +index d559f93a9a09bac414dd5d58afccad42c127f09b..13e749a3c40f0b2cc002f13675a9a56eedbefdac 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java +@@ -96,13 +96,8 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc + public boolean isEmpty() { + this.unpackLootTable((Player)null); + // Paper start +- for (ItemStack itemStack : this.getItems()) { +- if (!itemStack.isEmpty()) { +- return false; +- } +- } ++ return this.isCompletelyEmpty(null); // Pufferfish - use super + // Paper end +- return true; + } + + @Override +diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +index 28e4b302284f955a73e75d0f4276d55fb51826f5..de7a5f3812a017131fd1b32fbeff10e325b1cd2e 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +@@ -88,6 +88,18 @@ public class LevelChunk extends ChunkAccess { + private final LevelChunkTicks blockTicks; + private final LevelChunkTicks fluidTicks; + ++ // Pufferfish start - instead of using a random every time the chunk is ticked, define when lightning strikes preemptively ++ private int lightningTick; ++ // shouldDoLightning compiles down to 29 bytes, which with the default of 35 byte inlining should guarantee an inline ++ public final boolean shouldDoLightning(net.minecraft.util.RandomSource random) { ++ if (this.lightningTick-- <= 0) { ++ this.lightningTick = random.nextInt(this.level.spigotConfig.thunderChance) << 1; ++ return true; ++ } ++ return false; ++ } ++ // Pufferfish end ++ + public LevelChunk(Level world, ChunkPos pos) { + this(world, pos, UpgradeData.EMPTY, new LevelChunkTicks<>(), new LevelChunkTicks<>(), 0L, (LevelChunkSection[]) null, (LevelChunk.PostLoadProcessor) null, (BlendingData) null); + } +@@ -118,6 +130,7 @@ public class LevelChunk extends ChunkAccess { + this.fluidTicks = fluidTickScheduler; + // CraftBukkit start + this.bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this); ++ this.lightningTick = this.level.getThreadUnsafeRandom().nextInt(100000) << 1; // Pufferfish - initialize lightning tick + } + + public org.bukkit.Chunk bukkitChunk; +diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +index b0c9fce9d4e06cac139e341d218d0b6aac1f1943..f25467ad1c5bac7eaef4b63b2845ad04d7c76e4e 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java ++++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +@@ -27,6 +27,7 @@ public class LevelChunkSection { + public final PalettedContainer states; + // CraftBukkit start - read/write + private PalettedContainer> biomes; ++ public short fluidStateCount; // Pufferfish + public final com.destroystokyo.paper.util.maplist.IBlockDataList tickingList = new com.destroystokyo.paper.util.maplist.IBlockDataList(); // Paper + + public LevelChunkSection(int i, PalettedContainer datapaletteblock, PalettedContainer> palettedcontainerro) { +@@ -198,6 +199,7 @@ public class LevelChunkSection { + + if (!fluid.isEmpty()) { + --this.tickingFluidCount; ++ --this.fluidStateCount; // Pufferfish + } + + if (!state.isAir()) { +@@ -212,6 +214,7 @@ public class LevelChunkSection { + + if (!fluid1.isEmpty()) { + ++this.tickingFluidCount; ++ ++this.fluidStateCount; // Pufferfish + } + + this.updateKnownBlockInfo(x | (z << 4) | (y << 8), iblockdata1, state); // Paper +@@ -260,6 +263,7 @@ public class LevelChunkSection { + if (fluid.isRandomlyTicking()) { + this.tickingFluidCount = (short) (this.tickingFluidCount + 1); + } ++ this.fluidStateCount++; // Pufferfish + } + + }); +diff --git a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java +index 4cdfc433df67afcd455422e9baf56f167dd712ae..57fcf3910f45ce371ac2e237b277b1034caaac4e 100644 +--- a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java ++++ b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java +@@ -8,7 +8,7 @@ import javax.annotation.Nullable; + import net.minecraft.world.entity.Entity; + + public class EntityTickList { +- private final io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet entities = new io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet<>(true); // Paper - rewrite this, always keep this updated - why would we EVER tick an entity that's not ticking? ++ public final io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet entities = new io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet<>(true); // Paper - rewrite this, always keep this updated - why would we EVER tick an entity that's not ticking? // Pufferfish - private->public + + private void ensureActiveIsNotIterated() { + // Paper - replace with better logic, do not delay removals +diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java +index 0ffc131baf5c0edc4f2ca0f466fcdb20be4a47b8..3f72703d2063a082546305eeb0a1b21629ddb1b2 100644 +--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java ++++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java +@@ -43,6 +43,8 @@ public abstract class FlowingFluid extends Fluid { + public static final BooleanProperty FALLING = BlockStateProperties.FALLING; + public static final IntegerProperty LEVEL = BlockStateProperties.LEVEL_FLOWING; + private static final int CACHE_SIZE = 200; ++ // Pufferfish start - use our own cache ++ /* + private static final ThreadLocal> OCCLUSION_CACHE = ThreadLocal.withInitial(() -> { + Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap = new Object2ByteLinkedOpenHashMap(200) { + protected void rehash(int i) {} +@@ -51,6 +53,14 @@ public abstract class FlowingFluid extends Fluid { + object2bytelinkedopenhashmap.defaultReturnValue((byte) 127); + return object2bytelinkedopenhashmap; + }); ++ */ ++ ++ private static final ThreadLocal> localFluidDirectionCache = ThreadLocal.withInitial(() -> { ++ // Pufferfish todo - mess with this number for performance ++ // with 2048 it seems very infrequent on a small world that it has to remove old entries ++ return new gg.airplane.structs.FluidDirectionCache<>(2048); ++ }); ++ // Pufferfish end + private final Map shapes = Maps.newIdentityHashMap(); + + public FlowingFluid() {} +@@ -239,6 +249,8 @@ public abstract class FlowingFluid extends Fluid { + } + + private boolean canPassThroughWall(Direction face, BlockGetter world, BlockPos pos, BlockState state, BlockPos fromPos, BlockState fromState) { ++ // Pufferfish start - modify to use our cache ++ /* + Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap; + + if (!state.getBlock().hasDynamicShape() && !fromState.getBlock().hasDynamicShape()) { +@@ -246,9 +258,16 @@ public abstract class FlowingFluid extends Fluid { + } else { + object2bytelinkedopenhashmap = null; + } ++ */ ++ gg.airplane.structs.FluidDirectionCache cache = null; ++ ++ if (!state.getBlock().hasDynamicShape() && !fromState.getBlock().hasDynamicShape()) { ++ cache = localFluidDirectionCache.get(); ++ } + + Block.BlockStatePairKey block_a; + ++ /* + if (object2bytelinkedopenhashmap != null) { + block_a = new Block.BlockStatePairKey(state, fromState, face); + byte b0 = object2bytelinkedopenhashmap.getAndMoveToFirst(block_a); +@@ -259,11 +278,22 @@ public abstract class FlowingFluid extends Fluid { + } else { + block_a = null; + } ++ */ ++ if (cache != null) { ++ block_a = new Block.BlockStatePairKey(state, fromState, face); ++ Boolean flag = cache.getValue(block_a); ++ if (flag != null) { ++ return flag; ++ } ++ } else { ++ block_a = null; ++ } + + VoxelShape voxelshape = state.getCollisionShape(world, pos); + VoxelShape voxelshape1 = fromState.getCollisionShape(world, fromPos); + boolean flag = !Shapes.mergedFaceOccludes(voxelshape, voxelshape1, face); + ++ /* + if (object2bytelinkedopenhashmap != null) { + if (object2bytelinkedopenhashmap.size() == 200) { + object2bytelinkedopenhashmap.removeLastByte(); +@@ -271,6 +301,11 @@ public abstract class FlowingFluid extends Fluid { + + object2bytelinkedopenhashmap.putAndMoveToFirst(block_a, (byte) (flag ? 1 : 0)); + } ++ */ ++ if (cache != null) { ++ cache.putValue(block_a, flag); ++ } ++ // Pufferfish end + + return flag; + } +diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootContext.java b/src/main/java/net/minecraft/world/level/storage/loot/LootContext.java +index 35f9b11a3a61976c952a2c1c64bb2a932538f54f..9e9ac64764cf0a84e25e75d8d6f516cde6047284 100644 +--- a/src/main/java/net/minecraft/world/level/storage/loot/LootContext.java ++++ b/src/main/java/net/minecraft/world/level/storage/loot/LootContext.java +@@ -41,8 +41,10 @@ public class LootContext { + this.level = world; + this.lootTables = tableGetter; + this.conditions = conditionGetter; +- this.params = ImmutableMap.copyOf(parameters); +- this.dynamicDrops = ImmutableMap.copyOf(drops); ++ // Pufferfish start - use unmodifiable maps instead of immutable ones to skip the copy ++ this.params = java.util.Collections.unmodifiableMap(parameters); ++ this.dynamicDrops = java.util.Collections.unmodifiableMap(drops); ++ // Pufferfish end + } + + public boolean hasParam(LootContextParam parameter) { +diff --git a/src/main/java/net/minecraft/world/phys/shapes/EntityCollisionContext.java b/src/main/java/net/minecraft/world/phys/shapes/EntityCollisionContext.java +index ebe65474a4a05ff1637d7f37ebcfe690af59def5..42142c512b12e5b269c19f1e821c50e7496a5f25 100644 +--- a/src/main/java/net/minecraft/world/phys/shapes/EntityCollisionContext.java ++++ b/src/main/java/net/minecraft/world/phys/shapes/EntityCollisionContext.java +@@ -19,47 +19,66 @@ public class EntityCollisionContext implements CollisionContext { + return defaultValue; + } + }; +- private final boolean descending; +- private final double entityBottom; +- private final ItemStack heldItem; +- private final Predicate canStandOnFluid; ++ // Pufferfish start - remove these and pray no plugin uses them ++ // private final boolean descending; ++ // private final double entityBottom; ++ // private final ItemStack heldItem; ++ // private final Predicate canStandOnFluid; ++ // Pufferfish end + @Nullable + private final Entity entity; + + protected EntityCollisionContext(boolean descending, double minY, ItemStack heldItem, Predicate walkOnFluidPredicate, @Nullable Entity entity) { +- this.descending = descending; +- this.entityBottom = minY; +- this.heldItem = heldItem; +- this.canStandOnFluid = walkOnFluidPredicate; ++ // Pufferfish start - remove these ++ // this.descending = descending; ++ // this.entityBottom = minY; ++ // this.heldItem = heldItem; ++ // this.canStandOnFluid = walkOnFluidPredicate; ++ // Pufferfish end + this.entity = entity; + } + + /** @deprecated */ + @Deprecated + protected EntityCollisionContext(Entity entity) { +- this(entity.isDescending(), entity.getY(), entity instanceof LivingEntity ? ((LivingEntity)entity).getMainHandItem() : ItemStack.EMPTY, entity instanceof LivingEntity ? ((LivingEntity)entity)::canStandOnFluid : (fluidState) -> { +- return false; +- }, entity); ++ // Pufferfish start - remove this ++ // this(entity.isDescending(), entity.getY(), entity instanceof LivingEntity ? ((LivingEntity)entity).getMainHandItem() : ItemStack.EMPTY, entity instanceof LivingEntity ? ((LivingEntity)entity)::canStandOnFluid : (fluidState) -> { ++ // return false; ++ // }, entity); ++ // Pufferfish end ++ this.entity = entity; + } + + @Override + public boolean isHoldingItem(Item item) { +- return this.heldItem.is(item); ++ // Pufferfish start ++ Entity entity = this.entity; ++ if (entity instanceof LivingEntity livingEntity) { ++ return livingEntity.getMainHandItem().is(item); ++ } ++ return ItemStack.EMPTY.is(item); ++ // Pufferfish end + } + + @Override + public boolean canStandOnFluid(FluidState stateAbove, FluidState state) { +- return this.canStandOnFluid.test(state) && !stateAbove.getType().isSame(state.getType()); ++ // Pufferfish start ++ Entity entity = this.entity; ++ if (entity instanceof LivingEntity livingEntity) { ++ return livingEntity.canStandOnFluid(state) && !stateAbove.getType().isSame(state.getType()); ++ } ++ return false; ++ // Pufferfish end + } + + @Override + public boolean isDescending() { +- return this.descending; ++ return this.entity != null && this.entity.isDescending(); // Pufferfish + } + + @Override + public boolean isAbove(VoxelShape shape, BlockPos pos, boolean defaultValue) { +- return this.entityBottom > (double)pos.getY() + shape.max(Direction.Axis.Y) - (double)1.0E-5F; ++ return (this.entity == null ? -Double.MAX_VALUE : entity.getY()) > (double)pos.getY() + shape.max(Direction.Axis.Y) - (double)1.0E-5F; // Pufferfish + } + + @Nullable +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 47df6f4268a63118da8187f4102c876bd37d1680..098b67e6ad74be7698713623ca7fae70f19ac6b3 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -261,7 +261,7 @@ import javax.annotation.Nullable; // Paper + import javax.annotation.Nonnull; // Paper + + public final class CraftServer implements Server { +- private final String serverName = "Paper"; // Paper ++ private final String serverName = "Pufferfish"; // Paper // Pufferfish + private final String serverVersion; + private final String bukkitVersion = Versioning.getBukkitVersion(); + private final Logger logger = Logger.getLogger("Minecraft"); +@@ -1065,6 +1065,11 @@ public final class CraftServer implements Server { + plugin.getDescription().getName(), + "This plugin is not properly shutting down its async tasks when it is being shut down. This task may throw errors during the final shutdown logs and might not complete before process dies." + )); ++ getLogger().log(Level.SEVERE, String.format("%s Stacktrace", worker.getThread().getName())); ++ StackTraceElement[] stackTrace = worker.getThread().getStackTrace(); ++ for (StackTraceElement element : stackTrace) { ++ getLogger().log(Level.SEVERE, " " + element.toString()); ++ } + } + } + // Paper end +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java +index f7ea77dd82d978ad307f99c743efacfb34478b3d..009ab06182359862b8f543030ec4fe4e2572c93c 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java +@@ -44,6 +44,6 @@ public class CraftShapelessRecipe extends ShapelessRecipe implements CraftRecipe + data.set(i, toNMS(ingred.get(i), true)); + } + +- MinecraftServer.getServer().getRecipeManager().addRecipe(new net.minecraft.world.item.crafting.ShapelessRecipe(CraftNamespacedKey.toMinecraft(this.getKey()), this.getGroup(), CraftRecipe.getCategory(this.getCategory()), CraftItemStack.asNMSCopy(this.getResult()), data)); ++ MinecraftServer.getServer().getRecipeManager().addRecipe(new net.minecraft.world.item.crafting.ShapelessRecipe(CraftNamespacedKey.toMinecraft(this.getKey()), this.getGroup(), CraftRecipe.getCategory(this.getCategory()), CraftItemStack.asNMSCopy(this.getResult()), data, true)); + } + } +diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +index 17336102d37a5ab05c3b3c93fcf46961d0ffa7e2..a3c6b3dd87022e2def1f12da7c44c8d529191d1e 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +@@ -433,7 +433,7 @@ public final class CraftMagicNumbers implements UnsafeValues { + + @Override + public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { +- return new com.destroystokyo.paper.PaperVersionFetcher(); ++ return new gg.pufferfish.pufferfish.PufferfishVersionFetcher(); // Pufferfish + } + + @Override +diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java +index 774556a62eb240da42e84db4502e2ed43495be17..80553face9c70c2a3d897681e7761df85b22d464 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java +@@ -11,7 +11,7 @@ public final class Versioning { + public static String getBukkitVersion() { + String result = "Unknown-Version"; + +- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/io.papermc.paper/paper-api/pom.properties"); ++ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/gg.pufferfish.pufferfish/pufferfish-api/pom.properties"); // Pufferfish + Properties properties = new Properties(); + + if (stream != null) { +diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java +index 1b42c98956342832c37f0aa266f85271daa4ba5b..b87756d9a7b04ea2613208984b2583eca3f32af6 100644 +--- a/src/main/java/org/spigotmc/ActivationRange.java ++++ b/src/main/java/org/spigotmc/ActivationRange.java +@@ -38,6 +38,10 @@ import co.aikar.timings.MinecraftTimings; + import net.minecraft.world.entity.schedule.Activity; + import net.minecraft.world.level.Level; + import net.minecraft.world.phys.AABB; ++// Pufferfish start ++import net.minecraft.world.phys.Vec3; ++import java.util.List; ++// Pufferfish end + + public class ActivationRange + { +@@ -216,6 +220,25 @@ public class ActivationRange + for (int i = 0; i < entities.size(); i++) { + Entity entity = entities.get(i); + ActivationRange.activateEntity(entity); ++ ++ // Pufferfish start ++ if (gg.pufferfish.pufferfish.PufferfishConfig.dearEnabled && entity.getType().dabEnabled) { ++ if (!entity.activatedPriorityReset) { ++ entity.activatedPriorityReset = true; ++ entity.activatedPriority = gg.pufferfish.pufferfish.PufferfishConfig.maximumActivationPrio; ++ } ++ Vec3 playerVec = player.position(); ++ Vec3 entityVec = entity.position(); ++ double diffX = playerVec.x - entityVec.x, diffY = playerVec.y - entityVec.y, diffZ = playerVec.z - entityVec.z; ++ int squaredDistance = (int) (diffX * diffX + diffY * diffY + diffZ * diffZ); ++ entity.activatedPriority = squaredDistance > gg.pufferfish.pufferfish.PufferfishConfig.startDistanceSquared ? ++ Math.max(1, Math.min(squaredDistance >> gg.pufferfish.pufferfish.PufferfishConfig.activationDistanceMod, entity.activatedPriority)) : ++ 1; ++ } else { ++ entity.activatedPriority = 1; ++ } ++ // Pufferfish end ++ + } + // Paper end + } +@@ -232,12 +255,12 @@ public class ActivationRange + if ( MinecraftServer.currentTick > entity.activatedTick ) + { + if ( entity.defaultActivationState ) +- { ++ { // Pufferfish - diff on change + entity.activatedTick = MinecraftServer.currentTick; + return; + } + if ( entity.activationType.boundingBox.intersects( entity.getBoundingBox() ) ) +- { ++ { // Pufferfish - diff on change + entity.activatedTick = MinecraftServer.currentTick; + } + } +@@ -291,7 +314,7 @@ public class ActivationRange + if ( entity instanceof LivingEntity ) + { + LivingEntity living = (LivingEntity) entity; +- if ( living.onClimbable() || living.jumping || living.hurtTime > 0 || living.activeEffects.size() > 0 ) // Paper ++ if ( living.onClimableCached() || living.jumping || living.hurtTime > 0 || living.activeEffects.size() > 0 ) // Paper // Pufferfish - use cached + { + return 1; // Paper + } diff --git a/patches/server/0002-Fix-pufferfish-issues.patch b/patches/server/0002-Fix-pufferfish-issues.patch new file mode 100644 index 000000000..51ae043b5 --- /dev/null +++ b/patches/server/0002-Fix-pufferfish-issues.patch @@ -0,0 +1,67 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Sun, 12 Jun 2022 09:18:57 -0500 +Subject: [PATCH] Fix pufferfish issues + + +diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java +index 4232585ab3048dcfd934569beca2f2f21d95f382..9e3f279d759a49c051544f54f76790d549132ac0 100644 +--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java ++++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java +@@ -222,7 +222,7 @@ public class PufferfishConfig { + public static int activationDistanceMod; + + private static void dynamicActivationOfBrains() throws IOException { +- dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", true); ++ dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", false); // Purpur + startDistance = getInt("dab.start-distance", "activation-range.start-distance", 12, + "This value determines how far away an entity has to be", + "from the player to start being effected by DEAR."); +@@ -266,7 +266,7 @@ public class PufferfishConfig { + + public static boolean throttleInactiveGoalSelectorTick; + private static void inactiveGoalSelectorThrottle() { +- getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", true, ++ getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", false, // Purpur + "Throttles the AI goal selector in entity inactive ticks.", + "This can improve performance by a few percent, but has minor gameplay implications."); + } +diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java +index 54a51fc23563ca7843c72c169b1e0d7f51c42412..b398e4966eaa22b644a16f3c473af4769c9bbaf4 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -809,7 +809,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + } + // Paper start - optimise random block ticking + private final BlockPos.MutableBlockPos chunkTickMutablePosition = new BlockPos.MutableBlockPos(); +- // private final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(); // Pufferfish - moved to super ++ private final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(this.random.nextLong()); public net.minecraft.util.RandomSource getThreadUnsafeRandom() { return this.randomTickRandom; } // Pufferfish - moved to super // Purpur - dont break ABI + // Paper end + + private int currentIceAndSnowTick = 0; protected void resetIceAndSnowTick() { this.currentIceAndSnowTick = this.randomTickRandom.nextInt(16); } // Pufferfish +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index edd2c236ca7c37e1a3aec0048b8974f4cd62f2cc..42299fd6ae663b01bb5f010b96887caa744dcb96 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -270,7 +270,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + + public abstract ResourceKey getTypeKey(); + +- protected final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(java.util.concurrent.ThreadLocalRandom.current().nextLong()); public net.minecraft.util.RandomSource getThreadUnsafeRandom() { return this.randomTickRandom; } // Pufferfish - move thread unsafe random initialization // Pufferfish - getter ++ //protected final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(java.util.concurrent.ThreadLocalRandom.current().nextLong()); public net.minecraft.util.RandomSource getThreadUnsafeRandom() { return this.randomTickRandom; } // Pufferfish - move thread unsafe random initialization // Pufferfish - getter // Purpur - dont break ABI + + // Pufferfish start - ensure these get inlined + private final int minBuildHeight, minSection, height, maxBuildHeight, maxSection; +diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +index de7a5f3812a017131fd1b32fbeff10e325b1cd2e..aa327e549949052b5babf4101cc2fc9a37868fa8 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +@@ -130,7 +130,7 @@ public class LevelChunk extends ChunkAccess { + this.fluidTicks = fluidTickScheduler; + // CraftBukkit start + this.bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this); +- this.lightningTick = this.level.getThreadUnsafeRandom().nextInt(100000) << 1; // Pufferfish - initialize lightning tick ++ this.lightningTick = java.util.concurrent.ThreadLocalRandom.current().nextInt(100000) << 1; // Pufferfish - initialize lightning tick // Purpur - any random will do + } + + public org.bukkit.Chunk bukkitChunk; diff --git a/patches/server/0001-Rebrand.patch b/patches/server/0003-Rebrand.patch similarity index 93% rename from patches/server/0001-Rebrand.patch rename to patches/server/0003-Rebrand.patch index ea185009d..c76ae33e9 100644 --- a/patches/server/0001-Rebrand.patch +++ b/patches/server/0003-Rebrand.patch @@ -5,23 +5,22 @@ Subject: [PATCH] Rebrand diff --git a/build.gradle.kts b/build.gradle.kts -index d5d49bb2b47c889e12d17dc87b8c439a60b3fe67..7de4b51cb4afdcbdfb8d1dc32f56252d997e23a8 100644 +index 5752339f2d081c36944d568e0b29ec4fe24f37f9..d5b7458f6b79addf1a12eb82443ba5bdbe2ea5d3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -7,8 +7,10 @@ plugins { +@@ -7,9 +7,9 @@ plugins { } dependencies { -- implementation(project(":paper-api")) -- implementation(project(":paper-mojangapi")) +- implementation(project(":pufferfish-api")) // Pufferfish // Paper + implementation(project(":purpur-api")) // Purpur + // Pufferfish start +- implementation("io.papermc.paper:paper-mojangapi:1.19.2-R0.1-SNAPSHOT") { + implementation("io.papermc.paper:paper-mojangapi:1.19.3-R0.1-SNAPSHOT") { -+ exclude("io.papermc.paper", "paper-api") -+ } - // Paper start - implementation("org.jline:jline-terminal-jansi:3.21.0") - implementation("net.minecrell:terminalconsoleappender:1.3.0") -@@ -37,6 +39,9 @@ dependencies { + exclude("io.papermc.paper", "paper-api") + } + // Pufferfish end +@@ -41,6 +41,9 @@ dependencies { runtimeOnly("mysql:mysql-connector-java:8.0.29") runtimeOnly("com.lmax:disruptor:3.4.4") // Paper @@ -31,16 +30,16 @@ index d5d49bb2b47c889e12d17dc87b8c439a60b3fe67..7de4b51cb4afdcbdfb8d1dc32f56252d runtimeOnly("org.apache.maven:maven-resolver-provider:3.8.5") runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3") runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3") -@@ -61,7 +66,7 @@ tasks.jar { +@@ -80,7 +83,7 @@ tasks.jar { attributes( "Main-Class" to "org.bukkit.craftbukkit.Main", "Implementation-Title" to "CraftBukkit", -- "Implementation-Version" to "git-Paper-$implementationVersion", +- "Implementation-Version" to "git-Pufferfish-$implementationVersion", // Pufferfish + "Implementation-Version" to "git-Purpur-$implementationVersion", // Purpur "Implementation-Vendor" to date, // Paper "Specification-Title" to "Bukkit", "Specification-Version" to project.version, -@@ -133,7 +138,7 @@ fun TaskContainer.registerRunTask( +@@ -152,7 +155,7 @@ fun TaskContainer.registerRunTask( name: String, block: JavaExec.() -> Unit ): TaskProvider = register(name) { @@ -172,10 +171,10 @@ index abe37c7c3c6f5ab73afd738ec78f06d7e4d2ed96..b5b6657e52e4f7a630229bd3ba433438 stringbuilder.append(CrashReport.getErrorComment()); stringbuilder.append("\n\n"); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 710ca7d3a5659953f64bc6dccdd93b43300961cc..b5368fc08cbe587f03a5f04a9e25850ca818cf2c 100644 +index 68d16efaf9c2d997afabadcf1ee24c5de685b5b3..861cd9f092a19aca520c2be4ba7a6ee3d9aee263 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -922,7 +922,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop // Spigot - Spigot > // CraftBukkit - cb > vanilla! +- return "Pufferfish"; // Pufferfish - Pufferfish > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla! + return "Purpur"; // Purpur - Purpur > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla! } public SystemReport fillSystemReport(SystemReport details) { diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 51b3db0b6c2cede95b584268e035c0fb36d38094..b29406fa5bd62fdd393915160fdb920cf7e28bc4 100644 +index 673fb3955291407be37dc78be4eec9bf2018128b..c3221e8088bc53c8c229961adecbf60255eb8c79 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -278,11 +278,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -280,11 +280,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware."); // Spigot start @@ -213,14 +212,14 @@ index 51b3db0b6c2cede95b584268e035c0fb36d38094..b29406fa5bd62fdd393915160fdb920c // Spigot end DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file."); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 47df6f4268a63118da8187f4102c876bd37d1680..0ca1d7a9950d5797bae7266961190ec1776e524f 100644 +index 098b67e6ad74be7698713623ca7fae70f19ac6b3..57a2014ff63129e99acdf8c382f3c4665e14cdd6 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -261,7 +261,7 @@ import javax.annotation.Nullable; // Paper import javax.annotation.Nonnull; // Paper public final class CraftServer implements Server { -- private final String serverName = "Paper"; // Paper +- private final String serverName = "Pufferfish"; // Paper // Pufferfish + private final String serverName = "Purpur"; // Paper // Purpur private final String serverVersion; private final String bukkitVersion = Versioning.getBukkitVersion(); @@ -279,27 +278,27 @@ index cdefb2025eedea7e204d70d568adaf1c1ec4c03c..d1526ed7197b883e1d1f07baf285bf5e // (async tasks must live with race-conditions if they attempt to cancel between these few lines of code) } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 17336102d37a5ab05c3b3c93fcf46961d0ffa7e2..a308993500fbb6cd871b44ec3d2ff66e28ac680b 100644 +index a3c6b3dd87022e2def1f12da7c44c8d529191d1e..51c96095cf7092125f79a197f797dc7965647574 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -433,7 +433,7 @@ public final class CraftMagicNumbers implements UnsafeValues { @Override public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { -- return new com.destroystokyo.paper.PaperVersionFetcher(); -+ return new com.destroystokyo.paper.PaperVersionFetcher(); // Purpur - diff on change +- return new gg.pufferfish.pufferfish.PufferfishVersionFetcher(); // Pufferfish ++ return new com.destroystokyo.paper.PaperVersionFetcher(); // Purpur } @Override diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java -index 774556a62eb240da42e84db4502e2ed43495be17..fb87620c742ff7912f5e8ccd2a7930dd605576d9 100644 +index 80553face9c70c2a3d897681e7761df85b22d464..fb87620c742ff7912f5e8ccd2a7930dd605576d9 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java +++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java @@ -11,7 +11,7 @@ public final class Versioning { public static String getBukkitVersion() { String result = "Unknown-Version"; -- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/io.papermc.paper/paper-api/pom.properties"); +- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/gg.pufferfish.pufferfish/pufferfish-api/pom.properties"); // Pufferfish + InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.purpurmc.purpur/purpur-api/pom.properties"); // Purpur Properties properties = new Properties(); diff --git a/patches/server/0002-Purpur-config-files.patch b/patches/server/0004-Purpur-config-files.patch similarity index 96% rename from patches/server/0002-Purpur-config-files.patch rename to patches/server/0004-Purpur-config-files.patch index dbf3b127c..2bed89c29 100644 --- a/patches/server/0002-Purpur-config-files.patch +++ b/patches/server/0004-Purpur-config-files.patch @@ -5,14 +5,14 @@ Subject: [PATCH] Purpur config files diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java -index 7b1843e16745ca8db2244e17490d291401f22679..acd95cf1dc7f009b63e44e4404e1736283fd458e 100644 +index 061716934ba0a1f01e4d85d664034f72b3c7a765..acd95cf1dc7f009b63e44e4404e1736283fd458e 100644 --- a/src/main/java/com/destroystokyo/paper/Metrics.java +++ b/src/main/java/com/destroystokyo/paper/Metrics.java @@ -593,7 +593,7 @@ public class Metrics { boolean logFailedRequests = config.getBoolean("logFailedRequests", false); // Only start Metrics, if it's enabled in the config if (config.getBoolean("enabled", true)) { -- Metrics metrics = new Metrics("Paper", serverUUID, logFailedRequests, Bukkit.getLogger()); +- Metrics metrics = new Metrics("Pufferfish", serverUUID, logFailedRequests, Bukkit.getLogger()); // Pufferfish + Metrics metrics = new Metrics("Purpur", serverUUID, logFailedRequests, Bukkit.getLogger()); // Purpur metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> { @@ -22,7 +22,7 @@ index 7b1843e16745ca8db2244e17490d291401f22679..acd95cf1dc7f009b63e44e4404e17362 metrics.addCustomChart(new Metrics.SingleLineChart("players", () -> Bukkit.getOnlinePlayers().size())); - metrics.addCustomChart(new Metrics.SimplePie("online_mode", () -> Bukkit.getOnlineMode() ? "online" : "offline")); -- metrics.addCustomChart(new Metrics.SimplePie("paper_version", () -> (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown")); +- metrics.addCustomChart(new Metrics.SimplePie("pufferfish_version", () -> (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown")); + metrics.addCustomChart(new Metrics.SimplePie("online_mode", () -> Bukkit.getOnlineMode() ? "online" : (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() ? "bungee" : "offline"))); // Purpur + metrics.addCustomChart(new Metrics.SimplePie("purpur_version", () -> (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown")); // Purpur @@ -64,7 +64,7 @@ index ae5dd08de75a7ed231295f306fd0974da3988249..b8d49f7607c646216d42f4e047997d47 if (this.source.acceptsSuccess() && !this.silent) { this.source.sendSystemMessage(message); diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index b29406fa5bd62fdd393915160fdb920cf7e28bc4..fa2f2d509445831360e78d4e61bd40e4f2ebe84f 100644 +index c3221e8088bc53c8c229961adecbf60255eb8c79..44be589011acb90c0d662cb1eb2697cfefd7fba5 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -218,6 +218,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -84,7 +84,7 @@ index b29406fa5bd62fdd393915160fdb920cf7e28bc4..fa2f2d509445831360e78d4e61bd40e4 io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider // Paper end diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 3cbf801b2e5420c0e870f73788deb550e49ad54d..e38d20975f63e2a9847b17e60647624c1eeab6f5 100644 +index 42299fd6ae663b01bb5f010b96887caa744dcb96..816f906f98adc180f37d2b216628e576ac837448 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -173,6 +173,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -96,7 +96,7 @@ index 3cbf801b2e5420c0e870f73788deb550e49ad54d..e38d20975f63e2a9847b17e60647624c public final co.aikar.timings.WorldTimingsHandler timings; // Paper public static BlockPos lastPhysicsProblem; // Spigot private org.spigotmc.TickLimiter entityLimiter; -@@ -273,6 +275,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -284,6 +286,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, Holder holder, Supplier supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper @@ -105,7 +105,7 @@ index 3cbf801b2e5420c0e870f73788deb550e49ad54d..e38d20975f63e2a9847b17e60647624c this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 0ca1d7a9950d5797bae7266961190ec1776e524f..78372d9b900e7506bfbcf53e8fa70043cc140fdb 100644 +index 57a2014ff63129e99acdf8c382f3c4665e14cdd6..fb290333f407776e732d3588233a35afa2ab989c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -979,6 +979,7 @@ public final class CraftServer implements Server { @@ -132,7 +132,7 @@ index 0ca1d7a9950d5797bae7266961190ec1776e524f..78372d9b900e7506bfbcf53e8fa70043 this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*"); this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); -@@ -2760,6 +2763,18 @@ public final class CraftServer implements Server { +@@ -2765,6 +2768,18 @@ public final class CraftServer implements Server { return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console); } @@ -152,7 +152,7 @@ index 0ca1d7a9950d5797bae7266961190ec1776e524f..78372d9b900e7506bfbcf53e8fa70043 public void restart() { org.spigotmc.RestartCommand.restart(); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index e072a5475a64d110f25ebcc871aa7703c2fc1e70..1913792032ef81a6f331cfdfc97052cfe53e767e 100644 +index 119d9bb5e41038704654e248bf168d22af246b7f..f8c4878cc558c6fe76c99795f9963015ea21312b 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -166,6 +166,14 @@ public class Main { diff --git a/patches/server/0003-Purpur-client-support.patch b/patches/server/0005-Purpur-client-support.patch similarity index 93% rename from patches/server/0003-Purpur-client-support.patch rename to patches/server/0005-Purpur-client-support.patch index 7dad4480b..ec1e16d88 100644 --- a/patches/server/0003-Purpur-client-support.patch +++ b/patches/server/0005-Purpur-client-support.patch @@ -17,10 +17,10 @@ index c0b0a7fdb75266a7064d54bda6441953184ecc64..0e21e7faf2036f12b64b9237a89ef8e7 public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) { super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 0c2255b6e2fb7752f85b0f83d4f84732758bd14d..d99baac236d7d4be09f351943971a9f60914be31 100644 +index aa23559719357f2678e3aa759d58ba4bde18bdd4..662c43401bf84a6de47986e66e1f83c4b50df775 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3505,6 +3505,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3507,6 +3507,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister"); private static final ResourceLocation MINECRAFT_BRAND = new ResourceLocation("brand"); // Paper - Brand support @@ -28,7 +28,7 @@ index 0c2255b6e2fb7752f85b0f83d4f84732758bd14d..d99baac236d7d4be09f351943971a9f6 @Override public void handleCustomPayload(ServerboundCustomPayloadPacket packet) { -@@ -3529,6 +3530,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3531,6 +3532,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex); this.disconnect("Invalid payload UNREGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause } diff --git a/patches/server/0004-Fix-decompile-errors.patch b/patches/server/0006-Fix-decompile-errors.patch similarity index 100% rename from patches/server/0004-Fix-decompile-errors.patch rename to patches/server/0006-Fix-decompile-errors.patch diff --git a/patches/server/0005-Component-related-conveniences.patch b/patches/server/0007-Component-related-conveniences.patch similarity index 96% rename from patches/server/0005-Component-related-conveniences.patch rename to patches/server/0007-Component-related-conveniences.patch index 33236834c..afc80bb5b 100644 --- a/patches/server/0005-Component-related-conveniences.patch +++ b/patches/server/0007-Component-related-conveniences.patch @@ -81,10 +81,10 @@ index 8795c94e6b6474addddbb0b337a962e8fac46b2b..f2ef4d93e070167d70f597e8893bf29b return this.isFireSource; } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 7f94da8059147760cbdc2476d0e8beda4a105f40..efce81deda7403d056628ab1a83f909af548b424 100644 +index caa4d38d620717e78df9ad29fe9752213f1cda1b..164fa910866c876abe96910af7b9018b6f1a7452 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3812,6 +3812,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3846,6 +3846,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { return SlotAccess.NULL; } diff --git a/patches/server/0006-Ridables.patch b/patches/server/0008-Ridables.patch similarity index 98% rename from patches/server/0006-Ridables.patch rename to patches/server/0008-Ridables.patch index 4da54ba3e..2f7167dab 100644 --- a/patches/server/0006-Ridables.patch +++ b/patches/server/0008-Ridables.patch @@ -22,10 +22,10 @@ index b1d12c78edf21cc29a9f9ca54e7957ddc8875ffb..a3e398d3bcc88f9c0feaa6ca8dc646f3 super(x, y, z); } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b5368fc08cbe587f03a5f04a9e25850ca818cf2c..cb2d56bc77132883876e367d332fef081bb32c72 100644 +index 861cd9f092a19aca520c2be4ba7a6ee3d9aee263..7191a7e9a7fcb4268c5aaf85bf9c896fa2bfd676 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1515,6 +1515,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Paper worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper @@ -34,7 +34,7 @@ index b5368fc08cbe587f03a5f04a9e25850ca818cf2c..cb2d56bc77132883876e367d332fef08 this.profiler.push(() -> { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index f3a19d00f78e19aa98c57461efb90d79f656a992..bc1a8e2bb56e25e49bdbf5a80c5d14ed87605f2c 100644 +index b398e4966eaa22b644a16f3c473af4769c9bbaf4..a24ddd5d02a6355112a9e3bee2131fbe0f9b7e0f 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -223,6 +223,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -66,7 +66,7 @@ index 740eff44b2895f83099beb4bc0e705f4252edc12..9918cc39247037c0a8379071167c5560 public void doTick() { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index bc7cbee5b5a789aaf42ac770a488eae16fdc9d19..400f974549319a4b3b0445c815a2e99756a2bc36 100644 +index 662c43401bf84a6de47986e66e1f83c4b50df775..d89e7697f12f06f49d4063fa0b06c90a56c6967c 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -720,7 +720,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -77,7 +77,7 @@ index bc7cbee5b5a789aaf42ac770a488eae16fdc9d19..400f974549319a4b3b0445c815a2e997 // If the packet contains look information then we update the To location with the correct Yaw & Pitch. to.setYaw(packet.getYRot()); to.setPitch(packet.getXRot()); -@@ -2772,6 +2771,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2774,6 +2773,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic ServerGamePacketListenerImpl.this.cserver.getPluginManager().callEvent(event); @@ -87,7 +87,7 @@ index bc7cbee5b5a789aaf42ac770a488eae16fdc9d19..400f974549319a4b3b0445c815a2e997 if ((entity instanceof Bucketable && entity instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) { entity.getEntityData().resendPossiblyDesyncedEntity(player); // Paper - The entire mob gets deleted, so resend it. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index efce81deda7403d056628ab1a83f909af548b424..3f2813e32a1ea011f760d2df454b8875f32a42f3 100644 +index 164fa910866c876abe96910af7b9018b6f1a7452..129e9f79930f03295d1bfaf53333e1a9863b4bc8 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -361,7 +361,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -99,7 +99,7 @@ index efce81deda7403d056628ab1a83f909af548b424..3f2813e32a1ea011f760d2df454b8875 private float eyeHeight; public boolean isInPowderSnow; public boolean wasInPowderSnow; -@@ -2767,6 +2767,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2801,6 +2801,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { this.passengers = ImmutableList.copyOf(list); } @@ -112,7 +112,7 @@ index efce81deda7403d056628ab1a83f909af548b424..3f2813e32a1ea011f760d2df454b8875 } return true; // CraftBukkit } -@@ -2807,6 +2813,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2841,6 +2847,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { return false; } // Spigot end @@ -127,7 +127,7 @@ index efce81deda7403d056628ab1a83f909af548b424..3f2813e32a1ea011f760d2df454b8875 if (this.passengers.size() == 1 && this.passengers.get(0) == entity) { this.passengers = ImmutableList.of(); } else { -@@ -4548,4 +4562,45 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -4634,4 +4648,45 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { return ((net.minecraft.server.level.ServerChunkCache) level.getChunkSource()).isPositionTicking(this); } // Paper end @@ -202,10 +202,10 @@ index c1e9b40a4a0f9cdc650caa88b5ea132e06ee2496..882ab40c8cdea8c214cb8344b3ccecdd protected ParticleOptions getInkParticle() { return ParticleTypes.GLOW_SQUID_INK; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 9e075de3542bda8ae086c9ca68bcd00b16d565d0..1e75f62ff6bd83f6007090dde5ce521fb6bd5247 100644 +index d134e88ae9aa2bd0b2b51056bfcc37941c713002..60519f70115358e3f94de6a2c1923e2d5f7a9f55 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -222,9 +222,9 @@ public abstract class LivingEntity extends Entity { +@@ -221,9 +221,9 @@ public abstract class LivingEntity extends Entity { protected int deathScore; public float lastHurt; public boolean jumping; @@ -218,7 +218,7 @@ index 9e075de3542bda8ae086c9ca68bcd00b16d565d0..1e75f62ff6bd83f6007090dde5ce521f protected int lerpSteps; protected double lerpX; protected double lerpY; -@@ -290,7 +290,7 @@ public abstract class LivingEntity extends Entity { +@@ -289,7 +289,7 @@ public abstract class LivingEntity extends Entity { this.effectsDirty = true; this.useItem = ItemStack.EMPTY; this.lastClimbablePos = Optional.empty(); @@ -227,7 +227,7 @@ index 9e075de3542bda8ae086c9ca68bcd00b16d565d0..1e75f62ff6bd83f6007090dde5ce521f this.craftAttributes = new CraftAttributeMap(this.attributes); // CraftBukkit // CraftBukkit - setHealth(getMaxHealth()) inlined and simplified to skip the instanceof check for EntityPlayer, as getBukkitEntity() is not initialized in constructor this.entityData.set(LivingEntity.DATA_HEALTH_ID, (float) this.getAttribute(Attributes.MAX_HEALTH).getValue()); -@@ -341,6 +341,7 @@ public abstract class LivingEntity extends Entity { +@@ -340,6 +340,7 @@ public abstract class LivingEntity extends Entity { public static AttributeSupplier.Builder createLivingAttributes() { return AttributeSupplier.builder().add(Attributes.MAX_HEALTH).add(Attributes.KNOCKBACK_RESISTANCE).add(Attributes.MOVEMENT_SPEED).add(Attributes.ARMOR).add(Attributes.ARMOR_TOUGHNESS); } @@ -235,7 +235,7 @@ index 9e075de3542bda8ae086c9ca68bcd00b16d565d0..1e75f62ff6bd83f6007090dde5ce521f @Override protected void checkFallDamage(double heightDifference, boolean onGround, BlockState state, BlockPos landedPosition) { -@@ -2690,7 +2691,7 @@ public abstract class LivingEntity extends Entity { +@@ -2712,7 +2713,7 @@ public abstract class LivingEntity extends Entity { } protected long lastJumpTime = 0L; // Paper @@ -244,7 +244,7 @@ index 9e075de3542bda8ae086c9ca68bcd00b16d565d0..1e75f62ff6bd83f6007090dde5ce521f double d0 = (double) this.getJumpPower() + this.getJumpBoostPower(); Vec3 vec3d = this.getDeltaMovement(); // Paper start -@@ -3432,8 +3433,10 @@ public abstract class LivingEntity extends Entity { +@@ -3454,8 +3455,10 @@ public abstract class LivingEntity extends Entity { this.pushEntities(); this.level.getProfiler().pop(); // Paper start @@ -257,7 +257,7 @@ index 9e075de3542bda8ae086c9ca68bcd00b16d565d0..1e75f62ff6bd83f6007090dde5ce521f Location from = new Location(this.level.getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO); Location to = new Location (this.level.getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); io.papermc.paper.event.entity.EntityMoveEvent event = new io.papermc.paper.event.entity.EntityMoveEvent(this.getBukkitLivingEntity(), from, to.clone()); -@@ -3443,6 +3446,21 @@ public abstract class LivingEntity extends Entity { +@@ -3465,6 +3468,21 @@ public abstract class LivingEntity extends Entity { absMoveTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch()); } } @@ -280,7 +280,7 @@ index 9e075de3542bda8ae086c9ca68bcd00b16d565d0..1e75f62ff6bd83f6007090dde5ce521f // Paper end if (!this.level.isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 49b983064ea810382b6112f5dc7f93ba4e5710bd..cb7f66bab7c08b6485576878bf330be9ffa329b8 100644 +index 94b45579dc371ee980565aed2f5dee78ebd44427..286f6a7ebc38378bb730db5d8ffef226f6a94e3d 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -146,8 +146,8 @@ public abstract class Mob extends LivingEntity { @@ -294,7 +294,7 @@ index 49b983064ea810382b6112f5dc7f93ba4e5710bd..cb7f66bab7c08b6485576878bf330be9 this.jumpControl = new JumpControl(this); this.bodyRotationControl = this.createBodyControl(); this.navigation = this.createNavigation(world); -@@ -1341,7 +1341,7 @@ public abstract class Mob extends LivingEntity { +@@ -1347,7 +1347,7 @@ public abstract class Mob extends LivingEntity { protected void onOffspringSpawnedFromEgg(Player player, Mob child) {} protected InteractionResult mobInteract(Player player, InteractionHand hand) { @@ -303,7 +303,7 @@ index 49b983064ea810382b6112f5dc7f93ba4e5710bd..cb7f66bab7c08b6485576878bf330be9 } public boolean isWithinRestriction() { -@@ -1722,4 +1722,52 @@ public abstract class Mob extends LivingEntity { +@@ -1728,4 +1728,52 @@ public abstract class Mob extends LivingEntity { return itemmonsteregg == null ? null : new ItemStack(itemmonsteregg); } @@ -357,13 +357,13 @@ index 49b983064ea810382b6112f5dc7f93ba4e5710bd..cb7f66bab7c08b6485576878bf330be9 + // Purpur end } diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java -index dd1102d5291ef6f18e82400a6d8a0a376cc071e9..9932a801be1bde1c57697396c097fb47a6b26ede 100644 +index e283eb57c25f7de222f9d09dca851169f5f6e488..210a0bee1227e4671909dd553ab22027cfc868fb 100644 --- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java +++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java -@@ -23,13 +23,20 @@ public class AttributeMap { - private final Map attributes = Maps.newHashMap(); +@@ -24,14 +24,21 @@ public class AttributeMap { private final Set dirtyAttributes = Sets.newHashSet(); private final AttributeSupplier supplier; + private final java.util.function.Function createInstance; // Pufferfish + private final net.minecraft.world.entity.LivingEntity entity; // Purpur public AttributeMap(AttributeSupplier defaultAttributes) { @@ -374,6 +374,7 @@ index dd1102d5291ef6f18e82400a6d8a0a376cc071e9..9932a801be1bde1c57697396c097fb47 + this.entity = entity; + // Purpur end this.supplier = defaultAttributes; + this.createInstance = attribute -> this.supplier.createInstance(this::onAttributeModified, attribute); // Pufferfish } private void onAttributeModified(AttributeInstance instance) { @@ -382,7 +383,7 @@ index dd1102d5291ef6f18e82400a6d8a0a376cc071e9..9932a801be1bde1c57697396c097fb47 this.dirtyAttributes.add(instance); } -@@ -41,7 +48,7 @@ public class AttributeMap { +@@ -43,7 +50,7 @@ public class AttributeMap { public Collection getSyncableAttributes() { return this.attributes.values().stream().filter((attribute) -> { @@ -554,7 +555,7 @@ index 7df56705a4a0de2dc4ff7ab133fc26612c219162..60d21d6171b9af20a4c6fcc0d564a31a } diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java -index 320c558bbe80d4bbc641e895ec43cfa2b45e8d70..b2b490961ee47d4cfbac0d438dba91eec658ead5 100644 +index 1572a81ce1718964d795f2a2a411402f88901c73..76069dbd56f6452af638e2e3311b44d3e9a1f4a5 100644 --- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java +++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java @@ -18,6 +18,7 @@ import net.minecraft.world.entity.EntityDimensions; @@ -2198,7 +2199,7 @@ index a6a50eb4f4ac85751071571876ac804d44ee1ee6..b9c692a2f42976eb459ed6a4078dca28 this.targetSelector.addGoal(2, new OwnerHurtTargetGoal(this)); this.targetSelector.addGoal(3, (new HurtByTargetGoal(this, new Class[0])).setAlertOthers()); diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java -index c0084b1f146a4697194c421519537e612ff737c0..3c60ad2c26c46f900e537ea39d74a97068f44561 100644 +index c66a214dfbde7fd8e7a68efaa82ac260178f297f..d98b726de2030662cb79e6c8446436c313a25d50 100644 --- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java +++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java @@ -101,10 +101,23 @@ public class Allay extends PathfinderMob implements InventoryCarrier { @@ -2256,7 +2257,7 @@ index c0084b1f146a4697194c421519537e612ff737c0..3c60ad2c26c46f900e537ea39d74a970 protected Brain.Provider brainProvider() { return Brain.provider(Allay.MEMORY_TYPES, Allay.SENSOR_TYPES); diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java -index 0d7f951e3837de7553d93f3d4525276048feb405..682c69ea9cdcc1ab9fd19e28eef410ecf27bf9f3 100644 +index 02219f5ca614fefffa1ceb3c7036dfe1c90c8676..ac7b58d4ad0e3c3d3fe8aaf7a6b4237786c09e75 100644 --- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java +++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java @@ -98,6 +98,28 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder getModelRotationValues() { return this.modelRotationValues; -@@ -518,14 +540,22 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder { @@ -2394,7 +2395,7 @@ index f2e84e832ad95df26fe3b9ba439ce38fc59b3585..bb1cbb7dcc26cb8e6e884a3fab08ce23 @Override protected Brain.Provider brainProvider() { return Brain.provider(MEMORY_TYPES, SENSOR_TYPES); -@@ -381,7 +430,7 @@ public class Frog extends Animal implements VariantHolder { +@@ -383,7 +432,7 @@ public class Frog extends Animal implements VariantHolder { return world.getBlockState(pos.below()).is(BlockTags.FROGS_SPAWNABLE_ON) && isBrightEnoughToSpawn(world, pos); } @@ -2404,7 +2405,7 @@ index f2e84e832ad95df26fe3b9ba439ce38fc59b3585..bb1cbb7dcc26cb8e6e884a3fab08ce23 super(entity); } diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java -index e8574bd4b412c1db82aaec9dced47b63de9dbf28..b33b3714f18f5bcd1f7d9d4974a8c1e254d83f5b 100644 +index 35594c5c107e83e5e025233036ae6d060f77c408..7b7daf5232a446b8774bbf53f2f09d9811d1dbbc 100644 --- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java +++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java @@ -44,13 +44,50 @@ public class Tadpole extends AbstractFish { @@ -2460,7 +2461,7 @@ index e8574bd4b412c1db82aaec9dced47b63de9dbf28..b33b3714f18f5bcd1f7d9d4974a8c1e2 protected PathNavigation createNavigation(Level world) { return new WaterBoundPathNavigation(this, world); diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java -index e9f7c08ae3ea9c578971b1ede88788572c20e277..9b0a0736aa46e60f21c85cc88b67af342c34d5db 100644 +index 0f365b9dbb160d90ddf5fcd40895305df48ce916..d6e527fb592f721aac59d52a1e84e147da62913b 100644 --- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java +++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java @@ -89,6 +89,23 @@ public class Goat extends Animal { @@ -2487,11 +2488,12 @@ index e9f7c08ae3ea9c578971b1ede88788572c20e277..9b0a0736aa46e60f21c85cc88b67af34 @Override protected Brain.Provider brainProvider() { return Brain.provider(Goat.MEMORY_TYPES, Goat.SENSOR_TYPES); -@@ -191,6 +208,7 @@ public class Goat extends Animal { +@@ -192,7 +209,7 @@ public class Goat extends Animal { @Override protected void customServerAiStep() { this.level.getProfiler().push("goatBrain"); -+ if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider +- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish ++ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider this.getBrain().tick((ServerLevel) this.level, this); this.level.getProfiler().pop(); this.level.getProfiler().push("goatActivityUpdate"); @@ -3444,7 +3446,7 @@ index d02286d553c600fe7e75f48e278e380d21c5b868..82b03488178962eb74fe252d561ba8ce return Guardian.createAttributes().add(Attributes.MOVEMENT_SPEED, 0.30000001192092896D).add(Attributes.ATTACK_DAMAGE, 8.0D).add(Attributes.MAX_HEALTH, 80.0D); } diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java -index f4002ac7cba7d5e41b4f11b98212c625f6a92a65..daac8d2ee377d960cac361e6977bcea4656b8d79 100644 +index ff0e09a7387e7dc9ca136d3e48e640b9e9cb4bf3..8f8c40d5265f9e124a255af92eb43b51322ffd74 100644 --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java @@ -92,9 +92,27 @@ public class EnderMan extends Monster implements NeutralMob { @@ -3492,7 +3494,7 @@ index f4002ac7cba7d5e41b4f11b98212c625f6a92a65..daac8d2ee377d960cac361e6977bcea4 float f = this.getLightLevelDependentMagicValue(); if (f > 0.5F && this.level.canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper -@@ -398,6 +417,7 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -404,6 +423,7 @@ public class EnderMan extends Monster implements NeutralMob { public boolean hurt(DamageSource source, float amount) { if (this.isInvulnerableTo(source)) { return false; @@ -4838,7 +4840,7 @@ index b75945807b425609394c343da56c316a769f0a29..838420f5d61eaf5e4abb52751b010d57 public void setPersistentAngerTarget(@Nullable UUID angryAt) { this.persistentAngerTarget = angryAt; diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -index 45741410a13cffe3419e34b5607b048bbcf1c3ff..0a63ee3a292111143104f764e01cabbc4c2100ba 100644 +index 5d487f1613b1fc5807283c20e5cc23a432d08f42..f2afd5f8ad916f0cf4674c6b4f973715999c6641 100644 --- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java @@ -67,6 +67,23 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { @@ -4865,16 +4867,17 @@ index 45741410a13cffe3419e34b5607b048bbcf1c3ff..0a63ee3a292111143104f764e01cabbc @Override public boolean canBeLeashed(Player player) { return !this.isLeashed(); -@@ -129,6 +146,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { +@@ -130,7 +147,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { @Override protected void customServerAiStep() { this.level.getProfiler().push("hoglinBrain"); -+ if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider +- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish ++ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider this.getBrain().tick((ServerLevel)this.level, this); this.level.getProfiler().pop(); HoglinAi.updateActivity(this); diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java -index afa7ecfa8453da510ec5ccecb1ceeb1d9893d259..0b6f4460f29e4b04c715eceba0d7fbda0b08c037 100644 +index b401fb4f276ca81b4bb18426ee56abed8a9f7a7b..33ffbc4ac5cecec8487c0529c1dee8596bb0ab30 100644 --- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java @@ -97,6 +97,23 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento @@ -4901,11 +4904,12 @@ index afa7ecfa8453da510ec5ccecb1ceeb1d9893d259..0b6f4460f29e4b04c715eceba0d7fbda @Override public void addAdditionalSaveData(CompoundTag nbt) { super.addAdditionalSaveData(nbt); -@@ -311,6 +328,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento +@@ -312,7 +329,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento @Override protected void customServerAiStep() { this.level.getProfiler().push("piglinBrain"); -+ if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider +- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish ++ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider this.getBrain().tick((ServerLevel) this.level, this); this.level.getProfiler().pop(); PiglinAi.updateActivity(this); @@ -4946,7 +4950,7 @@ index 769e4fbaac01a4fe3a45bd9cab5c63b61fc69f53..ff149234a8f3e1c94961e41d5bc81174 this.level.getProfiler().pop(); PiglinBruteAi.updateActivity(this); diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -index 1ae7408048f951cb94d7cfbea60efc5567b1af84..98176fde2760ab1d85d0b5afc1fd776487eef5e0 100644 +index 904826ea563bd2eb469f403df459def62cc1b5e6..456ebb0829d19d13abe05d83035c4abe3589962f 100644 --- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java +++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java @@ -120,8 +120,32 @@ public class Warden extends Monster implements VibrationListener.VibrationListen @@ -4982,7 +4986,7 @@ index 1ae7408048f951cb94d7cfbea60efc5567b1af84..98176fde2760ab1d85d0b5afc1fd7764 @Override public Packet getAddEntityPacket() { return new ClientboundAddEntityPacket(this, this.hasPose(Pose.EMERGING) ? 1 : 0); -@@ -403,19 +427,16 @@ public class Warden extends Monster implements VibrationListener.VibrationListen +@@ -405,19 +429,16 @@ public class Warden extends Monster implements VibrationListener.VibrationListen @Contract("null->false") public boolean canTargetEntity(@Nullable Entity entity) { @@ -5006,10 +5010,10 @@ index 1ae7408048f951cb94d7cfbea60efc5567b1af84..98176fde2760ab1d85d0b5afc1fd7764 public static void applyDarknessAround(ServerLevel world, Vec3 pos, @Nullable Entity entity, int range) { diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index 18eac340386a396c9850f53f30d20a41c1437788..a9be652ff5960f233d95bad98900c63c203473c4 100644 +index 76a9da8209d557b913c49ccd281bf147b9ac4fa4..2bbfa9a7d0fe71597e4e9a1e883be68018caadd7 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -153,6 +153,28 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -155,6 +155,28 @@ public class Villager extends AbstractVillager implements ReputationEventHandler this.setVillagerData(this.getVillagerData().setType(type).setProfession(VillagerProfession.NONE)); } @@ -5038,16 +5042,16 @@ index 18eac340386a396c9850f53f30d20a41c1437788..a9be652ff5960f233d95bad98900c63c @Override public Brain getBrain() { return (Brain) super.getBrain(); // CraftBukkit - decompile error -@@ -247,7 +269,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler - protected void customServerAiStep() { mobTick(false); } - protected void mobTick(boolean inactive) { +@@ -252,7 +274,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler this.level.getProfiler().push("villagerBrain"); -- if (!inactive) this.getBrain().tick((ServerLevel) this.level, this); // Paper -+ if (!inactive && (getRider() == null || !this.isControllable())) this.getBrain().tick((ServerLevel) this.level, this); // Paper // Purpur - only use brain if no rider - this.level.getProfiler().pop(); - if (this.assignProfessionWhenSpawned) { - this.assignProfessionWhenSpawned = false; -@@ -304,7 +326,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + // Pufferfish start + if (!inactive) { +- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish ++ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider + this.getBrain().tick((ServerLevel) this.level, this); // Paper + } + // Pufferfish end +@@ -312,7 +334,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler if (!itemstack.is(Items.VILLAGER_SPAWN_EGG) && this.isAlive() && !this.isTrading() && !this.isSleeping()) { if (this.isBaby()) { this.setUnhappy(); @@ -5056,7 +5060,7 @@ index 18eac340386a396c9850f53f30d20a41c1437788..a9be652ff5960f233d95bad98900c63c } else { boolean flag = this.getOffers().isEmpty(); -@@ -317,8 +339,9 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -325,8 +347,9 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } if (flag) { diff --git a/patches/server/0007-Configurable-entity-base-attributes.patch b/patches/server/0009-Configurable-entity-base-attributes.patch similarity index 99% rename from patches/server/0007-Configurable-entity-base-attributes.patch rename to patches/server/0009-Configurable-entity-base-attributes.patch index 2161bb042..2b72a0859 100644 --- a/patches/server/0007-Configurable-entity-base-attributes.patch +++ b/patches/server/0009-Configurable-entity-base-attributes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable entity base attributes diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 3f2813e32a1ea011f760d2df454b8875f32a42f3..d032e666b9738a5e3c7afff3d3597b003d0aa1e7 100644 +index 129e9f79930f03295d1bfaf53333e1a9863b4bc8..c6db89b5c94e31bffcca6625e37497bab779fdb8 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -155,7 +155,7 @@ import org.bukkit.plugin.PluginManager; @@ -34,10 +34,10 @@ index 882ab40c8cdea8c214cb8344b3ccecddb2967c1c..cb79d2c958fbd34f8c8818e7e1c0db88 @Override diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 1e75f62ff6bd83f6007090dde5ce521fb6bd5247..10e7c382e3e25ede3452b02af0e4d538e9403061 100644 +index 60519f70115358e3f94de6a2c1923e2d5f7a9f55..a24bffefc209ebfe31e553ceef212615edeb2687 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -291,6 +291,7 @@ public abstract class LivingEntity extends Entity { +@@ -290,6 +290,7 @@ public abstract class LivingEntity extends Entity { this.useItem = ItemStack.EMPTY; this.lastClimbablePos = Optional.empty(); this.attributes = new AttributeMap(DefaultAttributes.getSupplier(type), this); // Purpur @@ -45,7 +45,7 @@ index 1e75f62ff6bd83f6007090dde5ce521fb6bd5247..10e7c382e3e25ede3452b02af0e4d538 this.craftAttributes = new CraftAttributeMap(this.attributes); // CraftBukkit // CraftBukkit - setHealth(getMaxHealth()) inlined and simplified to skip the instanceof check for EntityPlayer, as getBukkitEntity() is not initialized in constructor this.entityData.set(LivingEntity.DATA_HEALTH_ID, (float) this.getAttribute(Attributes.MAX_HEALTH).getValue()); -@@ -306,6 +307,8 @@ public abstract class LivingEntity extends Entity { +@@ -305,6 +306,8 @@ public abstract class LivingEntity extends Entity { this.brain = this.makeBrain(new Dynamic(dynamicopsnbt, (Tag) dynamicopsnbt.createMap((Map) ImmutableMap.of(dynamicopsnbt.createString("memories"), (Tag) dynamicopsnbt.emptyMap())))); } @@ -55,7 +55,7 @@ index 1e75f62ff6bd83f6007090dde5ce521fb6bd5247..10e7c382e3e25ede3452b02af0e4d538 return this.brain; } diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java -index b2b490961ee47d4cfbac0d438dba91eec658ead5..a13d3ba5e7dff532fccfaf697e69815e427d4c96 100644 +index 76069dbd56f6452af638e2e3311b44d3e9a1f4a5..342cae912054d28c5dacf4d38babbd4092f08075 100644 --- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java +++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java @@ -93,6 +93,18 @@ public class Bat extends AmbientCreature { @@ -459,7 +459,7 @@ index b9c692a2f42976eb459ed6a4078dca28eddeb459..5f37b335dded41fdd122e8e0677c2c45 @Override diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java -index 682c69ea9cdcc1ab9fd19e28eef410ecf27bf9f3..d058f212b226b1f5efa0ba3650381e6c32a6fdac 100644 +index ac7b58d4ad0e3c3d3fe8aaf7a6b4237786c09e75..72f84f5a951c96c360206b43154a95247b1f8b42 100644 --- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java +++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java @@ -118,6 +118,11 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot flag2 = true; // Paper - diff on change, this should be moved wrongly @@ -128,7 +128,7 @@ index 503323974eb4ee076636ef495d7c475d1ade00cd..29a6f5da6c655a57e1d13a05f1ff3028 } this.player.absMoveTo(d0, d1, d2, f, f1); -@@ -1589,6 +1611,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1590,6 +1612,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.lastYaw = to.getYaw(); this.lastPitch = to.getPitch(); @@ -172,7 +172,7 @@ index 72abebff2018cde2922e97ad6478f93da9aed3ec..412963d7af38a53b6010007278d959a5 private EntitySelector() {} // Paper start diff --git a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java -index a7575b5ef56af6f53448d391abb4956e130148ca..0a9e4dc5d6d567605c587df9bcbb57d379b62877 100644 +index e752c83df50fb9b670ecea2abc95426c2a009b6f..baa4f9026d31de92210300ecb8ee8c1b6d575435 100644 --- a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java +++ b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java @@ -64,6 +64,10 @@ public class TargetingConditions { @@ -260,7 +260,7 @@ index 72501f09d42f73a108e96f519be4382ee4e3b230..573d25a15bafce004d8b26c5e7dea3c5 // Purpur end } diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index 7cacdea90641b16ad42f34266e8157c246152089..5d034ccb016265edd2b6c1f7f7c622cef3ad52b6 100644 +index 2f684a8f976f1f1a18c31f4c1a7eba9080099e55..c517873abdcb1e5334ba9e7a1c2f06bbbc411f87 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -174,8 +174,16 @@ public class PurpurConfig { @@ -310,10 +310,10 @@ index a85c9f24729ea44ef072a6d3d9ffeb93e8f0a486..765523911e448bd7f73e3f6cb8d0e78d public boolean untamedTamablesAreRidable = true; public boolean useNightVisionWhenRiding = false; diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 1b42c98956342832c37f0aa266f85271daa4ba5b..cea4acefa57cf59dd0863e27777618c49eabab5e 100644 +index b87756d9a7b04ea2613208984b2583eca3f32af6..7529bca82efe4c33dbf781bcf6f8b583fa54fa95 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -199,6 +199,7 @@ public class ActivationRange +@@ -203,6 +203,7 @@ public class ActivationRange continue; } diff --git a/patches/server/0011-Bring-back-server-name.patch b/patches/server/0013-Bring-back-server-name.patch similarity index 91% rename from patches/server/0011-Bring-back-server-name.patch rename to patches/server/0013-Bring-back-server-name.patch index f758150b7..09ebb99d8 100644 --- a/patches/server/0011-Bring-back-server-name.patch +++ b/patches/server/0013-Bring-back-server-name.patch @@ -17,10 +17,10 @@ index c7e4330c93baff1f3027d7c75cf857b673d38970..5134fed0cd0eedbe0c2177bce91b978b public final boolean spawnNpcs = this.get("spawn-npcs", true); public final boolean pvp = this.get("pvp", true); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 78372d9b900e7506bfbcf53e8fa70043cc140fdb..364e7957180c2dbea81cbb0e10eb6b080f1b2f6a 100644 +index fb290333f407776e732d3588233a35afa2ab989c..4a3025635de5f5f889e642fe10dd0b7ba7ec39d2 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2950,4 +2950,11 @@ public final class CraftServer implements Server { +@@ -2955,4 +2955,11 @@ public final class CraftServer implements Server { } // Paper end diff --git a/patches/server/0012-Configurable-server-mod-name.patch b/patches/server/0014-Configurable-server-mod-name.patch similarity index 86% rename from patches/server/0012-Configurable-server-mod-name.patch rename to patches/server/0014-Configurable-server-mod-name.patch index 51ed87793..cb209e739 100644 --- a/patches/server/0012-Configurable-server-mod-name.patch +++ b/patches/server/0014-Configurable-server-mod-name.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable server mod name diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index cb2d56bc77132883876e367d332fef081bb32c72..bdda859e559f4a26e85d2fdc9e9e8dc13ee66cc7 100644 +index 7191a7e9a7fcb4268c5aaf85bf9c896fa2bfd676..70d3fc30e21a6c3c3d7a87ce2e43dd2eb8322b2c 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1655,7 +1655,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop drops = new ArrayList(); public final org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes; -@@ -357,8 +358,8 @@ public abstract class LivingEntity extends Entity { +@@ -356,8 +357,8 @@ public abstract class LivingEntity extends Entity { this.tryAddSoulSpeed(); } @@ -27,7 +27,7 @@ index 10e7c382e3e25ede3452b02af0e4d538e9403061..d45cc25d37906ba0c2e5d80936aaae1d if (!state.isAir()) { double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D); -@@ -1998,7 +1999,7 @@ public abstract class LivingEntity extends Entity { +@@ -2020,7 +2021,7 @@ public abstract class LivingEntity extends Entity { MobEffectInstance mobeffect = this.getEffect(MobEffects.JUMP); float f2 = mobeffect == null ? 0.0F : (float) (mobeffect.getAmplifier() + 1); diff --git a/patches/server/0014-Lagging-threshold.patch b/patches/server/0016-Lagging-threshold.patch similarity index 85% rename from patches/server/0014-Lagging-threshold.patch rename to patches/server/0016-Lagging-threshold.patch index ceb04f8c5..bf25c84a8 100644 --- a/patches/server/0014-Lagging-threshold.patch +++ b/patches/server/0016-Lagging-threshold.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Lagging threshold diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index bdda859e559f4a26e85d2fdc9e9e8dc13ee66cc7..ac2b692fc5e579dc139540ab6b7e2396bdb84dfb 100644 +index 70d3fc30e21a6c3c3d7a87ce2e43dd2eb8322b2c..7c731c72a19c43f4b291557310c632f3d1fcc9cb 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -305,6 +305,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements FeatureElement, EntityTypeT +@@ -308,6 +308,16 @@ public class EntityType implements FeatureElement, EntityTypeT return (EntityType) Registry.register(BuiltInRegistries.ENTITY_TYPE, id, (EntityType) type.build(id)); // CraftBukkit - decompile error } @@ -25,7 +25,7 @@ index e5cd4b7609243669c9d84ff8a4988c209e6101aa..d4c75ccc3514c41f6d6fecf8555c34c8 public static ResourceLocation getKey(EntityType type) { return BuiltInRegistries.ENTITY_TYPE.getKey(type); } -@@ -513,6 +523,16 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -515,6 +525,16 @@ public class EntityType implements FeatureElement, EntityTypeT return this.category; } diff --git a/patches/server/0016-Player-invulnerabilities.patch b/patches/server/0018-Player-invulnerabilities.patch similarity index 98% rename from patches/server/0016-Player-invulnerabilities.patch rename to patches/server/0018-Player-invulnerabilities.patch index 77baa87e3..c18b20c46 100644 --- a/patches/server/0016-Player-invulnerabilities.patch +++ b/patches/server/0018-Player-invulnerabilities.patch @@ -82,10 +82,10 @@ index 9ab314490b975417e28f129c72077a7198cf4cc7..4dc545c478e24863c8e9c68060af072f public Scoreboard getScoreboard() { return this.getBukkitEntity().getScoreboard().getHandle(); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 29a6f5da6c655a57e1d13a05f1ff302806b0e8a5..07ef3d814feb51f110a12aaeb5e826ba61cc0812 100644 +index 1c527309483db75d0bade9662280601078895306..0bb020fb67f546ca18f4a6ca08876f30f62c6de9 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2094,12 +2094,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2095,12 +2095,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handleResourcePackResponse(ServerboundResourcePackPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); diff --git a/patches/server/0017-Anvil-API.patch b/patches/server/0019-Anvil-API.patch similarity index 100% rename from patches/server/0017-Anvil-API.patch rename to patches/server/0019-Anvil-API.patch diff --git a/patches/server/0018-Alternative-Keepalive-Handling.patch b/patches/server/0020-Alternative-Keepalive-Handling.patch similarity index 94% rename from patches/server/0018-Alternative-Keepalive-Handling.patch rename to patches/server/0020-Alternative-Keepalive-Handling.patch index f4676c064..18e03df78 100644 --- a/patches/server/0018-Alternative-Keepalive-Handling.patch +++ b/patches/server/0020-Alternative-Keepalive-Handling.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Alternative Keepalive Handling diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index af1afba7346e573b5704cc6fcec1bb1371928fa5..8920383edbd9908087be320f47d9ba8e536cff42 100644 +index 0bb020fb67f546ca18f4a6ca08876f30f62c6de9..89ceb3238ed0ec774bc74490a6a598bf96a13ad1 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -259,6 +259,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -38,7 +38,7 @@ index af1afba7346e573b5704cc6fcec1bb1371928fa5..8920383edbd9908087be320f47d9ba8e if (this.keepAlivePending) { if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info -@@ -3489,6 +3505,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3491,6 +3507,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handleKeepAlive(ServerboundKeepAlivePacket packet) { @@ -56,7 +56,7 @@ index af1afba7346e573b5704cc6fcec1bb1371928fa5..8920383edbd9908087be320f47d9ba8e if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) { int i = (int) (Util.getMillis() - this.keepAliveTime); diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index 80dee74274ba6a95029db8c812feeb2861ea9a36..cf13e83614d63aaedab1590d88ca4e92b45aa7ed 100644 +index dd3ed29fdac7ae1f35ecf520f92b9f36ca6fdb98..70d128ed8d19d47056d2f3ba3f75efb12bcb0347 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -196,6 +196,11 @@ public class PurpurConfig { diff --git a/patches/server/0019-Silk-touch-spawners.patch b/patches/server/0021-Silk-touch-spawners.patch similarity index 100% rename from patches/server/0019-Silk-touch-spawners.patch rename to patches/server/0021-Silk-touch-spawners.patch diff --git a/patches/server/0020-MC-168772-Fix-Add-turtle-egg-block-options.patch b/patches/server/0022-MC-168772-Fix-Add-turtle-egg-block-options.patch similarity index 94% rename from patches/server/0020-MC-168772-Fix-Add-turtle-egg-block-options.patch rename to patches/server/0022-MC-168772-Fix-Add-turtle-egg-block-options.patch index bb68ceed3..314d378bd 100644 --- a/patches/server/0020-MC-168772-Fix-Add-turtle-egg-block-options.patch +++ b/patches/server/0022-MC-168772-Fix-Add-turtle-egg-block-options.patch @@ -5,7 +5,7 @@ Subject: [PATCH] MC-168772 Fix - Add turtle egg block options diff --git a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java -index 68f122cdfb546a9d0d826bc2ef88549b81de4ab8..d54a46fc8d78df54777e4a7a250a8d0ae74e9831 100644 +index 70d46aafa9c16921e5c5bed3d97b8f402e25038a..7edbe55556d3072690d535575e8704c617465770 100644 --- a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java @@ -9,11 +9,15 @@ import net.minecraft.tags.BlockTags; @@ -50,7 +50,7 @@ index 68f122cdfb546a9d0d826bc2ef88549b81de4ab8..d54a46fc8d78df54777e4a7a250a8d0a } } diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index ed0e411f3960db455a8bdb19a8129db90bd48761..a3da7a5f4337a95adc351f95a806af4caf821945 100644 +index c46dc432e0a004c1912dc2eeb5da41cc76dfd7e8..0ebed2363ee959a10eddb60d2cdfc4d2b81b49d9 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -147,6 +147,15 @@ public class PurpurWorldConfig { diff --git a/patches/server/0021-Fix-vanilla-command-permission-handler.patch b/patches/server/0023-Fix-vanilla-command-permission-handler.patch similarity index 100% rename from patches/server/0021-Fix-vanilla-command-permission-handler.patch rename to patches/server/0023-Fix-vanilla-command-permission-handler.patch diff --git a/patches/server/0022-Logger-settings-suppressing-pointless-logs.patch b/patches/server/0024-Logger-settings-suppressing-pointless-logs.patch similarity index 100% rename from patches/server/0022-Logger-settings-suppressing-pointless-logs.patch rename to patches/server/0024-Logger-settings-suppressing-pointless-logs.patch diff --git a/patches/server/0023-Disable-outdated-build-check.patch b/patches/server/0025-Disable-outdated-build-check.patch similarity index 92% rename from patches/server/0023-Disable-outdated-build-check.patch rename to patches/server/0025-Disable-outdated-build-check.patch index 5210eff02..1e5b255d0 100644 --- a/patches/server/0023-Disable-outdated-build-check.patch +++ b/patches/server/0025-Disable-outdated-build-check.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Disable outdated build check diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 1913792032ef81a6f331cfdfc97052cfe53e767e..7b6063bede6771eb15bc5b01dc8bce7c2949c6b4 100644 +index f8c4878cc558c6fe76c99795f9963015ea21312b..c2c5c560165eb9ac9920727aaf730a5280107782 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -278,7 +278,7 @@ public class Main { diff --git a/patches/server/0024-Giants-AI-settings.patch b/patches/server/0026-Giants-AI-settings.patch similarity index 98% rename from patches/server/0024-Giants-AI-settings.patch rename to patches/server/0026-Giants-AI-settings.patch index bf015704e..a15ec7a26 100644 --- a/patches/server/0024-Giants-AI-settings.patch +++ b/patches/server/0026-Giants-AI-settings.patch @@ -120,7 +120,7 @@ index c1c5e884f00398032196ee71b55b348fcfce21ce..ed032918fb33d60c2d60d4db9275dddf } } diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index a3da7a5f4337a95adc351f95a806af4caf821945..60948438791c1c323789ed96ea7487f99dd0e572 100644 +index 0ebed2363ee959a10eddb60d2cdfc4d2b81b49d9..bab472dc673404dc339e5952f68f6c9561de58af 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -535,6 +535,10 @@ public class PurpurWorldConfig { diff --git a/patches/server/0025-Zombie-horse-naturally-spawn.patch b/patches/server/0027-Zombie-horse-naturally-spawn.patch similarity index 93% rename from patches/server/0025-Zombie-horse-naturally-spawn.patch rename to patches/server/0027-Zombie-horse-naturally-spawn.patch index ff1a7e53d..f9d9d3f90 100644 --- a/patches/server/0025-Zombie-horse-naturally-spawn.patch +++ b/patches/server/0027-Zombie-horse-naturally-spawn.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Zombie horse naturally spawn diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index bc1a8e2bb56e25e49bdbf5a80c5d14ed87605f2c..989c42ac9867add34b151cb4586ba90e12c75dd5 100644 +index a24ddd5d02a6355112a9e3bee2131fbe0f9b7e0f..0526d1d2cf0d6dca1be03184b4dd8e33c896272e 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -816,10 +816,18 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -832,10 +832,18 @@ public class ServerLevel extends Level implements WorldGenLevel { boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01D) && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper if (flag1) { @@ -30,7 +30,7 @@ index bc1a8e2bb56e25e49bdbf5a80c5d14ed87605f2c..989c42ac9867add34b151cb4586ba90e entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ()); this.addFreshEntity(entityhorseskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 60948438791c1c323789ed96ea7487f99dd0e572..3285bfcc8b17a729a42c106764cf7390d49323c5 100644 +index bab472dc673404dc339e5952f68f6c9561de58af..f9ef2118787f5fdac7964bb6975a3d6fb5b7760f 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -1454,6 +1454,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0026-Charged-creeper-naturally-spawn.patch b/patches/server/0028-Charged-creeper-naturally-spawn.patch similarity index 92% rename from patches/server/0026-Charged-creeper-naturally-spawn.patch rename to patches/server/0028-Charged-creeper-naturally-spawn.patch index a55de7c97..a795d7ea1 100644 --- a/patches/server/0026-Charged-creeper-naturally-spawn.patch +++ b/patches/server/0028-Charged-creeper-naturally-spawn.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Charged creeper naturally spawn diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java -index f7af29102b378b769edc6f5a92523c5f4cc12dce..fc44e1f4751d405af73aae62658f0257d599e6f7 100644 +index 05d7dd5a9a302b6281e56f8dfe54168b524a89f2..2a733951b5b16c3e7da613744eb76414af38374c 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java +++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java @@ -142,6 +142,14 @@ public class Creeper extends Monster implements PowerableMob { @@ -24,7 +24,7 @@ index f7af29102b378b769edc6f5a92523c5f4cc12dce..fc44e1f4751d405af73aae62658f0257 @Override diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 3285bfcc8b17a729a42c106764cf7390d49323c5..904d8166e654da9b10e362a15be187ed30e7060f 100644 +index f9ef2118787f5fdac7964bb6975a3d6fb5b7760f..68209ce9715e0717486153bd71572d558dd48851 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -326,6 +326,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0027-Rabbit-naturally-spawn-toast-and-killer.patch b/patches/server/0029-Rabbit-naturally-spawn-toast-and-killer.patch similarity index 96% rename from patches/server/0027-Rabbit-naturally-spawn-toast-and-killer.patch rename to patches/server/0029-Rabbit-naturally-spawn-toast-and-killer.patch index 42f2a0ec7..e4b5ad7a1 100644 --- a/patches/server/0027-Rabbit-naturally-spawn-toast-and-killer.patch +++ b/patches/server/0029-Rabbit-naturally-spawn-toast-and-killer.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Rabbit naturally spawn toast and killer diff --git a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java -index 45f8e38bf4b4b446fe2ec056e31ffd05feaab929..d5d7b4681e08225d3be86db5712c8520174c55ff 100644 +index b3bfb94529dfaa912f0e5ce0965b0740f09cf55e..592d72857aea88425a6359818f96f2271db7eb3b 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java +++ b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java @@ -465,10 +465,23 @@ public class Rabbit extends Animal implements VariantHolder { diff --git a/patches/server/0028-Fix-outdated-server-showing-in-ping-before-server-fu.patch b/patches/server/0030-Fix-outdated-server-showing-in-ping-before-server-fu.patch similarity index 100% rename from patches/server/0028-Fix-outdated-server-showing-in-ping-before-server-fu.patch rename to patches/server/0030-Fix-outdated-server-showing-in-ping-before-server-fu.patch diff --git a/patches/server/0029-Tulips-change-fox-type.patch b/patches/server/0031-Tulips-change-fox-type.patch similarity index 97% rename from patches/server/0029-Tulips-change-fox-type.patch rename to patches/server/0031-Tulips-change-fox-type.patch index ab1b5d8f2..28c52634d 100644 --- a/patches/server/0029-Tulips-change-fox-type.patch +++ b/patches/server/0031-Tulips-change-fox-type.patch @@ -75,7 +75,7 @@ index 4f10430e55d634b4e4bf74582a8032cc42938c7f..503721cce0a5207a44b016a4234c17a8 // Paper start - Cancellable death event protected org.bukkit.event.entity.EntityDeathEvent dropAllDeathLoot(DamageSource source) { diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 7abd787324ffff3394ec3f360ff363a6de2534fb..b0ed6d3b829d998d29af650ad723ae104d351bd2 100644 +index 24f529b4ca5f4e83ac33e255d4f602de54732fb3..924016926fa8d6df1667a1b39bf0fa6328d871b1 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -490,6 +490,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0030-Breedable-Polar-Bears.patch b/patches/server/0032-Breedable-Polar-Bears.patch similarity index 97% rename from patches/server/0030-Breedable-Polar-Bears.patch rename to patches/server/0032-Breedable-Polar-Bears.patch index 7a05ac73b..4e40e69ba 100644 --- a/patches/server/0030-Breedable-Polar-Bears.patch +++ b/patches/server/0032-Breedable-Polar-Bears.patch @@ -59,7 +59,7 @@ index bd1d90fa59d420577baada18d5afd04a85ad76a9..4e837590faebcb35426f8b9d023b2ae2 this.goalSelector.addGoal(5, new RandomStrollGoal(this, 1.0D)); this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F)); diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 25b6861e031e87ffa2344a0a014b33e5560f85e2..3af6da4508442d349fb93f9529ef7d17f0544a37 100644 +index 924016926fa8d6df1667a1b39bf0fa6328d871b1..d1323d3857e4455d2fbfbfdb004fde24a475132f 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -941,6 +941,8 @@ public class PurpurWorldConfig { diff --git a/patches/server/0031-Chickens-can-retaliate.patch b/patches/server/0033-Chickens-can-retaliate.patch similarity index 97% rename from patches/server/0031-Chickens-can-retaliate.patch rename to patches/server/0033-Chickens-can-retaliate.patch index 936092d12..74b04663c 100644 --- a/patches/server/0031-Chickens-can-retaliate.patch +++ b/patches/server/0033-Chickens-can-retaliate.patch @@ -51,7 +51,7 @@ index e4200b09f54861d61c9dae40e6883aa19265e295..471647830f3ae90f8867282edd6fb20f @Override diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 3af6da4508442d349fb93f9529ef7d17f0544a37..edc82ce158d50ac8def2453ccd980cdcf2f7d970 100644 +index d1323d3857e4455d2fbfbfdb004fde24a475132f..31a4f178239f35e1f82a771b8677429289a2dcac 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -280,6 +280,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0032-Add-option-to-set-armorstand-step-height.patch b/patches/server/0034-Add-option-to-set-armorstand-step-height.patch similarity index 94% rename from patches/server/0032-Add-option-to-set-armorstand-step-height.patch rename to patches/server/0034-Add-option-to-set-armorstand-step-height.patch index e5daa1d56..4db686c8b 100644 --- a/patches/server/0032-Add-option-to-set-armorstand-step-height.patch +++ b/patches/server/0034-Add-option-to-set-armorstand-step-height.patch @@ -17,7 +17,7 @@ index b136cdc13d94bc34c998a1986e0c93525356ac5c..76c83fdd744cc8f31a52c733de521a6f if (!this.canTick) { if (this.noTickPoseDirty) { diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index edc82ce158d50ac8def2453ccd980cdcf2f7d970..548f0815516cfdccca7e280410eee15bd268ba87 100644 +index 31a4f178239f35e1f82a771b8677429289a2dcac..0a6228781eaa7195f028427da134858e2f0ee094 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -93,6 +93,11 @@ public class PurpurWorldConfig { diff --git a/patches/server/0033-Cat-spawning-options.patch b/patches/server/0035-Cat-spawning-options.patch similarity index 97% rename from patches/server/0033-Cat-spawning-options.patch rename to patches/server/0035-Cat-spawning-options.patch index 06f0220b3..7d8cbd10d 100644 --- a/patches/server/0033-Cat-spawning-options.patch +++ b/patches/server/0035-Cat-spawning-options.patch @@ -51,7 +51,7 @@ index 5f407535298a31a34cfe114dd863fd6a9b977707..29c7e33fe961020e5a0007287fe9b663 } diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 548f0815516cfdccca7e280410eee15bd268ba87..915853e96d9572a6b057604b1efcee1b4b9129f0 100644 +index 0a6228781eaa7195f028427da134858e2f0ee094..d6b0e7b263bcdf3270ea41a85d92ba5f8f6a2db1 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -253,6 +253,9 @@ public class PurpurWorldConfig { diff --git a/patches/server/0034-Cows-eat-mushrooms.patch b/patches/server/0036-Cows-eat-mushrooms.patch similarity index 98% rename from patches/server/0034-Cows-eat-mushrooms.patch rename to patches/server/0036-Cows-eat-mushrooms.patch index f8adc2bab..0b0427753 100644 --- a/patches/server/0034-Cows-eat-mushrooms.patch +++ b/patches/server/0036-Cows-eat-mushrooms.patch @@ -114,7 +114,7 @@ index 7eecdb4be5ee7de39ccb86b4bfe98491f8cba9b6..8744649fbd3f11485d5862d6f1fb32ea + // Purpur end } diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 9a162f069c0452acf3eccfa91198b9b6aa6be35d..5755607fd0066418876fd02b8c4fd45447592cf5 100644 +index d6b0e7b263bcdf3270ea41a85d92ba5f8f6a2db1..2b959830cc4d7f0c8ee55a6ebdb7fb37712ec706 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -323,6 +323,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0035-Fix-cow-rotation-when-shearing-mooshroom.patch b/patches/server/0037-Fix-cow-rotation-when-shearing-mooshroom.patch similarity index 100% rename from patches/server/0035-Fix-cow-rotation-when-shearing-mooshroom.patch rename to patches/server/0037-Fix-cow-rotation-when-shearing-mooshroom.patch diff --git a/patches/server/0036-Pigs-give-saddle-back.patch b/patches/server/0038-Pigs-give-saddle-back.patch similarity index 96% rename from patches/server/0036-Pigs-give-saddle-back.patch rename to patches/server/0038-Pigs-give-saddle-back.patch index 1147430b4..c93aad00b 100644 --- a/patches/server/0036-Pigs-give-saddle-back.patch +++ b/patches/server/0038-Pigs-give-saddle-back.patch @@ -27,7 +27,7 @@ index 372574f224d21b8801f40e6c4991d64975cd79db..27f616534ff5280528fd2c681d8335e4 if (!this.level.isClientSide) { player.startRiding(this); diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index f46d217ba4a2bc96ff6ba79d096e3675c866fecd..59087f5355d56d45e7c7ff2c5bfeb5a6c1301c6f 100644 +index 2b959830cc4d7f0c8ee55a6ebdb7fb37712ec706..cf09c49c4520e0fe37f580f6fdfcc46b21edd054 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -892,6 +892,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0037-Snowman-drop-and-put-back-pumpkin.patch b/patches/server/0039-Snowman-drop-and-put-back-pumpkin.patch similarity index 100% rename from patches/server/0037-Snowman-drop-and-put-back-pumpkin.patch rename to patches/server/0039-Snowman-drop-and-put-back-pumpkin.patch diff --git a/patches/server/0038-Ender-dragon-always-drop-full-exp.patch b/patches/server/0040-Ender-dragon-always-drop-full-exp.patch similarity index 95% rename from patches/server/0038-Ender-dragon-always-drop-full-exp.patch rename to patches/server/0040-Ender-dragon-always-drop-full-exp.patch index c737f43fc..0ef4efcf2 100644 --- a/patches/server/0038-Ender-dragon-always-drop-full-exp.patch +++ b/patches/server/0040-Ender-dragon-always-drop-full-exp.patch @@ -18,7 +18,7 @@ index 01ba677cb6ffc9f4eabf78cfc67f27051a248f0d..e8672137aa9ff8c7ae11b6e5c963a2db } diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 2a1afd232e01b55ed3ebe470aa4b0aad536c14d6..1b72c0a90f5955daf71908143824a8035a31393c 100644 +index cf26071ce5a789019c743ff5ce742e2150bab9e0..55cd98d1e9aaf6d3248bb52620c5907221c14d65 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -436,6 +436,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0039-Signs-editable-on-right-click.patch b/patches/server/0041-Signs-editable-on-right-click.patch similarity index 97% rename from patches/server/0039-Signs-editable-on-right-click.patch rename to patches/server/0041-Signs-editable-on-right-click.patch index 6ef90e91b..469c7f5a7 100644 --- a/patches/server/0039-Signs-editable-on-right-click.patch +++ b/patches/server/0041-Signs-editable-on-right-click.patch @@ -50,7 +50,7 @@ index aface9a9697095a29edaf73c9cdabc2c1414b9d7..1a04d0a601b8e481dd6e2592b849b907 } else { return InteractionResult.PASS; diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 14d8928f43aa8d3bfc34e724356a877e05f19846..a02e09cc37251fbdf0e6336ae628f9f8685dafc9 100644 +index 55cd98d1e9aaf6d3248bb52620c5907221c14d65..8103b64483d33c9551aa525b93c9e362099207f7 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -152,6 +152,11 @@ public class PurpurWorldConfig { diff --git a/patches/server/0040-Allow-soil-to-moisten-from-water-directly-under-it.patch b/patches/server/0042-Allow-soil-to-moisten-from-water-directly-under-it.patch similarity index 94% rename from patches/server/0040-Allow-soil-to-moisten-from-water-directly-under-it.patch rename to patches/server/0042-Allow-soil-to-moisten-from-water-directly-under-it.patch index d7ad8b1cc..eec9b0a3e 100644 --- a/patches/server/0040-Allow-soil-to-moisten-from-water-directly-under-it.patch +++ b/patches/server/0042-Allow-soil-to-moisten-from-water-directly-under-it.patch @@ -18,7 +18,7 @@ index d089887030ac7c7a79abca97134ba9291e244059..4208833252a5b5c74d294dc3435869d7 @Override diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index b70d457584a9b3564784e28e47b359917d825aa9..d7cfbfe6a44d076b1e6efee7c9868924290e1fc6 100644 +index 8103b64483d33c9551aa525b93c9e362099207f7..26bdb2016954d8e028fb638e351ae3d2cb41da07 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -152,6 +152,11 @@ public class PurpurWorldConfig { diff --git a/patches/server/0041-Minecart-settings-and-WASD-controls.patch b/patches/server/0043-Minecart-settings-and-WASD-controls.patch similarity index 97% rename from patches/server/0041-Minecart-settings-and-WASD-controls.patch rename to patches/server/0043-Minecart-settings-and-WASD-controls.patch index b4a293a03..bb55dcb23 100644 --- a/patches/server/0041-Minecart-settings-and-WASD-controls.patch +++ b/patches/server/0043-Minecart-settings-and-WASD-controls.patch @@ -112,7 +112,7 @@ index eec7d7a5b558830111831792c42665724613af23..6a5e592c5c9a972a7f42eca398aac5f2 this.move(MoverType.SELF, this.getDeltaMovement()); if (!this.onGround) { diff --git a/src/main/java/net/minecraft/world/item/MinecartItem.java b/src/main/java/net/minecraft/world/item/MinecartItem.java -index 127a799f7848b32664b77bf67847ca6b8ac9a90d..178cd88a7de291136e0486617e8347b72cacaf20 100644 +index c6d2f764efa9b8bec730bbe757d480e365b25ccc..33a30d26da2401535f0a72acb2bbffec1aef151e 100644 --- a/src/main/java/net/minecraft/world/item/MinecartItem.java +++ b/src/main/java/net/minecraft/world/item/MinecartItem.java @@ -120,8 +120,9 @@ public class MinecartItem extends Item { @@ -136,7 +136,7 @@ index 127a799f7848b32664b77bf67847ca6b8ac9a90d..178cd88a7de291136e0486617e8347b7 } } 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 9ebc53d434737c8cd39073470b2b5fcbad167812..b40e09b4fdf26c08c048cbf3cad4d4cabec0fe90 100644 +index 25ce337ed266be7bafeacd9eb6f53a9474775fc5..86d765cd40cda9c8b7f4f7898d604ba2fdefa8fd 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 @@ -77,7 +77,7 @@ import net.minecraft.world.phys.shapes.VoxelShape; @@ -149,7 +149,7 @@ index 9ebc53d434737c8cd39073470b2b5fcbad167812..b40e09b4fdf26c08c048cbf3cad4d4ca protected final float explosionResistance; protected final boolean isRandomlyTicking; diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index de6e988e6d5d3c5a6d6fd7f00124c832013367a4..722c589bec9a1cf353f36027c63d9cf0a169c417 100644 +index 26bdb2016954d8e028fb638e351ae3d2cb41da07..4fdcb94be1e7f653388000712b0e13417b77703e 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -98,6 +98,68 @@ public class PurpurWorldConfig { diff --git a/patches/server/0042-Disable-loot-drops-on-death-by-cramming.patch b/patches/server/0044-Disable-loot-drops-on-death-by-cramming.patch similarity index 87% rename from patches/server/0042-Disable-loot-drops-on-death-by-cramming.patch rename to patches/server/0044-Disable-loot-drops-on-death-by-cramming.patch index bb42f87ad..4414d5b0b 100644 --- a/patches/server/0042-Disable-loot-drops-on-death-by-cramming.patch +++ b/patches/server/0044-Disable-loot-drops-on-death-by-cramming.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Disable loot drops on death by cramming diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index d45cc25d37906ba0c2e5d80936aaae1d7f9f4159..a56b9ae0d352db5350cc96ad079eee140aa7d665 100644 +index 2dacb572e2164ccd381c4e3cbc39d9238a89f500..e6b1ae8c1c05e01342041245c84a816eaa93706e 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1759,6 +1759,7 @@ public abstract class LivingEntity extends Entity { +@@ -1767,6 +1767,7 @@ public abstract class LivingEntity extends Entity { this.dropEquipment(); // CraftBukkit - from below if (this.shouldDropLoot() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { @@ -16,7 +16,7 @@ index d45cc25d37906ba0c2e5d80936aaae1d7f9f4159..a56b9ae0d352db5350cc96ad079eee14 this.dropFromLootTable(source, flag); // Paper start final boolean prev = this.clearEquipmentSlots; -@@ -1767,6 +1768,7 @@ public abstract class LivingEntity extends Entity { +@@ -1775,6 +1776,7 @@ public abstract class LivingEntity extends Entity { // Paper end this.dropCustomDeathLoot(source, i, flag); this.clearEquipmentSlots = prev; // Paper @@ -25,7 +25,7 @@ index d45cc25d37906ba0c2e5d80936aaae1d7f9f4159..a56b9ae0d352db5350cc96ad079eee14 // CraftBukkit start - Call death event // Paper start - call advancement triggers with correct entity equipment org.bukkit.event.entity.EntityDeathEvent deathEvent = CraftEventFactory.callEntityDeathEvent(this, this.drops, () -> { diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 9c708db8f7157bafc66efa7c19ac4b6ccc29fd9e..964d1e0f9f9e7f14cc702f28e135039715f49fc6 100644 +index 4fdcb94be1e7f653388000712b0e13417b77703e..593a177048ea8135db14bfd2e8156ff53d921bad 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -98,6 +98,11 @@ public class PurpurWorldConfig { diff --git a/patches/server/0043-Option-to-toggle-milk-curing-bad-omen.patch b/patches/server/0045-Option-to-toggle-milk-curing-bad-omen.patch similarity index 95% rename from patches/server/0043-Option-to-toggle-milk-curing-bad-omen.patch rename to patches/server/0045-Option-to-toggle-milk-curing-bad-omen.patch index 67fbebc89..55ddd529d 100644 --- a/patches/server/0043-Option-to-toggle-milk-curing-bad-omen.patch +++ b/patches/server/0045-Option-to-toggle-milk-curing-bad-omen.patch @@ -28,7 +28,7 @@ index f33977d95b6db473be4f95075ba99caf90ad0220..56dc04d8875971ee9a5d077a695509af return stack.isEmpty() ? new ItemStack(Items.BUCKET) : stack; diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 964d1e0f9f9e7f14cc702f28e135039715f49fc6..ef8d842ad2dff2124f9a88f0eaa202861a5015af 100644 +index 593a177048ea8135db14bfd2e8156ff53d921bad..c34cd8e630276817c96f8aa91b494ba7bf02f4e1 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -99,8 +99,10 @@ public class PurpurWorldConfig { diff --git a/patches/server/0044-End-gateway-should-check-if-entity-can-use-portal.patch b/patches/server/0046-End-gateway-should-check-if-entity-can-use-portal.patch similarity index 100% rename from patches/server/0044-End-gateway-should-check-if-entity-can-use-portal.patch rename to patches/server/0046-End-gateway-should-check-if-entity-can-use-portal.patch diff --git a/patches/server/0045-Skip-events-if-there-s-no-listeners.patch b/patches/server/0047-Skip-events-if-there-s-no-listeners.patch similarity index 100% rename from patches/server/0045-Skip-events-if-there-s-no-listeners.patch rename to patches/server/0047-Skip-events-if-there-s-no-listeners.patch diff --git a/patches/server/0046-Add-permission-for-F3-N-debug.patch b/patches/server/0048-Add-permission-for-F3-N-debug.patch similarity index 100% rename from patches/server/0046-Add-permission-for-F3-N-debug.patch rename to patches/server/0048-Add-permission-for-F3-N-debug.patch diff --git a/patches/server/0047-Configurable-TPS-Catchup.patch b/patches/server/0049-Configurable-TPS-Catchup.patch similarity index 89% rename from patches/server/0047-Configurable-TPS-Catchup.patch rename to patches/server/0049-Configurable-TPS-Catchup.patch index 9884d4bcd..934672a6e 100644 --- a/patches/server/0047-Configurable-TPS-Catchup.patch +++ b/patches/server/0049-Configurable-TPS-Catchup.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable TPS Catchup diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index ac2b692fc5e579dc139540ab6b7e2396bdb84dfb..41187b604b17d47f0f71f9649fc81abaa76a9707 100644 +index 7c731c72a19c43f4b291557310c632f3d1fcc9cb..779d14840fdb0b27e1bb49e680c59539294b2995 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1175,7 +1175,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop getRandomItemWith(Enchantment enchantment, LivingEntity entity) { return getRandomItemWith(enchantment, entity, (stack) -> { diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 1df016c731e355d6b23c2fe40071d11150ffe32b..f7e923a424b65a2246aed81d791a06c1d299fef6 100644 +index 4cc496fb8d2947a71e0e294e94cb4a251f563da4..69b1b87bf38577a78a6cf3f3925bf04b653d63ea 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -98,6 +98,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0060-Add-5-second-tps-average-in-tps.patch b/patches/server/0062-Add-5-second-tps-average-in-tps.patch similarity index 94% rename from patches/server/0060-Add-5-second-tps-average-in-tps.patch rename to patches/server/0062-Add-5-second-tps-average-in-tps.patch index b84eb3b70..70649ae87 100644 --- a/patches/server/0060-Add-5-second-tps-average-in-tps.patch +++ b/patches/server/0062-Add-5-second-tps-average-in-tps.patch @@ -27,7 +27,7 @@ index fa56cd09102a89692b42f1d14257990508c5c720..f9251183df72ddc56662fd3f02acf216 setListData(vector); } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 41187b604b17d47f0f71f9649fc81abaa76a9707..20e241d4cb82b7b415971cb485885d0d2fd45f7c 100644 +index 779d14840fdb0b27e1bb49e680c59539294b2995..96f50760dec9fb7ec317b500ce5cd6a69eb56f02 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -301,7 +301,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> consumer, Set trackedPlayers) { this.trackedPlayers = trackedPlayers; diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -index f0ccdfbd7d7be8c6e302609accf8fe9cac8885c4..ee5ec376cf7495ed99ee822a7b26978c3c107098 100644 +index c58496c84b2b3f86890050813041fa49711f3a01..9c3db8f774e5c11df18d2c317c874e8ac26e7f8e 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java @@ -54,6 +54,12 @@ public class ItemEntity extends Entity { @@ -34,7 +34,7 @@ index f0ccdfbd7d7be8c6e302609accf8fe9cac8885c4..ee5ec376cf7495ed99ee822a7b26978c public ItemEntity(EntityType type, Level world) { super(type, world); -@@ -334,6 +340,15 @@ public class ItemEntity extends Entity { +@@ -340,6 +346,15 @@ public class ItemEntity extends Entity { return false; } else if (!this.getItem().getItem().canBeHurtBy(source)) { return false; @@ -50,7 +50,7 @@ index f0ccdfbd7d7be8c6e302609accf8fe9cac8885c4..ee5ec376cf7495ed99ee822a7b26978c } else if (this.level.isClientSide) { return true; } else { -@@ -535,6 +550,12 @@ public class ItemEntity extends Entity { +@@ -541,6 +556,12 @@ public class ItemEntity extends Entity { this.getEntityData().set(ItemEntity.DATA_ITEM, stack); this.getEntityData().markDirty(ItemEntity.DATA_ITEM); // CraftBukkit - SPIGOT-4591, must mark dirty this.despawnRate = level.paperConfig().entities.spawning.altItemDespawnRate.enabled ? level.paperConfig().entities.spawning.altItemDespawnRate.items.getOrDefault(stack.getItem(), level.spigotConfig.itemDespawnRate) : level.spigotConfig.itemDespawnRate; // Paper @@ -115,7 +115,7 @@ index ecec5e17807a760769fc0ea79c2a0161cc5db1ef..3023cadd21947389158f1bfaf9fe84fd + // Purpur end } diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index c22ffc0353f73a378372c8bbcf54d9bb95cfc6be..b5b4807e5a54bc4ce0310f323de598e05704f2fc 100644 +index 41d0db18b0358061c5b6e12118619a4128f16273..a9a8923ce63391bfaa58dd241ea8addfb195b6a7 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -128,6 +128,49 @@ public class PurpurWorldConfig { diff --git a/patches/server/0063-Add-ping-command.patch b/patches/server/0065-Add-ping-command.patch similarity index 97% rename from patches/server/0063-Add-ping-command.patch rename to patches/server/0065-Add-ping-command.patch index 56a56dc32..414a21890 100644 --- a/patches/server/0063-Add-ping-command.patch +++ b/patches/server/0065-Add-ping-command.patch @@ -17,7 +17,7 @@ index 6c5d34d65a821c17c464e0868b7b50c0c39ec8db..2de0639ec22d731129ee3d5733dbf550 if (environment.includeIntegrated) { diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index 21582b20db2364f4dc6bd87d76b907c9451633d5..fe0d39b261f079aeef46d2019ad8613ac3d759a1 100644 +index 01ac09bda83703c16aed64133096377d7113693e..27b35e12eafd3ee735fcea201c9d371c2480e4da 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -178,12 +178,14 @@ public class PurpurConfig { diff --git a/patches/server/0064-Add-demo-command.patch b/patches/server/0066-Add-demo-command.patch similarity index 97% rename from patches/server/0064-Add-demo-command.patch rename to patches/server/0066-Add-demo-command.patch index c0a572336..e759b02f0 100644 --- a/patches/server/0064-Add-demo-command.patch +++ b/patches/server/0066-Add-demo-command.patch @@ -17,7 +17,7 @@ index 2de0639ec22d731129ee3d5733dbf5509764c274..24bb481c2e7163ec41e21d79bcac19db } diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index fe0d39b261f079aeef46d2019ad8613ac3d759a1..be3dc04bb1ceb63344bb40c71a0411838b5ea0ca 100644 +index 27b35e12eafd3ee735fcea201c9d371c2480e4da..fdcffdc618fcbc2413f6e6949d82ed1f138086b1 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -178,6 +178,7 @@ public class PurpurConfig { diff --git a/patches/server/0065-Add-credits-command.patch b/patches/server/0067-Add-credits-command.patch similarity index 97% rename from patches/server/0065-Add-credits-command.patch rename to patches/server/0067-Add-credits-command.patch index f412abf9d..f2daa6053 100644 --- a/patches/server/0065-Add-credits-command.patch +++ b/patches/server/0067-Add-credits-command.patch @@ -17,7 +17,7 @@ index 24bb481c2e7163ec41e21d79bcac19db67a4fba1..a7eee1f0ed063d1006c91adcac92e142 org.purpurmc.purpur.command.PingCommand.register(this.dispatcher); // Purpur } diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index be3dc04bb1ceb63344bb40c71a0411838b5ea0ca..a9f26ac2a605e2abc00378c4620c789a5878b8d1 100644 +index fdcffdc618fcbc2413f6e6949d82ed1f138086b1..28711abdabec6894faefb3a5bcff503ce5125e2f 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -178,6 +178,7 @@ public class PurpurConfig { diff --git a/patches/server/0066-Configurable-jockey-options.patch b/patches/server/0068-Configurable-jockey-options.patch similarity index 100% rename from patches/server/0066-Configurable-jockey-options.patch rename to patches/server/0068-Configurable-jockey-options.patch diff --git a/patches/server/0067-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch b/patches/server/0069-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch similarity index 99% rename from patches/server/0067-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch rename to patches/server/0069-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch index e877e5ba1..fa45bb100 100644 --- a/patches/server/0067-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch +++ b/patches/server/0069-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch @@ -258,7 +258,7 @@ index 2294458c7e81147a3efd2ef854fbc08f44231050..b9d737a20b8cca81fca290c13cb640c1 private float speed = 0.1F; diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index c802a074be642ee8eabf266b387714f65826354a..d5fecd8db1e0820a48c684f35cdaf720f76a1f62 100644 +index 00cce1123abca1533b9b62de118249886abb7951..7cb5b887d2b22fc41674f1df7a95ac4e1713ff60 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -1055,6 +1055,9 @@ public class PurpurWorldConfig { diff --git a/patches/server/0068-Add-phantom-spawning-options.patch b/patches/server/0070-Add-phantom-spawning-options.patch similarity index 98% rename from patches/server/0068-Add-phantom-spawning-options.patch rename to patches/server/0070-Add-phantom-spawning-options.patch index 3de4a6e02..2e326f308 100644 --- a/patches/server/0068-Add-phantom-spawning-options.patch +++ b/patches/server/0070-Add-phantom-spawning-options.patch @@ -40,7 +40,7 @@ index 1c3718d9244513d9fc795dceb564a81375734557..69753f0b67a78c565ff455676860dc05 for (int l = 0; l < k; ++l) { // Paper start diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index d5fecd8db1e0820a48c684f35cdaf720f76a1f62..ed3170c111741fe7e0d0044d3c02da2d6352268d 100644 +index 7cb5b887d2b22fc41674f1df7a95ac4e1713ff60..4421f48e9dd433cdcff5b7c5ac249bae49a67bd8 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -1058,6 +1058,12 @@ public class PurpurWorldConfig { diff --git a/patches/server/0069-Implement-bed-explosion-options.patch b/patches/server/0071-Implement-bed-explosion-options.patch similarity index 100% rename from patches/server/0069-Implement-bed-explosion-options.patch rename to patches/server/0071-Implement-bed-explosion-options.patch diff --git a/patches/server/0070-Implement-respawn-anchor-explosion-options.patch b/patches/server/0072-Implement-respawn-anchor-explosion-options.patch similarity index 100% rename from patches/server/0070-Implement-respawn-anchor-explosion-options.patch rename to patches/server/0072-Implement-respawn-anchor-explosion-options.patch diff --git a/patches/server/0071-Add-allow-water-in-end-world-option.patch b/patches/server/0073-Add-allow-water-in-end-world-option.patch similarity index 96% rename from patches/server/0071-Add-allow-water-in-end-world-option.patch rename to patches/server/0073-Add-allow-water-in-end-world-option.patch index 7caf14a0e..cd9da4f66 100644 --- a/patches/server/0071-Add-allow-water-in-end-world-option.patch +++ b/patches/server/0073-Add-allow-water-in-end-world-option.patch @@ -27,10 +27,10 @@ index 5c6aa9c464784ad5ee366412d080c72d3d22a76f..c03abc9589bf5f37abc1b0d355ed9784 return true; diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index e38d20975f63e2a9847b17e60647624c1eeab6f5..6bf58b1d80dc4309d59e846baba152791b5a483b 100644 +index 816f906f98adc180f37d2b216628e576ac837448..329e832cf3910a18158e841b39e59df519b83a53 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -1534,4 +1534,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1638,4 +1638,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return null; } // Paper end diff --git a/patches/server/0072-Allow-color-codes-in-books.patch b/patches/server/0074-Allow-color-codes-in-books.patch similarity index 92% rename from patches/server/0072-Allow-color-codes-in-books.patch rename to patches/server/0074-Allow-color-codes-in-books.patch index 94eea328c..ca5f11e68 100644 --- a/patches/server/0072-Allow-color-codes-in-books.patch +++ b/patches/server/0074-Allow-color-codes-in-books.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allow color codes in books diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 8920383edbd9908087be320f47d9ba8e536cff42..e1c2ac7e9578db319f582cdd9cbe0084d43e34f0 100644 +index 89ceb3238ed0ec774bc74490a6a598bf96a13ad1..17782698b77ecf92554e191ceed6d6bf54fec6eb 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1332,13 +1332,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1333,13 +1333,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic itemstack1.setTag(nbttagcompound.copy()); } @@ -28,7 +28,7 @@ index 8920383edbd9908087be320f47d9ba8e536cff42..e1c2ac7e9578db319f582cdd9cbe0084 this.updateBookPages(pages, (s) -> { return Component.Serializer.toJson(Component.literal(s)); -@@ -1350,10 +1353,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1351,10 +1354,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic private void updateBookPages(List list, UnaryOperator unaryoperator, ItemStack itemstack, int slot, ItemStack handItem) { // CraftBukkit ListTag nbttaglist = new ListTag(); @@ -44,7 +44,7 @@ index 8920383edbd9908087be320f47d9ba8e536cff42..e1c2ac7e9578db319f582cdd9cbe0084 Objects.requireNonNull(nbttaglist); stream.forEach(nbttaglist::add); -@@ -1363,11 +1369,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1364,11 +1370,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic for (int j = list.size(); i < j; ++i) { FilteredText filteredtext = (FilteredText) list.get(i); @@ -58,7 +58,7 @@ index 8920383edbd9908087be320f47d9ba8e536cff42..e1c2ac7e9578db319f582cdd9cbe0084 } } -@@ -1380,6 +1386,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1381,6 +1387,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.player.getInventory().setItem(slot, CraftEventFactory.handleEditBookEvent(player, slot, handItem, itemstack)); // CraftBukkit // Paper - Don't ignore result (see other callsite for handleEditBookEvent) } diff --git a/patches/server/0073-Entity-lifespan.patch b/patches/server/0075-Entity-lifespan.patch similarity index 86% rename from patches/server/0073-Entity-lifespan.patch rename to patches/server/0075-Entity-lifespan.patch index bc892bdf4..fc2cc586e 100644 --- a/patches/server/0073-Entity-lifespan.patch +++ b/patches/server/0075-Entity-lifespan.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Entity lifespan diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index e1c2ac7e9578db319f582cdd9cbe0084d43e34f0..cb36cc5248a7166fa8d43cabb6ada371c1026aaa 100644 +index 17782698b77ecf92554e191ceed6d6bf54fec6eb..89cdf7802920923a2bb87e454d9fcbf47a817890 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2823,6 +2823,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2825,6 +2825,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } if (entity.distanceToSqr(this.player.getEyePosition()) < ServerGamePacketListenerImpl.MAX_INTERACTION_DISTANCE) { @@ -17,7 +17,7 @@ index e1c2ac7e9578db319f582cdd9cbe0084d43e34f0..cb36cc5248a7166fa8d43cabb6ada371 private void performInteraction(InteractionHand enumhand, ServerGamePacketListenerImpl.EntityInteraction playerconnection_a, PlayerInteractEntityEvent event) { // CraftBukkit ItemStack itemstack = ServerGamePacketListenerImpl.this.player.getItemInHand(enumhand); diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index b6f2fbe5a2577696d62e001a3c07b52b07a33c74..d1eb52081277a51610abd83810ea96dfed2ea54b 100644 +index bc52c86a5d10148442f41286c21301bebf7b1a43..66981c41d9880772ddca61add753270dc6133249 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -134,6 +134,7 @@ public abstract class Mob extends LivingEntity { @@ -28,7 +28,7 @@ index b6f2fbe5a2577696d62e001a3c07b52b07a33c74..d1eb52081277a51610abd83810ea96df public boolean aware = true; // CraftBukkit protected Mob(EntityType type, Level world) { -@@ -288,6 +289,7 @@ public abstract class Mob extends LivingEntity { +@@ -290,6 +291,7 @@ public abstract class Mob extends LivingEntity { entityliving = null; } } @@ -36,7 +36,7 @@ index b6f2fbe5a2577696d62e001a3c07b52b07a33c74..d1eb52081277a51610abd83810ea96df this.target = entityliving; return true; // CraftBukkit end -@@ -334,9 +336,29 @@ public abstract class Mob extends LivingEntity { +@@ -336,9 +338,29 @@ public abstract class Mob extends LivingEntity { this.playAmbientSound(); } @@ -66,7 +66,7 @@ index b6f2fbe5a2577696d62e001a3c07b52b07a33c74..d1eb52081277a51610abd83810ea96df @Override protected void playHurtSound(DamageSource source) { this.resetAmbientSoundTime(); -@@ -526,6 +548,7 @@ public abstract class Mob extends LivingEntity { +@@ -528,6 +550,7 @@ public abstract class Mob extends LivingEntity { } nbt.putBoolean("Bukkit.Aware", this.aware); // CraftBukkit @@ -74,7 +74,7 @@ index b6f2fbe5a2577696d62e001a3c07b52b07a33c74..d1eb52081277a51610abd83810ea96df } @Override -@@ -596,6 +619,11 @@ public abstract class Mob extends LivingEntity { +@@ -598,6 +621,11 @@ public abstract class Mob extends LivingEntity { this.aware = nbt.getBoolean("Bukkit.Aware"); } // CraftBukkit end @@ -86,7 +86,7 @@ index b6f2fbe5a2577696d62e001a3c07b52b07a33c74..d1eb52081277a51610abd83810ea96df } @Override -@@ -1660,6 +1688,7 @@ public abstract class Mob extends LivingEntity { +@@ -1666,6 +1694,7 @@ public abstract class Mob extends LivingEntity { this.setLastHurtMob(target); } @@ -95,7 +95,7 @@ index b6f2fbe5a2577696d62e001a3c07b52b07a33c74..d1eb52081277a51610abd83810ea96df } diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 7a01302e0ce1a89f2107cbb110ae4819daf118d2..a34e1932fdd32a517b5e627cecbfa4062607f8b7 100644 +index aa04010dc4780f0f19937314f521208a164c2ae3..fb943790a7a6cf4174ca697cfa6c54b846086b39 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -128,6 +128,11 @@ public class PurpurWorldConfig { diff --git a/patches/server/0074-Add-option-to-teleport-to-spawn-if-outside-world-bor.patch b/patches/server/0076-Add-option-to-teleport-to-spawn-if-outside-world-bor.patch similarity index 93% rename from patches/server/0074-Add-option-to-teleport-to-spawn-if-outside-world-bor.patch rename to patches/server/0076-Add-option-to-teleport-to-spawn-if-outside-world-bor.patch index e46e98b36..b28ebb4a9 100644 --- a/patches/server/0074-Add-option-to-teleport-to-spawn-if-outside-world-bor.patch +++ b/patches/server/0076-Add-option-to-teleport-to-spawn-if-outside-world-bor.patch @@ -36,10 +36,10 @@ index a51453de2837851769f826f0b9eddc812d18614f..7775008d456f92c3d373c2f18fff0c7d + // Purpur end } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index f6715870f038dd193fe13e067dcd63b931d88087..52e294ac8df27b5301e83e912ee2f5f3f011d939 100644 +index 039212093b5e2671fb6d53371bfe48da4d0c116b..5a8785d77f5c422e8e8d2377584bc9c24e505df2 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -416,6 +416,7 @@ public abstract class LivingEntity extends Entity { +@@ -415,6 +415,7 @@ public abstract class LivingEntity extends Entity { double d1 = this.level.getWorldBorder().getDamagePerBlock(); if (d1 > 0.0D) { @@ -48,7 +48,7 @@ index f6715870f038dd193fe13e067dcd63b931d88087..52e294ac8df27b5301e83e912ee2f5f3 } } diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index a34e1932fdd32a517b5e627cecbfa4062607f8b7..c59e3de65057215cf0767254d44d8ae95c1da015 100644 +index fb943790a7a6cf4174ca697cfa6c54b846086b39..395634815198b7c754ee070783b20ca340ad8f09 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -247,6 +247,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0075-Squid-EAR-immunity.patch b/patches/server/0077-Squid-EAR-immunity.patch similarity index 94% rename from patches/server/0075-Squid-EAR-immunity.patch rename to patches/server/0077-Squid-EAR-immunity.patch index 73df7eb6c..a7112b82b 100644 --- a/patches/server/0075-Squid-EAR-immunity.patch +++ b/patches/server/0077-Squid-EAR-immunity.patch @@ -25,7 +25,7 @@ index 395634815198b7c754ee070783b20ca340ad8f09..dd5ff44bd1fbf6b55fa35ad5c889e239 public boolean spiderRidable = false; diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index cea4acefa57cf59dd0863e27777618c49eabab5e..3783186d0c3f2f7b241d38f8ee011e8a5c172980 100644 +index 7529bca82efe4c33dbf781bcf6f8b583fa54fa95..383a13a26ee9445fa6201770bb9bef274d72283a 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -15,6 +15,7 @@ import net.minecraft.world.entity.ambient.AmbientCreature; @@ -36,7 +36,7 @@ index cea4acefa57cf59dd0863e27777618c49eabab5e..3783186d0c3f2f7b241d38f8ee011e8a import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.animal.horse.Llama; import net.minecraft.world.entity.boss.EnderDragonPart; -@@ -373,6 +374,7 @@ public class ActivationRange +@@ -396,6 +397,7 @@ public class ActivationRange */ public static boolean checkIfActive(Entity entity) { diff --git a/patches/server/0076-Phantoms-burn-in-light.patch b/patches/server/0078-Phantoms-burn-in-light.patch similarity index 100% rename from patches/server/0076-Phantoms-burn-in-light.patch rename to patches/server/0078-Phantoms-burn-in-light.patch diff --git a/patches/server/0077-Configurable-villager-breeding.patch b/patches/server/0079-Configurable-villager-breeding.patch similarity index 93% rename from patches/server/0077-Configurable-villager-breeding.patch rename to patches/server/0079-Configurable-villager-breeding.patch index 0b5a016d3..73172e25c 100644 --- a/patches/server/0077-Configurable-villager-breeding.patch +++ b/patches/server/0079-Configurable-villager-breeding.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable villager breeding diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index ce70ddaf68cc0c4959fc520492b31f65deb7a3d6..80a0639c35906fdb3ed07f14395fc3009010fa7c 100644 +index fcb2d59d3ccb4a0601f82330878a784ece71f866..f225eb2f1d5a7c49fb2d6403388230666d411cc0 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -760,7 +760,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -768,7 +768,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @Override public boolean canBreed() { diff --git a/patches/server/0078-Redstone-deactivates-spawners.patch b/patches/server/0080-Redstone-deactivates-spawners.patch similarity index 100% rename from patches/server/0078-Redstone-deactivates-spawners.patch rename to patches/server/0080-Redstone-deactivates-spawners.patch diff --git a/patches/server/0079-Totems-work-in-inventory.patch b/patches/server/0081-Totems-work-in-inventory.patch similarity index 91% rename from patches/server/0079-Totems-work-in-inventory.patch rename to patches/server/0081-Totems-work-in-inventory.patch index c52a9f43d..aedaf89c7 100644 --- a/patches/server/0079-Totems-work-in-inventory.patch +++ b/patches/server/0081-Totems-work-in-inventory.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Totems work in inventory diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 52e294ac8df27b5301e83e912ee2f5f3f011d939..192da1b616b3a6bcf2c5e6e172903e99867aefbe 100644 +index 5a8785d77f5c422e8e8d2377584bc9c24e505df2..50ac35c43570525bf7b9551d5a67940e870852a1 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1554,6 +1554,18 @@ public abstract class LivingEntity extends Entity { +@@ -1562,6 +1562,18 @@ public abstract class LivingEntity extends Entity { } } @@ -28,7 +28,7 @@ index 52e294ac8df27b5301e83e912ee2f5f3f011d939..192da1b616b3a6bcf2c5e6e172903e99 EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), handSlot); event.setCancelled(itemstack == null); diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 3cf911e9a9f58fbceed3f371c65cf946a8b31637..4223f2b19a83a27de5f1602f0220768e513d2cbe 100644 +index 218756b5db10fab3a0f32ff03a091838b2c87fe9..b9dedd9a4318d82fbdc7393182ac07fae34779b1 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -248,6 +248,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0080-Add-vindicator-johnny-spawn-chance.patch b/patches/server/0082-Add-vindicator-johnny-spawn-chance.patch similarity index 100% rename from patches/server/0080-Add-vindicator-johnny-spawn-chance.patch rename to patches/server/0082-Add-vindicator-johnny-spawn-chance.patch diff --git a/patches/server/0081-Add-option-to-disable-certain-block-updates.patch b/patches/server/0083-Add-option-to-disable-certain-block-updates.patch similarity index 99% rename from patches/server/0081-Add-option-to-disable-certain-block-updates.patch rename to patches/server/0083-Add-option-to-disable-certain-block-updates.patch index 0f307cfa0..bcadda3fc 100644 --- a/patches/server/0081-Add-option-to-disable-certain-block-updates.patch +++ b/patches/server/0083-Add-option-to-disable-certain-block-updates.patch @@ -125,7 +125,7 @@ index df7965c86b9c9e89b07b76c75b638d391ea6cc34..641725337c65ddf35e7baf731ec37318 } diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index 6e13d4d3d56f6da9b752bce9ac008eda639ac510..84cb76a714db476e786c33424d20657ab21c3e05 100644 +index 005f9146aac12d342e5b679a24e9a0ab4a10d9a5..d646e0f7661436814ea59ab6054094f454d97aa4 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -247,6 +247,15 @@ public class PurpurConfig { diff --git a/patches/server/0082-Dispensers-place-anvils-option.patch b/patches/server/0084-Dispensers-place-anvils-option.patch similarity index 100% rename from patches/server/0082-Dispensers-place-anvils-option.patch rename to patches/server/0084-Dispensers-place-anvils-option.patch diff --git a/patches/server/0083-Allow-anvil-colors.patch b/patches/server/0085-Allow-anvil-colors.patch similarity index 98% rename from patches/server/0083-Allow-anvil-colors.patch rename to patches/server/0085-Allow-anvil-colors.patch index 56aec6e08..239126e3e 100644 --- a/patches/server/0083-Allow-anvil-colors.patch +++ b/patches/server/0085-Allow-anvil-colors.patch @@ -64,7 +64,7 @@ index 0363d2263b2d6bd6166fa21d7849297e95eddd77..d39b86b90aefab85b92e980f56f690bd } diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 5f297cd2a0ea4661c6f59efce49abd6cb38a3042..2358fcbaa13705ce80956514804aadf400aa53a9 100644 +index df1e48e325a6cec03cda2fe7471249f1d93b77f7..ca70fd0cee8c0d8b4c398a8dc12c4f3bbadab665 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -300,6 +300,13 @@ public class PurpurWorldConfig { diff --git a/patches/server/0084-Add-option-to-disable-dolphin-treasure-searching.patch b/patches/server/0086-Add-option-to-disable-dolphin-treasure-searching.patch similarity index 100% rename from patches/server/0084-Add-option-to-disable-dolphin-treasure-searching.patch rename to patches/server/0086-Add-option-to-disable-dolphin-treasure-searching.patch diff --git a/patches/server/0085-Short-enderman-height.patch b/patches/server/0087-Short-enderman-height.patch similarity index 90% rename from patches/server/0085-Short-enderman-height.patch rename to patches/server/0087-Short-enderman-height.patch index 348efd340..a126af498 100644 --- a/patches/server/0085-Short-enderman-height.patch +++ b/patches/server/0087-Short-enderman-height.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Short enderman height diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index d4c75ccc3514c41f6d6fecf8555c34c89385b379..94f72cf064e408c80b0f6ec644c9f69e66f94f36 100644 +index 3fb94a9ceb66cbc419b0b6ceb96310c8f2877257..4bfb370869bb6a6c7e5a9b67361fbac9d2d2e280 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -299,7 +299,8 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -301,7 +301,8 @@ public class EntityType implements FeatureElement, EntityTypeT private Component description; @Nullable private ResourceLocation lootTable; @@ -19,10 +19,10 @@ index d4c75ccc3514c41f6d6fecf8555c34c89385b379..94f72cf064e408c80b0f6ec644c9f69e private static EntityType register(String id, EntityType.Builder type) { // CraftBukkit - decompile error diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java -index c3bda3227736c5f8529b6ecbd0f17076f2d470e8..f130f3f8ceb5ab30e0b53e8b78281bfb953af5a9 100644 +index 112c1d084bf0e30a1a3f2d37341f73731fe70561..1dd86f7dfabb38fd8d1199055d7e28b7d8f39bb4 100644 --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java -@@ -423,6 +423,7 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -429,6 +429,7 @@ public class EnderMan extends Monster implements NeutralMob { if (this.isInvulnerableTo(source)) { return false; } else if (getRider() != null && this.isControllable()) { return super.hurt(source, amount); // Purpur - no teleporting on damage diff --git a/patches/server/0086-Stop-squids-floating-on-top-of-water.patch b/patches/server/0088-Stop-squids-floating-on-top-of-water.patch similarity index 92% rename from patches/server/0086-Stop-squids-floating-on-top-of-water.patch rename to patches/server/0088-Stop-squids-floating-on-top-of-water.patch index 41783d898..2888708d9 100644 --- a/patches/server/0086-Stop-squids-floating-on-top-of-water.patch +++ b/patches/server/0088-Stop-squids-floating-on-top-of-water.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Stop squids floating on top of water diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index efb8a0706b40293a1a5f52afce4e9029d8ad73c9..2e7e66051099eaeb4caebe81f8feedfa0f524edd 100644 +index 5106abacc353c1303e7fc488bebfeba2d5202ab0..c79dc51d590da219db7a9147144bc802e3da8637 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -4102,6 +4102,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -4136,6 +4136,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { this.yRotO = this.getYRot(); } @@ -19,7 +19,7 @@ index efb8a0706b40293a1a5f52afce4e9029d8ad73c9..2e7e66051099eaeb4caebe81f8feedfa + // Purpur end + public boolean updateFluidHeightAndDoFluidPushing(TagKey tag, double speed) { - if (this.touchingUnloadedChunk()) { + if (false && this.touchingUnloadedChunk()) { // Pufferfish - cost of a lookup here is the same cost as below, so skip return false; diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java index 99248a9e2769a573839b199150da312d33344f95..709aaa9dc834d91219ce1087d8f89ef5bf3d915c 100644 diff --git a/patches/server/0087-Crying-obsidian-valid-for-portal-frames.patch b/patches/server/0089-Crying-obsidian-valid-for-portal-frames.patch similarity index 96% rename from patches/server/0087-Crying-obsidian-valid-for-portal-frames.patch rename to patches/server/0089-Crying-obsidian-valid-for-portal-frames.patch index 8b0f709ba..68a93fbed 100644 --- a/patches/server/0087-Crying-obsidian-valid-for-portal-frames.patch +++ b/patches/server/0089-Crying-obsidian-valid-for-portal-frames.patch @@ -18,7 +18,7 @@ index c461e0d04047db9c0c5ecc04063cebd38bf96ec2..e7554ec800f321e4e34c926c53f2375a private static final float SAFE_TRAVEL_MAX_ENTITY_XY = 4.0F; private static final double SAFE_TRAVEL_MAX_VERTICAL_DELTA = 1.0D; diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index 3b10d9b4e7d3034ca43e6e05b3bccccfe0162a4b..bc7acc8399f99a7167a03b76cc69f3c9fef1d470 100644 +index 453557507925a3eaa2d6057e2f776a25ebbae18a..876ac29d5f6cbf539c9756c7ffbbd82fe24ead00 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -210,6 +210,7 @@ public class PurpurConfig { diff --git a/patches/server/0088-Entities-can-use-portals-configuration.patch b/patches/server/0090-Entities-can-use-portals-configuration.patch similarity index 89% rename from patches/server/0088-Entities-can-use-portals-configuration.patch rename to patches/server/0090-Entities-can-use-portals-configuration.patch index cc8de8c38..93e6c49dc 100644 --- a/patches/server/0088-Entities-can-use-portals-configuration.patch +++ b/patches/server/0090-Entities-can-use-portals-configuration.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Entities can use portals configuration diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 2e7e66051099eaeb4caebe81f8feedfa0f524edd..80dbcf052bf221dfb052976e71f1ec25a1087e46 100644 +index c79dc51d590da219db7a9147144bc802e3da8637..8c894892234246f3bf297807bea4c0f6581e0c8e 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2878,7 +2878,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2912,7 +2912,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { public void handleInsidePortal(BlockPos pos) { if (this.isOnPortalCooldown()) { this.setPortalCooldown(); @@ -17,7 +17,7 @@ index 2e7e66051099eaeb4caebe81f8feedfa0f524edd..80dbcf052bf221dfb052976e71f1ec25 if (!this.level.isClientSide && !pos.equals(this.portalEntrancePos)) { this.portalEntrancePos = pos.immutable(); } -@@ -3561,7 +3561,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3595,7 +3595,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } public boolean canChangeDimensions() { @@ -27,7 +27,7 @@ index 2e7e66051099eaeb4caebe81f8feedfa0f524edd..80dbcf052bf221dfb052976e71f1ec25 public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) { diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index b803684a01d092875188ea4de96a1af47b1632da..e6a3f6999c8fbc19a9e748b805298658477ebf03 100644 +index 5a6da03ce41cc78a36dc0c4fb0f89bbbacb0a6da..3bd18d72f996d93e0c5c31a7fb143a29401fca75 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -101,6 +101,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0089-LivingEntity-broadcastItemBreak.patch b/patches/server/0091-LivingEntity-broadcastItemBreak.patch similarity index 100% rename from patches/server/0089-LivingEntity-broadcastItemBreak.patch rename to patches/server/0091-LivingEntity-broadcastItemBreak.patch diff --git a/patches/server/0090-Customizable-wither-health-and-healing.patch b/patches/server/0092-Customizable-wither-health-and-healing.patch similarity index 100% rename from patches/server/0090-Customizable-wither-health-and-healing.patch rename to patches/server/0092-Customizable-wither-health-and-healing.patch diff --git a/patches/server/0091-Allow-toggling-special-MobSpawners-per-world.patch b/patches/server/0093-Allow-toggling-special-MobSpawners-per-world.patch similarity index 96% rename from patches/server/0091-Allow-toggling-special-MobSpawners-per-world.patch rename to patches/server/0093-Allow-toggling-special-MobSpawners-per-world.patch index 61b1bb069..0643cb4f0 100644 --- a/patches/server/0091-Allow-toggling-special-MobSpawners-per-world.patch +++ b/patches/server/0093-Allow-toggling-special-MobSpawners-per-world.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Allow toggling special MobSpawners per world In vanilla, these are all hardcoded on for world type 0 (overworld) and hardcoded off for every other world type. Default config behaviour matches this. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 989c42ac9867add34b151cb4586ba90e12c75dd5..01b777628476b1d116423f013e60963f089253ef 100644 +index 0526d1d2cf0d6dca1be03184b4dd8e33c896272e..cf72c46fb9b6a223e6c96103243ae183e6ce3ec9 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -545,7 +545,24 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -59,7 +59,7 @@ index 0ae8e9134a3671cdf2a480cd4dd6598653e261ab..7d34bd0d727eeb0afbc1869b076ee207 if (NaturalSpawner.isSpawnPositionOk(SpawnPlacements.Type.ON_GROUND, world, blockposition2, EntityType.WANDERING_TRADER)) { blockposition1 = blockposition2; diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 54c59de4dc39fb77b791e450f5d593c3ae063948..748e042ed0d8ee482cafac656553b288294f7440 100644 +index d6a4e3dead9ffc7cc779cb1b8413c61308850a01..f41418152e35b2c01077fd84501b67f9bd46ca11 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -72,6 +72,12 @@ public class PurpurWorldConfig { diff --git a/patches/server/0092-Raid-cooldown-setting.patch b/patches/server/0094-Raid-cooldown-setting.patch similarity index 97% rename from patches/server/0092-Raid-cooldown-setting.patch rename to patches/server/0094-Raid-cooldown-setting.patch index b8e02c0f9..116f52ac9 100644 --- a/patches/server/0092-Raid-cooldown-setting.patch +++ b/patches/server/0094-Raid-cooldown-setting.patch @@ -49,7 +49,7 @@ index feb89eb69994bdd1d2f95d2b9992e69251b2bee7..0670775c2de33e69c75644e5d2ff19db if (!this.raidMap.containsKey(raid.getId())) { this.raidMap.put(raid.getId(), raid); diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 748e042ed0d8ee482cafac656553b288294f7440..4c3900256f1aedc1052a752c10541ea87364cbe7 100644 +index f41418152e35b2c01077fd84501b67f9bd46ca11..ebad70a5fdfb4fb705d4542073cf068690294972 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -112,6 +112,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0093-Despawn-rate-config-options-per-projectile-type.patch b/patches/server/0095-Despawn-rate-config-options-per-projectile-type.patch similarity index 96% rename from patches/server/0093-Despawn-rate-config-options-per-projectile-type.patch rename to patches/server/0095-Despawn-rate-config-options-per-projectile-type.patch index b11d7a835..74d4d7d51 100644 --- a/patches/server/0093-Despawn-rate-config-options-per-projectile-type.patch +++ b/patches/server/0095-Despawn-rate-config-options-per-projectile-type.patch @@ -7,7 +7,7 @@ This patch's implementation has been removed in favor of Pufferfish's entity-tim The config remains for migration purposes. diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index a626c9c7db0a04fed1567b17d65819e70b79de19..e1b2b885a4bafffbcd79ce6fcc58bab5e5c36b27 100644 +index ebad70a5fdfb4fb705d4542073cf068690294972..34b1fa9b540bc42e13bf4a1949c266fc8a973398 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -293,6 +293,39 @@ public class PurpurWorldConfig { diff --git a/patches/server/0094-Add-option-to-disable-zombie-aggressiveness-towards-.patch b/patches/server/0096-Add-option-to-disable-zombie-aggressiveness-towards-.patch similarity index 100% rename from patches/server/0094-Add-option-to-disable-zombie-aggressiveness-towards-.patch rename to patches/server/0096-Add-option-to-disable-zombie-aggressiveness-towards-.patch diff --git a/patches/server/0095-Add-predicate-to-recipe-s-ExactChoice-ingredient.patch b/patches/server/0097-Add-predicate-to-recipe-s-ExactChoice-ingredient.patch similarity index 100% rename from patches/server/0095-Add-predicate-to-recipe-s-ExactChoice-ingredient.patch rename to patches/server/0097-Add-predicate-to-recipe-s-ExactChoice-ingredient.patch diff --git a/patches/server/0096-Flying-squids-Oh-my.patch b/patches/server/0098-Flying-squids-Oh-my.patch similarity index 100% rename from patches/server/0096-Flying-squids-Oh-my.patch rename to patches/server/0098-Flying-squids-Oh-my.patch diff --git a/patches/server/0097-Infinity-bow-settings.patch b/patches/server/0099-Infinity-bow-settings.patch similarity index 97% rename from patches/server/0097-Infinity-bow-settings.patch rename to patches/server/0099-Infinity-bow-settings.patch index c3d31b638..3f3df23fa 100644 --- a/patches/server/0097-Infinity-bow-settings.patch +++ b/patches/server/0099-Infinity-bow-settings.patch @@ -27,7 +27,7 @@ index 08d597db1a5345a343777a01427655e6bf2c926b..33df0ca406dc8321b76b393f317bbd1c } else { user.startUsingItem(hand); diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 080c8a6c698d7cc5b800327a442dbde8a029d5f9..b574a6b8d9316c59b864910197d59b8e2065cda2 100644 +index 0d0bfec73d3b4419220d7f82ff6d4d6c3778a381..e8cd9196fdf846676e74b35d3f061148ebbaf939 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -143,6 +143,17 @@ public class PurpurWorldConfig { diff --git a/patches/server/0098-Configurable-daylight-cycle.patch b/patches/server/0100-Configurable-daylight-cycle.patch similarity index 92% rename from patches/server/0098-Configurable-daylight-cycle.patch rename to patches/server/0100-Configurable-daylight-cycle.patch index a08995a3b..c3a1dacdb 100644 --- a/patches/server/0098-Configurable-daylight-cycle.patch +++ b/patches/server/0100-Configurable-daylight-cycle.patch @@ -18,10 +18,10 @@ index 689ad22925b2561f7c8db961743eb1f821dbb25f..fa3c960992cc240161817e54659d83fe public ClientboundSetTimePacket(long time, long timeOfDay, boolean doDaylightCycle) { this.gameTime = time % 192000; // Paper - fix guardian beam diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 20e241d4cb82b7b415971cb485885d0d2fd45f7c..fd5f4ed9ad706ab907595e2ddbe5a949d941b4a6 100644 +index 96f50760dec9fb7ec317b500ce5cd6a69eb56f02..1953eaab247d7482773cac79dafd651a23dff2da 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1509,7 +1509,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { @@ -300,7 +300,7 @@ index 5f37b335dded41fdd122e8e0677c2c45b7d4ebf1..d26a4175a08a7489f5bd17a07ed244a8 @Override diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java -index d058f212b226b1f5efa0ba3650381e6c32a6fdac..72c3dc27128137d23e0b0dba0ecf7cf5f24e889f 100644 +index 72f84f5a951c96c360206b43154a95247b1f8b42..b9301265557d1d6a1afb96f3e589e2f2cc73e651 100644 --- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java +++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java @@ -123,6 +123,11 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder { @@ -349,7 +349,7 @@ index bb1cbb7dcc26cb8e6e884a3fab08ce23bdf8c487..8aaf0fb4a7444fad23c46404d33b4a96 @Override diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java -index ee548f48f850e65542d8b0270881ad7664d41272..1393e79320a53bff012f2dfa4e3fd2fb22955a0c 100644 +index 6ddc233dff914abda9895b4a4a6218f8642ae07e..76b64a7a1c41dcb5ed9c6d2f1d8be05ad5f03f0a 100644 --- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java +++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java @@ -109,6 +109,11 @@ public class Goat extends Animal { @@ -493,7 +493,7 @@ index ddd4c66193cf6553bdb8f5206e17731a529d0f9e..162fc0f879b882c934000ebb71e6eef6 public static boolean checkStriderSpawnRules(EntityType type, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, RandomSource random) { diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -index 2d06a3ac4a5763cf948fc578ff5320c22c01c219..56dba90d0bb76b85cf21ace7ad50531fe3ae8381 100644 +index e99ffbf30652e188e88f8e17ed41d39ff25c9f73..c335a32832c6eef95658fbf632b943bb10ac44b0 100644 --- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java @@ -87,6 +87,11 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { diff --git a/patches/server/0105-Apply-display-names-from-item-forms-of-entities-to-e.patch b/patches/server/0107-Apply-display-names-from-item-forms-of-entities-to-e.patch similarity index 98% rename from patches/server/0105-Apply-display-names-from-item-forms-of-entities-to-e.patch rename to patches/server/0107-Apply-display-names-from-item-forms-of-entities-to-e.patch index 4173df1a3..6d31bb272 100644 --- a/patches/server/0105-Apply-display-names-from-item-forms-of-entities-to-e.patch +++ b/patches/server/0107-Apply-display-names-from-item-forms-of-entities-to-e.patch @@ -44,7 +44,7 @@ index 428523feaa4f30260e32ba03937e88200246c693..16e54d8c29d67d2db3f1186559f5ba71 if (!itemstack.isEmpty()) { diff --git a/src/main/java/net/minecraft/world/entity/decoration/Painting.java b/src/main/java/net/minecraft/world/entity/decoration/Painting.java -index 0c5caad2a5bfc14450cf8d37f988ee176e8d1450..c01af317e14ae1a0ed58821557cb7ac6e45b00bc 100644 +index 05a0a890a719a957d9aea736d6c0e85bae9e4eec..320dce948023e23df32601820146fa64e1b2fa71 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/Painting.java +++ b/src/main/java/net/minecraft/world/entity/decoration/Painting.java @@ -152,7 +152,13 @@ public class Painting extends HangingEntity implements VariantHolder this.disconnect("Book too large!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause return; } -@@ -1279,6 +1281,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1280,6 +1282,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic if (byteTotal > byteAllowed) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size()); diff --git a/patches/server/0122-Full-netherite-armor-grants-fire-resistance.patch b/patches/server/0124-Full-netherite-armor-grants-fire-resistance.patch similarity index 97% rename from patches/server/0122-Full-netherite-armor-grants-fire-resistance.patch rename to patches/server/0124-Full-netherite-armor-grants-fire-resistance.patch index 7d0465e74..b557c2921 100644 --- a/patches/server/0122-Full-netherite-armor-grants-fire-resistance.patch +++ b/patches/server/0124-Full-netherite-armor-grants-fire-resistance.patch @@ -26,7 +26,7 @@ index f129bb64a142f16e32f33cfa418ac498d44ad3c2..45385fe2e5249f4a61acd09b7b7ec393 protected ItemCooldowns createItemCooldowns() { diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index c67035b2a176e9e0167057f354b249eec08b7512..55f425457666075d7ecb6ece9cfeb29eb6050e8c 100644 +index 3ad07d56faf7bf206d24d2c0a1d8790c3e910227..992f6aeb2e75217d997db528de70c05a6a689cc1 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -298,6 +298,19 @@ public class PurpurWorldConfig { diff --git a/patches/server/0123-Fix-rotating-UP-DOWN-CW-and-CCW.patch b/patches/server/0125-Fix-rotating-UP-DOWN-CW-and-CCW.patch similarity index 100% rename from patches/server/0123-Fix-rotating-UP-DOWN-CW-and-CCW.patch rename to patches/server/0125-Fix-rotating-UP-DOWN-CW-and-CCW.patch diff --git a/patches/server/0124-Add-mobGriefing-bypass-to-everything-affected.patch b/patches/server/0126-Add-mobGriefing-bypass-to-everything-affected.patch similarity index 97% rename from patches/server/0124-Add-mobGriefing-bypass-to-everything-affected.patch rename to patches/server/0126-Add-mobGriefing-bypass-to-everything-affected.patch index 2e3f03267..2d0c40730 100644 --- a/patches/server/0124-Add-mobGriefing-bypass-to-everything-affected.patch +++ b/patches/server/0126-Add-mobGriefing-bypass-to-everything-affected.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add mobGriefing bypass to everything affected diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 192da1b616b3a6bcf2c5e6e172903e99867aefbe..78cfa3effceaa96e186abaafa21b68e3f3b4430a 100644 +index 50ac35c43570525bf7b9551d5a67940e870852a1..4649cee89a78f1eca27c6dfee07489601741ec41 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1726,7 +1726,7 @@ public abstract class LivingEntity extends Entity { +@@ -1734,7 +1734,7 @@ public abstract class LivingEntity extends Entity { boolean flag = false; if (this.dead && adversary instanceof WitherBoss) { // Paper @@ -18,10 +18,10 @@ index 192da1b616b3a6bcf2c5e6e172903e99867aefbe..78cfa3effceaa96e186abaafa21b68e3 BlockState iblockdata = Blocks.WITHER_ROSE.defaultBlockState(); diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index cc9e7eeb17d16b402e1f65144f4e4d1be43c5081..e2da9113227d397c8d5f1f8eca167d6fd9b0417d 100644 +index 7bab96e597b09b54470e83996264025eaae1fdca..bbb8af6885d465a2a3882e362b2583539f547876 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -668,7 +668,7 @@ public abstract class Mob extends LivingEntity { +@@ -670,7 +670,7 @@ public abstract class Mob extends LivingEntity { public void aiStep() { super.aiStep(); this.level.getProfiler().push("looting"); @@ -105,7 +105,7 @@ index 014fed23d40a20de65fe94046a0e8a34e4717eb8..59a3c234d27a9efe32e01b61848ce4cd if (iblockdata.is(Blocks.SWEET_BERRY_BUSH)) { diff --git a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java -index 07db7419cc2ca1ba12b34d9e8c00095ecc6d8fde..9e1d703a366e18e8287ed86fbafdc9054bff04d8 100644 +index 12852875e1eec1a6cb70a07b07cb8e00eaedfe66..eac32bb3a746616c119b669ca0d2703f18e4f5f1 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java +++ b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java @@ -630,7 +630,7 @@ public class Rabbit extends Animal implements VariantHolder { @@ -157,10 +157,10 @@ index 991525cb5f0265678d61759ff55c1479ce3a92de..75489ea612a74db34977e0ff67edc253 j = Mth.floor(this.getX()); int i1 = Mth.floor(this.getZ()); diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java -index 72bddd57059e4dfffa0c5ac04bb3c80cbcfd3b4a..2b311800af0c636f384e069c54ecd1ce81ddf201 100644 +index 1e8b7eab01a73524bef61a2a3666f6c600d6b832..b3ba3fccc91a22497e3d51f4c550c06d4a5c5ee8 100644 --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java -@@ -535,7 +535,15 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -541,7 +541,15 @@ public class EnderMan extends Monster implements NeutralMob { @Override public boolean canUse() { if (!enderman.level.purpurConfig.endermanAllowGriefing) return false; // Purpur @@ -177,7 +177,7 @@ index 72bddd57059e4dfffa0c5ac04bb3c80cbcfd3b4a..2b311800af0c636f384e069c54ecd1ce } @Override -@@ -583,7 +591,15 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -589,7 +597,15 @@ public class EnderMan extends Monster implements NeutralMob { @Override public boolean canUse() { if (!enderman.level.purpurConfig.endermanAllowGriefing) return false; // Purpur @@ -243,10 +243,10 @@ index 44e33d3007f1743f3f18b37ff61af9eb5542f529..0803e461042ea43ea60f3c798f1e1dc8 BlockPos blockposition = (new BlockPos(this.mob.getX(), this.mob.getY() + 0.5D, this.mob.getZ())).relative(this.selectedDirection); BlockState iblockdata = this.mob.level.getBlockState(blockposition); diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java -index 272a744ca52c34b5868b7979fa2b4143eeee1084..9c966db99cbc43522108a595ff9666bc518f9a98 100644 +index 48ae24daa126e1b3b2a740af15db756d412adbf7..3d69ca783fff3b453992a70d569016530c943e40 100644 --- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java -@@ -431,7 +431,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento +@@ -432,7 +432,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento @Override public boolean wantsToPickUp(ItemStack stack) { @@ -284,10 +284,10 @@ index 3a4b95288d390e72c0d97671ecc2e2ef2f976de1..4a3ba1f44379290b1e89366fa82c4028 // CraftBukkit start - fire ExplosionPrimeEvent ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity()); diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java -index 66476b33cede1e44db5ec166a0cea81f82ffe47a..57c4e60e3e5c4a7d0801f353488229156d5b83df 100644 +index 5ccd7dc0a093277d3ea09c0fe8be03c0073ee1a8..d01d3b752f89df479ff985dd34043191fd5d59a4 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java -@@ -273,6 +273,6 @@ public abstract class Projectile extends Entity { +@@ -303,6 +303,6 @@ public abstract class Projectile extends Entity { public boolean mayInteract(Level world, BlockPos pos) { Entity entity = this.getOwner(); @@ -361,7 +361,7 @@ index 518d3832c36c9ecf1ed9267ffc1f926dc84b7989..af5933b886abf3fd17bfdb8c1cb1ea63 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java -index d54a46fc8d78df54777e4a7a250a8d0ae74e9831..4eeb777a49556c54a3f31c1b9d755b110a3e8fab 100644 +index 7edbe55556d3072690d535575e8704c617465770..87bae3047c16428194eae82d52e2e0c2f293c4d2 100644 --- a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java @@ -211,7 +211,7 @@ public class TurtleEggBlock extends Block { diff --git a/patches/server/0125-Config-to-allow-Note-Block-sounds-when-blocked.patch b/patches/server/0127-Config-to-allow-Note-Block-sounds-when-blocked.patch similarity index 97% rename from patches/server/0125-Config-to-allow-Note-Block-sounds-when-blocked.patch rename to patches/server/0127-Config-to-allow-Note-Block-sounds-when-blocked.patch index d220f64c1..5ad8140bf 100644 --- a/patches/server/0125-Config-to-allow-Note-Block-sounds-when-blocked.patch +++ b/patches/server/0127-Config-to-allow-Note-Block-sounds-when-blocked.patch @@ -22,7 +22,7 @@ index 641725337c65ddf35e7baf731ec37318d4696036..5c183107df821b67e175bba81f4dbe13 // org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(world, pos, state.getValue(NoteBlock.INSTRUMENT), state.getValue(NoteBlock.NOTE)); // if (event.isCancelled()) { diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index fb2cdf80e7784ea4307ee8f8860583de96749e04..6828d1ff38696b18c66521aefc532d811e3d843e 100644 +index 56ffdcc2a4546bff83979d4d7071fbce79617d46..6157ebc52fb9c8018f09c6447368c0133d796487 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -121,6 +121,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0126-Add-EntityTeleportHinderedEvent.patch b/patches/server/0128-Add-EntityTeleportHinderedEvent.patch similarity index 99% rename from patches/server/0126-Add-EntityTeleportHinderedEvent.patch rename to patches/server/0128-Add-EntityTeleportHinderedEvent.patch index 6ae2c8ed0..8928337d6 100644 --- a/patches/server/0126-Add-EntityTeleportHinderedEvent.patch +++ b/patches/server/0128-Add-EntityTeleportHinderedEvent.patch @@ -108,7 +108,7 @@ index 3f08e9162ccb21661daa021d1c82e917ea089b7e..9ca8dab9976838c22cd759ae67c6c082 } diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index d379f144761c39fa66976fe8b412e59cc4680105..c9b69f9a17f969deedf3899da341fa22275d9da4 100644 +index 6157ebc52fb9c8018f09c6447368c0133d796487..db2e69bc1882eedd4800eca54da69d350fe4ec7a 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -120,6 +120,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0127-Farmland-trampling-changes.patch b/patches/server/0129-Farmland-trampling-changes.patch similarity index 100% rename from patches/server/0127-Farmland-trampling-changes.patch rename to patches/server/0129-Farmland-trampling-changes.patch diff --git a/patches/server/0128-Movement-options-for-armor-stands.patch b/patches/server/0130-Movement-options-for-armor-stands.patch similarity index 94% rename from patches/server/0128-Movement-options-for-armor-stands.patch rename to patches/server/0130-Movement-options-for-armor-stands.patch index 9a8b8da3c..f2ddedf73 100644 --- a/patches/server/0128-Movement-options-for-armor-stands.patch +++ b/patches/server/0130-Movement-options-for-armor-stands.patch @@ -17,10 +17,10 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 80dbcf052bf221dfb052976e71f1ec25a1087e46..0635cd0c6c824d6619d9c19627c9460eedad3ec6 100644 +index 8c894892234246f3bf297807bea4c0f6581e0c8e..0b1a8205f6dd6285c3cf190505e75ce1400bb9dd 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1705,7 +1705,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -1739,7 +1739,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { return this.isInWater() || flag; } @@ -66,7 +66,7 @@ index 0c4b76cd3b6248df99d31d28c7521a0fe6aea89e..6800d77262c244e5bb32535d920b025b + // Purpur end } diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 08501fcd8b74a378b5294b96f379ecdc0d67f494..7ff5c24d97a52f28438529915c29857f480725a2 100644 +index b6d531a34a1e29f5956ee3b27dacaedf73711e7c..ab723d7f9dbe810e720636998f2657536db6251b 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -102,10 +102,16 @@ public class PurpurWorldConfig { diff --git a/patches/server/0129-Fix-stuck-in-portals.patch b/patches/server/0131-Fix-stuck-in-portals.patch similarity index 93% rename from patches/server/0129-Fix-stuck-in-portals.patch rename to patches/server/0131-Fix-stuck-in-portals.patch index b6aa2a8fb..7ec4b35e6 100644 --- a/patches/server/0129-Fix-stuck-in-portals.patch +++ b/patches/server/0131-Fix-stuck-in-portals.patch @@ -17,10 +17,10 @@ index 2e9dcb9e4667ef51594508bebabc413edbe41a15..3996b6425ca6c6f329b1cc869fea73cf // CraftBukkit end this.setLevel(worldserver); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 0635cd0c6c824d6619d9c19627c9460eedad3ec6..c4673de12f0de52862ad58f6ccdd6128fa5619cf 100644 +index 0b1a8205f6dd6285c3cf190505e75ce1400bb9dd..9f9bcece63b99f2f23561dd0b3768e40cfd385fd 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2875,12 +2875,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2909,12 +2909,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { return Vec3.directionFromRotation(this.getRotationVector()); } @@ -37,7 +37,7 @@ index 0635cd0c6c824d6619d9c19627c9460eedad3ec6..c4673de12f0de52862ad58f6ccdd6128 this.isInsidePortal = true; diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 7ff5c24d97a52f28438529915c29857f480725a2..d7731e199e0992d16950301b8fc0468c34d295cc 100644 +index ab723d7f9dbe810e720636998f2657536db6251b..63da935f57a9910408b6fd78eb9988c7bf45cde5 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -338,6 +338,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0130-Toggle-for-water-sensitive-mob-damage.patch b/patches/server/0132-Toggle-for-water-sensitive-mob-damage.patch similarity index 99% rename from patches/server/0130-Toggle-for-water-sensitive-mob-damage.patch rename to patches/server/0132-Toggle-for-water-sensitive-mob-damage.patch index c7eeea12e..4ebe3d10b 100644 --- a/patches/server/0130-Toggle-for-water-sensitive-mob-damage.patch +++ b/patches/server/0132-Toggle-for-water-sensitive-mob-damage.patch @@ -21,7 +21,7 @@ index b6df98797757462f35c306aa4c6ea1585a9a6ddc..506632a6b5107f5ef08cd87808b8c4be @Override diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java -index a13d3ba5e7dff532fccfaf697e69815e427d4c96..b2fff9079c7460681d9cbd3d3e57b42dfcece44b 100644 +index 342cae912054d28c5dacf4d38babbd4092f08075..495e9eef387567fdbc929de94e88c74577c72eb7 100644 --- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java +++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java @@ -105,6 +105,11 @@ public class Bat extends AmbientCreature { @@ -286,7 +286,7 @@ index 988093b46a4c386f8d47a4c530b8e9f6f49efd0d..2a9af6af653dc62c99baff01ebea8ad6 @Override diff --git a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java -index 9e1d703a366e18e8287ed86fbafdc9054bff04d8..293ca8039d1e1e2608a64c496b5f762d4e456485 100644 +index eac32bb3a746616c119b669ca0d2703f18e4f5f1..ecdb0d914fca294850ed5a01f1be9112a450c919 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java +++ b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java @@ -145,6 +145,11 @@ public class Rabbit extends Animal implements VariantHolder { @@ -411,7 +411,7 @@ index ef2405b5e32e581c488e8b943e143faeb9ddd135..f1d7390e9bbc520fa9c41b09b363996e @Override diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java -index 72c3dc27128137d23e0b0dba0ecf7cf5f24e889f..386eb27ba4c68d0a87ad5c0250b51987b62281e7 100644 +index b9301265557d1d6a1afb96f3e589e2f2cc73e651..97a2313ff585f65f8bb7514f6fbc8655969b421d 100644 --- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java +++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java @@ -128,6 +128,11 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 684144de36c2f6c98d7329f181bbecff746bdaf4..b2a84f1afb636218b0fa60c9129245b29d29268d 100644 +index 08ccf4b33313f3bc7ddc51b385288765f3cd3a88..66cf04d6035b1676d75ae46b73782461d07dff24 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -4615,5 +4615,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -4701,5 +4701,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { public boolean canSaveToDisk() { return true; } @@ -31,10 +31,10 @@ index 684144de36c2f6c98d7329f181bbecff746bdaf4..b2a84f1afb636218b0fa60c9129245b2 // Purpur end } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 272dd6c5fd760e7310069420941ad90d36f9ddbe..c975f66f5f7f80547202c7cff7ad0c6f90f0cbc9 100644 +index daa464b0098339cdc52483ffd4f7474176487dd0..ebb6d9d2cc977e4c473bb3839c8bb03ca40ca4bb 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -267,6 +267,7 @@ public abstract class LivingEntity extends Entity { +@@ -266,6 +266,7 @@ public abstract class LivingEntity extends Entity { public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper public boolean silentDeath = false; // Paper - mark entity as dying silently for cancellable death event public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper @@ -42,7 +42,7 @@ index 272dd6c5fd760e7310069420941ad90d36f9ddbe..c975f66f5f7f80547202c7cff7ad0c6f @Override public float getBukkitYaw() { -@@ -794,6 +795,7 @@ public abstract class LivingEntity extends Entity { +@@ -793,6 +794,7 @@ public abstract class LivingEntity extends Entity { dataresult.resultOrPartial(logger::error).ifPresent((nbtbase) -> { nbt.put("Brain", nbtbase); }); @@ -50,7 +50,7 @@ index 272dd6c5fd760e7310069420941ad90d36f9ddbe..c975f66f5f7f80547202c7cff7ad0c6f } @Override -@@ -878,6 +880,11 @@ public abstract class LivingEntity extends Entity { +@@ -877,6 +879,11 @@ public abstract class LivingEntity extends Entity { this.brain = this.makeBrain(new Dynamic(NbtOps.INSTANCE, nbt.get("Brain"))); } @@ -62,7 +62,7 @@ index 272dd6c5fd760e7310069420941ad90d36f9ddbe..c975f66f5f7f80547202c7cff7ad0c6f } // CraftBukkit start -@@ -3511,6 +3518,27 @@ public abstract class LivingEntity extends Entity { +@@ -3533,6 +3540,27 @@ public abstract class LivingEntity extends Entity { this.hurt(DamageSource.DROWN, 1.0F); } @@ -91,10 +91,10 @@ index 272dd6c5fd760e7310069420941ad90d36f9ddbe..c975f66f5f7f80547202c7cff7ad0c6f public boolean isSensitiveToWater() { diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index e2da9113227d397c8d5f1f8eca167d6fd9b0417d..8df6af3a4ceea5ed6209df489a0f728d384bef89 100644 +index bbb8af6885d465a2a3882e362b2583539f547876..535b13206e4a8a68e1fb226b3c44890face3b55f 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -1705,17 +1705,7 @@ public abstract class Mob extends LivingEntity { +@@ -1711,17 +1711,7 @@ public abstract class Mob extends LivingEntity { } public boolean isSunBurnTick() { diff --git a/patches/server/0178-Config-MobEffect-by-world.patch b/patches/server/0180-Config-MobEffect-by-world.patch similarity index 98% rename from patches/server/0178-Config-MobEffect-by-world.patch rename to patches/server/0180-Config-MobEffect-by-world.patch index cb246491c..c77dc2d18 100644 --- a/patches/server/0178-Config-MobEffect-by-world.patch +++ b/patches/server/0180-Config-MobEffect-by-world.patch @@ -40,7 +40,7 @@ index e708b2c987fac150c22b3367cec2e3e2bcb9914c..434f229c9e67c4ca459ab612345a1754 ((ServerPlayer) entityhuman).connection.send(new ClientboundSetHealthPacket(((ServerPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel)); diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index dad973fb21b2c3259c323e83c1ed08fbd696ca88..ce6379280814a5ce88ea2dbdf8185220204044a6 100644 +index 41b09eae6132497def6c5c615236b76fed94c911..f9cebe3887f53a7eede923093b4a5e083d3c6fdf 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -330,6 +330,21 @@ public class PurpurWorldConfig { diff --git a/patches/server/0179-Beacon-Activation-Range-Configurable.patch b/patches/server/0181-Beacon-Activation-Range-Configurable.patch similarity index 96% rename from patches/server/0179-Beacon-Activation-Range-Configurable.patch rename to patches/server/0181-Beacon-Activation-Range-Configurable.patch index 3d5536c4f..375cd4e67 100644 --- a/patches/server/0179-Beacon-Activation-Range-Configurable.patch +++ b/patches/server/0181-Beacon-Activation-Range-Configurable.patch @@ -26,7 +26,7 @@ index 49ca1d45bb4b3ddafc1d5952ff9830ba69b745e2..c1a76a7a029a4795b7a7cd61009993f9 } else { return effectRange; diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index ce6379280814a5ce88ea2dbdf8185220204044a6..19d90a881168409514fa4d31d3ccaa770b4edac3 100644 +index f9cebe3887f53a7eede923093b4a5e083d3c6fdf..b35b621346d4c9f284fe3c1d1b358c4f08a6fe4d 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -522,6 +522,17 @@ public class PurpurWorldConfig { diff --git a/patches/server/0180-Add-toggle-for-sand-duping-fix.patch b/patches/server/0182-Add-toggle-for-sand-duping-fix.patch similarity index 100% rename from patches/server/0180-Add-toggle-for-sand-duping-fix.patch rename to patches/server/0182-Add-toggle-for-sand-duping-fix.patch diff --git a/patches/server/0181-Add-toggle-for-end-portal-safe-teleporting.patch b/patches/server/0183-Add-toggle-for-end-portal-safe-teleporting.patch similarity index 95% rename from patches/server/0181-Add-toggle-for-end-portal-safe-teleporting.patch rename to patches/server/0183-Add-toggle-for-end-portal-safe-teleporting.patch index 166312f5f..7dd65403f 100644 --- a/patches/server/0181-Add-toggle-for-end-portal-safe-teleporting.patch +++ b/patches/server/0183-Add-toggle-for-end-portal-safe-teleporting.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add toggle for end portal safe teleporting diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index b2a84f1afb636218b0fa60c9129245b29d29268d..eb9c8f025c35402b0d07475c9cf0ca58334be2f9 100644 +index 66cf04d6035b1676d75ae46b73782461d07dff24..3c6f73c09c489d4114d00394b1adc6e9cb5dbcb9 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2934,7 +2934,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2968,7 +2968,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } this.processPortalCooldown(); diff --git a/patches/server/0182-Flying-Fall-Damage-API.patch b/patches/server/0184-Flying-Fall-Damage-API.patch similarity index 100% rename from patches/server/0182-Flying-Fall-Damage-API.patch rename to patches/server/0184-Flying-Fall-Damage-API.patch diff --git a/patches/server/0183-Make-lightning-rod-range-configurable.patch b/patches/server/0185-Make-lightning-rod-range-configurable.patch similarity index 89% rename from patches/server/0183-Make-lightning-rod-range-configurable.patch rename to patches/server/0185-Make-lightning-rod-range-configurable.patch index 16d03ee62..91e5850d8 100644 --- a/patches/server/0183-Make-lightning-rod-range-configurable.patch +++ b/patches/server/0185-Make-lightning-rod-range-configurable.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Make lightning rod range configurable diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 7167eb607844bec58a3e075aea1ff090f8fd90b5..e9d220904d22523336ec699c678a4dcb5fec95f5 100644 +index 59ab71b191476d211739f7df0be0a165d633e0fd..2ec4e52f0a2cb48f88bf98f1f70d80752fa89a5a 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -981,7 +981,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -997,7 +997,7 @@ public class ServerLevel extends Level implements WorldGenLevel { return holder.is(PoiTypes.LIGHTNING_ROD); }, (blockposition1) -> { return blockposition1.getY() == this.getHeight(Heightmap.Types.WORLD_SURFACE, blockposition1.getX(), blockposition1.getZ()) - 1; @@ -18,7 +18,7 @@ index 7167eb607844bec58a3e075aea1ff090f8fd90b5..e9d220904d22523336ec699c678a4dcb return optional.map((blockposition1) -> { return blockposition1.above(1); diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index 6faac76d7874d890b92c1a3ce5d974e74bed2de0..fb1de9b8f860cc1b7b63521ba48ee22db0a15699 100644 +index cbd5d395ab37a893340b5dbab866b6d2db1d0f01..43b3ccf9d6991cf72ab44da83b43f5807be5c4f7 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -268,6 +268,7 @@ public class PurpurConfig { diff --git a/patches/server/0184-Burp-delay-burp-after-eating-food-fills-hunger-bar-c.patch b/patches/server/0186-Burp-delay-burp-after-eating-food-fills-hunger-bar-c.patch similarity index 97% rename from patches/server/0184-Burp-delay-burp-after-eating-food-fills-hunger-bar-c.patch rename to patches/server/0186-Burp-delay-burp-after-eating-food-fills-hunger-bar-c.patch index 07bafab12..ca789293f 100644 --- a/patches/server/0184-Burp-delay-burp-after-eating-food-fills-hunger-bar-c.patch +++ b/patches/server/0186-Burp-delay-burp-after-eating-food-fills-hunger-bar-c.patch @@ -56,7 +56,7 @@ index 2934b6de1f1fb914a532ee20184df99d1acd8e65..4c1e9b6f4a52d7b1506b9016cc4d30e5 public void eat(Item item, ItemStack stack) { diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 12fd1b68a04caa9e5b6c2ea6d92845f01464bff9..78174622485b3c6092f35737a70405a2fa981dc2 100644 +index e2bcb73a99843dff02b2dcede9b3451262428a31..22baf3d82b2304c27d4a6fc50101478a9d3e7966 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -389,6 +389,8 @@ public class PurpurWorldConfig { diff --git a/patches/server/0185-Allow-player-join-full-server-by-permission.patch b/patches/server/0187-Allow-player-join-full-server-by-permission.patch similarity index 100% rename from patches/server/0185-Allow-player-join-full-server-by-permission.patch rename to patches/server/0187-Allow-player-join-full-server-by-permission.patch diff --git a/patches/server/0186-Add-permission-bypass-for-portal-waiting.patch b/patches/server/0188-Add-permission-bypass-for-portal-waiting.patch similarity index 100% rename from patches/server/0186-Add-permission-bypass-for-portal-waiting.patch rename to patches/server/0188-Add-permission-bypass-for-portal-waiting.patch diff --git a/patches/server/0187-Shulker-spawn-from-bullet-options.patch b/patches/server/0189-Shulker-spawn-from-bullet-options.patch similarity index 100% rename from patches/server/0187-Shulker-spawn-from-bullet-options.patch rename to patches/server/0189-Shulker-spawn-from-bullet-options.patch diff --git a/patches/server/0188-Eating-glow-berries-adds-glow-effect.patch b/patches/server/0190-Eating-glow-berries-adds-glow-effect.patch similarity index 97% rename from patches/server/0188-Eating-glow-berries-adds-glow-effect.patch rename to patches/server/0190-Eating-glow-berries-adds-glow-effect.patch index 6bf2e8a58..98da72fd3 100644 --- a/patches/server/0188-Eating-glow-berries-adds-glow-effect.patch +++ b/patches/server/0190-Eating-glow-berries-adds-glow-effect.patch @@ -18,7 +18,7 @@ index fd10ecc79b503b3a650bec1db656b86d58da81ac..306abbe878cb84cea0fd2d87d45594fc public static final Item SOUL_CAMPFIRE = registerBlock(Blocks.SOUL_CAMPFIRE); public static final Item SHROOMLIGHT = registerBlock(Blocks.SHROOMLIGHT); diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 47f1dfa01d2f005855a432d3235a47de53105830..2b7654043a90ff7b2d7535765ca4ce2b393d055e 100644 +index a94a3bc8be6f1aa518195e17d99655b02d292d14..d3ed64a39a91e4b12df9f4fc91ffd2f426d54778 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -221,6 +221,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0189-Option-to-make-drowned-break-doors.patch b/patches/server/0191-Option-to-make-drowned-break-doors.patch similarity index 100% rename from patches/server/0189-Option-to-make-drowned-break-doors.patch rename to patches/server/0191-Option-to-make-drowned-break-doors.patch diff --git a/patches/server/0190-Configurable-hunger-starvation-damage.patch b/patches/server/0192-Configurable-hunger-starvation-damage.patch similarity index 100% rename from patches/server/0190-Configurable-hunger-starvation-damage.patch rename to patches/server/0192-Configurable-hunger-starvation-damage.patch diff --git a/patches/server/0191-Enhance-SysoutCatcher.patch b/patches/server/0193-Enhance-SysoutCatcher.patch similarity index 100% rename from patches/server/0191-Enhance-SysoutCatcher.patch rename to patches/server/0193-Enhance-SysoutCatcher.patch diff --git a/patches/server/0192-Armor-click-equip-options.patch b/patches/server/0194-Armor-click-equip-options.patch similarity index 100% rename from patches/server/0192-Armor-click-equip-options.patch rename to patches/server/0194-Armor-click-equip-options.patch diff --git a/patches/server/0193-Add-uptime-command.patch b/patches/server/0195-Add-uptime-command.patch similarity index 97% rename from patches/server/0193-Add-uptime-command.patch rename to patches/server/0195-Add-uptime-command.patch index ed0731c91..4233d7412 100644 --- a/patches/server/0193-Add-uptime-command.patch +++ b/patches/server/0195-Add-uptime-command.patch @@ -17,7 +17,7 @@ index 880eb2697c156a1bdf81582a8cc4862a6892f042..b779b4a7118fbcc24752369a5944536f } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 35e0499575e9567093c187728bc37273f602531e..ca52d7e8bc891819067d7809734136470ab56484 100644 +index 33975783ec484d7d67851d69b5f3c85e690d359e..ab8eadbfda550c68fc7d53fa4a09ace201a5222b 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -292,6 +292,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0.0F) { this.playSound(this.getFallDamageSound((int) f3), 1.0F, 1.0F); @@ -17,7 +17,7 @@ index c975f66f5f7f80547202c7cff7ad0c6f90f0cbc9..001dbb7427f963cb570fc593eaeb0d72 } } diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 1cc3de5bf68c9f78017ccc9f3624caaff26f09aa..bc8b89ea000b2d86d6c55ad7f96b6de50625f089 100644 +index a2d367b331bb9e23643a64172385798adfc57552..f61e46c896b6b4676dffdadb00f04f92df53618e 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -185,12 +185,14 @@ public class PurpurWorldConfig { diff --git a/patches/server/0206-Add-Option-for-disable-observer-clocks.patch b/patches/server/0208-Add-Option-for-disable-observer-clocks.patch similarity index 95% rename from patches/server/0206-Add-Option-for-disable-observer-clocks.patch rename to patches/server/0208-Add-Option-for-disable-observer-clocks.patch index 9e983220c..fb99e7e3f 100644 --- a/patches/server/0206-Add-Option-for-disable-observer-clocks.patch +++ b/patches/server/0208-Add-Option-for-disable-observer-clocks.patch @@ -18,7 +18,7 @@ index 7b45d6b9a005036ca5051d089a7be792eb87012f..8806c97ecc6bdd8a64c2d82bb2f58f46 } diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index bc8b89ea000b2d86d6c55ad7f96b6de50625f089..34c5286191941e95513f0f7457f3b1a8adc43c72 100644 +index f61e46c896b6b4676dffdadb00f04f92df53618e..e1997fa949d21d2c5f4c248ed8292fbb5d2eb4e6 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -368,6 +368,11 @@ public class PurpurWorldConfig { diff --git a/patches/server/0207-Customizeable-Zombie-Villager-curing-times.patch b/patches/server/0209-Customizeable-Zombie-Villager-curing-times.patch similarity index 100% rename from patches/server/0207-Customizeable-Zombie-Villager-curing-times.patch rename to patches/server/0209-Customizeable-Zombie-Villager-curing-times.patch diff --git a/patches/server/0208-Option-for-sponges-to-work-on-lava.patch b/patches/server/0210-Option-for-sponges-to-work-on-lava.patch similarity index 100% rename from patches/server/0208-Option-for-sponges-to-work-on-lava.patch rename to patches/server/0210-Option-for-sponges-to-work-on-lava.patch diff --git a/patches/server/0209-Toggle-for-Wither-s-spawn-sound.patch b/patches/server/0211-Toggle-for-Wither-s-spawn-sound.patch similarity index 100% rename from patches/server/0209-Toggle-for-Wither-s-spawn-sound.patch rename to patches/server/0211-Toggle-for-Wither-s-spawn-sound.patch diff --git a/patches/server/0210-Cactus-breaks-from-solid-neighbors-config.patch b/patches/server/0212-Cactus-breaks-from-solid-neighbors-config.patch similarity index 100% rename from patches/server/0210-Cactus-breaks-from-solid-neighbors-config.patch rename to patches/server/0212-Cactus-breaks-from-solid-neighbors-config.patch diff --git a/patches/server/0211-Config-to-remove-curse-of-binding-with-weakness.patch b/patches/server/0213-Config-to-remove-curse-of-binding-with-weakness.patch similarity index 97% rename from patches/server/0211-Config-to-remove-curse-of-binding-with-weakness.patch rename to patches/server/0213-Config-to-remove-curse-of-binding-with-weakness.patch index c74edb9ce..44acf7361 100644 --- a/patches/server/0211-Config-to-remove-curse-of-binding-with-weakness.patch +++ b/patches/server/0213-Config-to-remove-curse-of-binding-with-weakness.patch @@ -26,7 +26,7 @@ index 150701f965006f1c7dc9d801ca0ab0add927d143..4b8669f0b881e524c0cbf570c442ca8a @Override diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 5ff17517d11b79537fec4a581251649eca44ced2..db01afa10d6ffae243e2e8bccd3cb8dc9e4d449a 100644 +index df687020c0d3e7b5a4cf7ce5871b2aae3c5fd5a1..9ebd8b4b527fe8c30483abf34a5840fe0c77355e 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -407,6 +407,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0212-Conduit-behavior-configuration.patch b/patches/server/0214-Conduit-behavior-configuration.patch similarity index 100% rename from patches/server/0212-Conduit-behavior-configuration.patch rename to patches/server/0214-Conduit-behavior-configuration.patch diff --git a/patches/server/0213-Cauldron-fill-chances.patch b/patches/server/0215-Cauldron-fill-chances.patch similarity index 100% rename from patches/server/0213-Cauldron-fill-chances.patch rename to patches/server/0215-Cauldron-fill-chances.patch diff --git a/patches/server/0214-Config-to-allow-mobs-to-pathfind-over-rails.patch b/patches/server/0216-Config-to-allow-mobs-to-pathfind-over-rails.patch similarity index 97% rename from patches/server/0214-Config-to-allow-mobs-to-pathfind-over-rails.patch rename to patches/server/0216-Config-to-allow-mobs-to-pathfind-over-rails.patch index d38f46693..37e700c23 100644 --- a/patches/server/0214-Config-to-allow-mobs-to-pathfind-over-rails.patch +++ b/patches/server/0216-Config-to-allow-mobs-to-pathfind-over-rails.patch @@ -18,7 +18,7 @@ index 894881018c659d874f28f5744f0b8247cfecb1c1..6fbac97beacd0f806301c34de4ca6495 if (node != null && (node.type == BlockPathTypes.OPEN || node.type == BlockPathTypes.WALKABLE) && this.mob.getBbWidth() < 1.0F) { double g = (double)(x - direction.getStepX()) + 0.5D; diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 841ffd64a9dcc24479847de1d1565de82c4d1a08..1e8525e267d95e406dcc21615820f00cfdbc34b4 100644 +index 99358fb2f2f97dde8df4c8f4606b4e2e70ee11d1..1731c84ba16f56e12640132f693639db89ceded6 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -141,6 +141,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0215-Shulker-change-color-with-dye.patch b/patches/server/0217-Shulker-change-color-with-dye.patch similarity index 100% rename from patches/server/0215-Shulker-change-color-with-dye.patch rename to patches/server/0217-Shulker-change-color-with-dye.patch diff --git a/patches/server/0216-Extended-OfflinePlayer-API.patch b/patches/server/0218-Extended-OfflinePlayer-API.patch similarity index 100% rename from patches/server/0216-Extended-OfflinePlayer-API.patch rename to patches/server/0218-Extended-OfflinePlayer-API.patch diff --git a/patches/server/0217-Added-the-ability-to-add-combustible-items.patch b/patches/server/0219-Added-the-ability-to-add-combustible-items.patch similarity index 96% rename from patches/server/0217-Added-the-ability-to-add-combustible-items.patch rename to patches/server/0219-Added-the-ability-to-add-combustible-items.patch index a66f58be1..d0d01355d 100644 --- a/patches/server/0217-Added-the-ability-to-add-combustible-items.patch +++ b/patches/server/0219-Added-the-ability-to-add-combustible-items.patch @@ -51,10 +51,10 @@ index bbff7466cecf50285c97fadaf68682a6c6ea879f..5ae858b81e6f9903b7296077cf497f62 private int maxStack = MAX_STACK; public List transaction = new java.util.ArrayList(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 224d5acd50c5a1796340373f73bb44c38f841299..1e926f952f18128859604c866423639472c4d77b 100644 +index 63f0e6ae798f04784ee0e1ce1a24b7c2f7b3db27..34de9d0061626e083fcf70d4720d2ef9a90f72bd 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1445,6 +1445,19 @@ public final class CraftServer implements Server { +@@ -1450,6 +1450,19 @@ public final class CraftServer implements Server { return true; } diff --git a/patches/server/0218-Option-for-if-rain-and-thunder-should-stop-on-sleep.patch b/patches/server/0220-Option-for-if-rain-and-thunder-should-stop-on-sleep.patch similarity index 90% rename from patches/server/0218-Option-for-if-rain-and-thunder-should-stop-on-sleep.patch rename to patches/server/0220-Option-for-if-rain-and-thunder-should-stop-on-sleep.patch index b79a742ad..701981ca2 100644 --- a/patches/server/0218-Option-for-if-rain-and-thunder-should-stop-on-sleep.patch +++ b/patches/server/0220-Option-for-if-rain-and-thunder-should-stop-on-sleep.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Option for if rain and thunder should stop on sleep diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index f4b24ebacede304bc192efa5115bfb758b8fa6da..6450bf5fbad2df3165baede9852fe20197d7d50c 100644 +index 3bd2f3501f859d387ea6645b0f731563016d59f5..9866bc90423dd6ab4827afb546963dc7befb9b1a 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1189,6 +1189,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1205,6 +1205,7 @@ public class ServerLevel extends Level implements WorldGenLevel { private void resetWeatherCycle() { // CraftBukkit start @@ -16,7 +16,7 @@ index f4b24ebacede304bc192efa5115bfb758b8fa6da..6450bf5fbad2df3165baede9852fe201 this.serverLevelData.setRaining(false, org.bukkit.event.weather.WeatherChangeEvent.Cause.SLEEP); // Paper - when passing the night // If we stop due to everyone sleeping we should reset the weather duration to some other random value. // Not that everyone ever manages to get the whole server to sleep at the same time.... -@@ -1196,6 +1197,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1212,6 +1213,7 @@ public class ServerLevel extends Level implements WorldGenLevel { this.serverLevelData.setRainTime(0); } // CraftBukkit end @@ -25,7 +25,7 @@ index f4b24ebacede304bc192efa5115bfb758b8fa6da..6450bf5fbad2df3165baede9852fe201 // CraftBukkit start // If we stop due to everyone sleeping we should reset the weather duration to some other random value. diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 2bcea05572d25444b6390eadae258617e3071c90..08ef6efc26d3798a651b9fd1400d1b73d21b6b20 100644 +index ae772a31e0a53c26cb0f10dd23bdbef783df9770..feeb2e385650207cee824847c10c611ff7e6ba26 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -142,6 +142,8 @@ public class PurpurWorldConfig { diff --git a/patches/server/0219-Chance-for-azalea-blocks-to-grow-into-trees-naturall.patch b/patches/server/0221-Chance-for-azalea-blocks-to-grow-into-trees-naturall.patch similarity index 100% rename from patches/server/0219-Chance-for-azalea-blocks-to-grow-into-trees-naturall.patch rename to patches/server/0221-Chance-for-azalea-blocks-to-grow-into-trees-naturall.patch diff --git a/patches/server/0220-Shift-right-click-to-use-exp-for-mending.patch b/patches/server/0222-Shift-right-click-to-use-exp-for-mending.patch similarity index 94% rename from patches/server/0220-Shift-right-click-to-use-exp-for-mending.patch rename to patches/server/0222-Shift-right-click-to-use-exp-for-mending.patch index a73e086b9..57abbf53a 100644 --- a/patches/server/0220-Shift-right-click-to-use-exp-for-mending.patch +++ b/patches/server/0222-Shift-right-click-to-use-exp-for-mending.patch @@ -36,10 +36,10 @@ index 16f136dd8ed96a3eb7ae1cf9c6039b4f026fec25..744c936c3aa9bd7bcf43ac3d78a08ece + // Purpur end } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 5c09d0bbe552af208cb0443699c20639d67db566..cbcaf80736ab50f781b65f7a8c813331238c74ec 100644 +index 3098bcd3ef8dd4dee0d09f34af781e3767df4110..338608ad668b92f02d6ae138d215876fcd735e99 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2089,6 +2089,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2090,6 +2090,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic boolean cancelled; if (movingobjectposition == null || movingobjectposition.getType() != HitResult.Type.BLOCK) { @@ -48,7 +48,7 @@ index 5c09d0bbe552af208cb0443699c20639d67db566..cbcaf80736ab50f781b65f7a8c813331 cancelled = event.useItemInHand() == Event.Result.DENY; } else { diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 3acbb777269b1b117821383ed931dbe71bf0479b..4e209a65d03f4c240d19d51cea3c9c2c4264a718 100644 +index 22e6426270a5f6a2fb7f7b0bafff6f6d43dcb865..f3778a9b35bf0b70ff786160a713e39895370bed 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -414,6 +414,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0221-Dolphins-naturally-aggressive-to-players-chance.patch b/patches/server/0223-Dolphins-naturally-aggressive-to-players-chance.patch similarity index 100% rename from patches/server/0221-Dolphins-naturally-aggressive-to-players-chance.patch rename to patches/server/0223-Dolphins-naturally-aggressive-to-players-chance.patch diff --git a/patches/server/0222-Cows-naturally-aggressive-to-players-chance.patch b/patches/server/0224-Cows-naturally-aggressive-to-players-chance.patch similarity index 100% rename from patches/server/0222-Cows-naturally-aggressive-to-players-chance.patch rename to patches/server/0224-Cows-naturally-aggressive-to-players-chance.patch diff --git a/patches/server/0223-Option-for-beds-to-explode-on-villager-sleep.patch b/patches/server/0225-Option-for-beds-to-explode-on-villager-sleep.patch similarity index 94% rename from patches/server/0223-Option-for-beds-to-explode-on-villager-sleep.patch rename to patches/server/0225-Option-for-beds-to-explode-on-villager-sleep.patch index 0522cc6b5..06804e1cd 100644 --- a/patches/server/0223-Option-for-beds-to-explode-on-villager-sleep.patch +++ b/patches/server/0225-Option-for-beds-to-explode-on-villager-sleep.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Option for beds to explode on villager sleep diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index 1db5d966c2ce26c2e5e2999ae8639a20e30d6fa8..a2cf362d84135ff39a427024f7df1d1b694b10cb 100644 +index 873bc6c7ec79b713fcb9ac9a5a5c421c00d2cd79..d3a956e75ec9300eb675ebdcdd348418a60f7def 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -1083,6 +1083,12 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -1091,6 +1091,12 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @Override public void startSleeping(BlockPos pos) { diff --git a/patches/server/0224-Halloween-options-and-optimizations.patch b/patches/server/0226-Halloween-options-and-optimizations.patch similarity index 92% rename from patches/server/0224-Halloween-options-and-optimizations.patch rename to patches/server/0226-Halloween-options-and-optimizations.patch index e962420dd..a042db52b 100644 --- a/patches/server/0224-Halloween-options-and-optimizations.patch +++ b/patches/server/0226-Halloween-options-and-optimizations.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Halloween options and optimizations diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java -index b2fff9079c7460681d9cbd3d3e57b42dfcece44b..8c83a47e68adc65c198544ad10d08acf83485ee9 100644 +index 495e9eef387567fdbc929de94e88c74577c72eb7..c1569dd05137f98ba1af3276c9937b7164c91cd2 100644 --- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java +++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java @@ -319,7 +319,7 @@ public class Bat extends AmbientCreature { @@ -17,14 +17,14 @@ index b2fff9079c7460681d9cbd3d3e57b42dfcece44b..8c83a47e68adc65c198544ad10d08acf b0 = 7; } else if (random.nextBoolean()) { return false; -@@ -329,6 +329,7 @@ public class Bat extends AmbientCreature { - } - } - +@@ -333,6 +333,7 @@ public class Bat extends AmbientCreature { + private static boolean isSpookySeason = false; + private static final int ONE_HOUR = 20 * 60 * 60; + private static int lastSpookyCheck = -ONE_HOUR; + public static boolean isHalloweenSeason(Level level) { return level.purpurConfig.forceHalloweenSeason || isHalloween(); } // Purpur private static boolean isHalloween() { + if (net.minecraft.server.MinecraftServer.currentTick - lastSpookyCheck > ONE_HOUR) { LocalDate localdate = LocalDate.now(); - int i = localdate.get(ChronoField.DAY_OF_MONTH); diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java index 4505b61f10c3aad3d0ab144cea5ef6efc6ad7357..e542407894f58fb8c0339a7a6d2e7b2cb5891eb4 100644 --- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java diff --git a/patches/server/0225-Config-for-grindstones.patch b/patches/server/0227-Config-for-grindstones.patch similarity index 96% rename from patches/server/0225-Config-for-grindstones.patch rename to patches/server/0227-Config-for-grindstones.patch index 8d63ee75d..c8aaebefb 100644 --- a/patches/server/0225-Config-for-grindstones.patch +++ b/patches/server/0227-Config-for-grindstones.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Config for grindstones diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java -index 08e9cc68fa88e4ca42fa26c1425f101e72c094cb..23019df46720290f3b50b58606de9d97661812ac 100644 +index 233e8626280a8b93dcb8621a1405e8c308c6836b..446b5c66f82444ac1d77a3441421d43ffc3d0653 100644 --- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java +++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java @@ -130,7 +130,7 @@ public class GrindstoneMenu extends AbstractContainerMenu { @@ -57,7 +57,7 @@ index 08e9cc68fa88e4ca42fa26c1425f101e72c094cb..23019df46720290f3b50b58606de9d97 } diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index 46241ba295ac6575bec4dee0d99d31415eb6c77f..4fecd7e5882ef043ab9b0fa36fa1aa4ccd452440 100644 +index 5ab20a1701962af4abd3189b4072d3a9e35ba282..d975ec21330055c7b74cdcdd18bfcb3a3daf5ca8 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -322,6 +322,9 @@ public class PurpurConfig { diff --git a/patches/server/0226-UPnP-Port-Forwarding.patch b/patches/server/0228-UPnP-Port-Forwarding.patch similarity index 90% rename from patches/server/0226-UPnP-Port-Forwarding.patch rename to patches/server/0228-UPnP-Port-Forwarding.patch index cde3c7f62..fae53d7dc 100644 --- a/patches/server/0226-UPnP-Port-Forwarding.patch +++ b/patches/server/0228-UPnP-Port-Forwarding.patch @@ -5,7 +5,7 @@ Subject: [PATCH] UPnP Port Forwarding diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index ca52d7e8bc891819067d7809734136470ab56484..09add41216e85876517e4032523b60c08085da4c 100644 +index ab8eadbfda550c68fc7d53fa4a09ace201a5222b..d56e19925bff15d26dd40463c6945de468bbbce2 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -307,6 +307,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { @@ -405,7 +405,7 @@ index 0656bb44c3ac8a346ebec203239954d980c010e7..006d5fc7c96a47bf57ab26f374143400 @Override diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java -index 386eb27ba4c68d0a87ad5c0250b51987b62281e7..66371759b99371db21a910d2e4e5cb9219e70b9c 100644 +index 97a2313ff585f65f8bb7514f6fbc8655969b421d..183f67a32203b02b43ca3d612f950f288c754eac 100644 --- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java +++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java @@ -133,6 +133,11 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder entitytypes = entity.getType(); diff --git a/patches/server/0241-Configurable-valid-characters-for-usernames.patch b/patches/server/0243-Configurable-valid-characters-for-usernames.patch similarity index 95% rename from patches/server/0241-Configurable-valid-characters-for-usernames.patch rename to patches/server/0243-Configurable-valid-characters-for-usernames.patch index b93d49564..fec81a4db 100644 --- a/patches/server/0241-Configurable-valid-characters-for-usernames.patch +++ b/patches/server/0243-Configurable-valid-characters-for-usernames.patch @@ -18,7 +18,7 @@ index 4ab0a893677acbbcf939f28799b2df8bba8b5567..ed0b120b286c017a15c66193ef8c43a4 char c = in.charAt(i); diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index a20bdf37795a46324bbecfff51e7bd3e699e1fe0..0afd94f41863e4edf39e31bb9ba15a1695ab26d5 100644 +index 921d5095c3595b457ff4028693381eeffa7a44c1..d100bc3caab4fd2e03cf199a225c6a95930dd9f8 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -472,4 +472,11 @@ public class PurpurConfig { diff --git a/patches/server/0242-Shears-can-have-looting-enchantment.patch b/patches/server/0244-Shears-can-have-looting-enchantment.patch similarity index 98% rename from patches/server/0242-Shears-can-have-looting-enchantment.patch rename to patches/server/0244-Shears-can-have-looting-enchantment.patch index 1e52017c3..b7b57ae1a 100644 --- a/patches/server/0242-Shears-can-have-looting-enchantment.patch +++ b/patches/server/0244-Shears-can-have-looting-enchantment.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Shears can have looting enchantment diff --git a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java -index 2366d411bf64f88c7296e888cd3bf584825ae4a9..c119aae5b5f0d0717a883f3df5566185046534ee 100644 +index d1127d93a85a837933d0d73c24cacac4adc3a5b9..d9a6d273108165f59b995b1fd7748cb5c12b8b1f 100644 --- a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java @@ -107,7 +107,7 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior { @@ -158,7 +158,7 @@ index 6b8a1535086aae7e4e3229d05615fb903188f507..60af917083de1b790b1d93d61835a669 public int getMinCost(int level) { return 15 + (level - 1) * 9; diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index 0afd94f41863e4edf39e31bb9ba15a1695ab26d5..73c2ae25ec8b556a1fdac9a30a3863d6ebaccac8 100644 +index d100bc3caab4fd2e03cf199a225c6a95930dd9f8..a647503bea048857190c536904a01f68b69871a8 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -404,6 +404,7 @@ public class PurpurConfig { diff --git a/patches/server/0243-Stop-bees-from-dying-after-stinging.patch b/patches/server/0245-Stop-bees-from-dying-after-stinging.patch similarity index 100% rename from patches/server/0243-Stop-bees-from-dying-after-stinging.patch rename to patches/server/0245-Stop-bees-from-dying-after-stinging.patch diff --git a/patches/server/0244-Give-bee-counts-in-beehives-to-Purpur-clients.patch b/patches/server/0246-Give-bee-counts-in-beehives-to-Purpur-clients.patch similarity index 91% rename from patches/server/0244-Give-bee-counts-in-beehives-to-Purpur-clients.patch rename to patches/server/0246-Give-bee-counts-in-beehives-to-Purpur-clients.patch index 859779558..1b1a0a36c 100644 --- a/patches/server/0244-Give-bee-counts-in-beehives-to-Purpur-clients.patch +++ b/patches/server/0246-Give-bee-counts-in-beehives-to-Purpur-clients.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Give bee counts in beehives to Purpur clients diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 09add41216e85876517e4032523b60c08085da4c..732b2e703d25dde4af9808e940aca2f21b7ca71e 100644 +index d56e19925bff15d26dd40463c6945de468bbbce2..15285d2b132a82a7b7f9c2c558e1157b7585d43f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1032,6 +1032,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop entityType, Level world) { - this(entityType, world, VillagerType.PLAINS); -@@ -194,6 +196,47 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + public long nextGolemPanic = -1; // Pufferfish + +@@ -196,6 +198,47 @@ public class Villager extends AbstractVillager implements ReputationEventHandler protected boolean isAlwaysExperienceDropper() { return this.level.purpurConfig.villagerAlwaysDropExp; } @@ -65,7 +65,7 @@ index 4871ead905efe3c848a7a7321d7be3c3aade1593..f8c78da70ad8b36c07c02259227a4344 // Purpur end @Override -@@ -290,7 +333,22 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -293,12 +336,27 @@ public class Villager extends AbstractVillager implements ReputationEventHandler protected void customServerAiStep() { mobTick(false); } protected void mobTick(boolean inactive) { this.level.getProfiler().push("villagerBrain"); @@ -78,7 +78,12 @@ index 4871ead905efe3c848a7a7321d7be3c3aade1593..f8c78da70ad8b36c07c02259227a4344 + this.isLobotomized = false; + } + // Purpur end - if (!inactive && (getRider() == null || !this.isControllable())) this.getBrain().tick((ServerLevel) this.level, this); // Paper // Purpur - only use brain if no rider + // Pufferfish start + if (!inactive) { + if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider + this.getBrain().tick((ServerLevel) this.level, this); // Paper + } + // Pufferfish end + // Purpur start + else if (this.isLobotomized && shouldRestock()) { + // make sure we restock if needed when lobotomized diff --git a/patches/server/0254-Option-for-villager-display-trade-item.patch b/patches/server/0256-Option-for-villager-display-trade-item.patch similarity index 100% rename from patches/server/0254-Option-for-villager-display-trade-item.patch rename to patches/server/0256-Option-for-villager-display-trade-item.patch diff --git a/patches/server/0255-Fill-command-max-area-option.patch b/patches/server/0257-Fill-command-max-area-option.patch similarity index 96% rename from patches/server/0255-Fill-command-max-area-option.patch rename to patches/server/0257-Fill-command-max-area-option.patch index be47ce03f..2c82dd159 100644 --- a/patches/server/0255-Fill-command-max-area-option.patch +++ b/patches/server/0257-Fill-command-max-area-option.patch @@ -22,7 +22,7 @@ index 99fbb24dabe867ed4956a2996543107f58a57193..5c81c64540579fbacc335a3fadf4bf59 List list = Lists.newArrayList(); ServerLevel serverLevel = source.getLevel(); diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index 6cb9acea12fdc75ea540096dc84f91e8ba9c6236..65f2c37e667f78c4f2bb59e5db7f870d2534513a 100644 +index 15bf97076dd7acc2ab7e36e1ccdea4188c87bf09..acae4b236427f10bae3b9180e9e2387bd523fa72 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -274,6 +274,7 @@ public class PurpurConfig { diff --git a/patches/server/0256-MC-238526-Fix-spawner-not-spawning-water-animals-cor.patch b/patches/server/0258-MC-238526-Fix-spawner-not-spawning-water-animals-cor.patch similarity index 100% rename from patches/server/0256-MC-238526-Fix-spawner-not-spawning-water-animals-cor.patch rename to patches/server/0258-MC-238526-Fix-spawner-not-spawning-water-animals-cor.patch diff --git a/patches/server/0257-Config-for-mob-last-hurt-by-player-time.patch b/patches/server/0259-Config-for-mob-last-hurt-by-player-time.patch similarity index 93% rename from patches/server/0257-Config-for-mob-last-hurt-by-player-time.patch rename to patches/server/0259-Config-for-mob-last-hurt-by-player-time.patch index 5d319501d..24f34d028 100644 --- a/patches/server/0257-Config-for-mob-last-hurt-by-player-time.patch +++ b/patches/server/0259-Config-for-mob-last-hurt-by-player-time.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Config for mob last hurt by player time diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 3328dfb1790d66de36b92d0ef82ec6cabfde0968..cbee6924e6c26fafe51d996491ed89434ce1e0e5 100644 +index 77f6e84137e923a9cbd2fbb76bf6542e1712d17e..938b224c833c0bc678cb4a6f4c856d57f6778233 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1452,13 +1452,13 @@ public abstract class LivingEntity extends Entity { +@@ -1460,13 +1460,13 @@ public abstract class LivingEntity extends Entity { } if (entity1 instanceof net.minecraft.world.entity.player.Player) { @@ -38,7 +38,7 @@ index ea327baa5368afc27402d5863a6e238cea5be732..c56ea02591cae25834de4ca6045437ed // Paper end diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 8bbfa9cfa17a3d654c4267b3a36335530e87c430..b7bd5475d5f099515381cfc4e51f2b84af3aca6c 100644 +index 49bb74b5d7dbbca52b7e195897ee75153e498c6d..9b330eaabc237472b2901eb5919df4fe298b0786 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -145,6 +145,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0258-Anvil-repair-damage-options.patch b/patches/server/0260-Anvil-repair-damage-options.patch similarity index 98% rename from patches/server/0258-Anvil-repair-damage-options.patch rename to patches/server/0260-Anvil-repair-damage-options.patch index 3ae1d2b64..c2376f644 100644 --- a/patches/server/0258-Anvil-repair-damage-options.patch +++ b/patches/server/0260-Anvil-repair-damage-options.patch @@ -64,7 +64,7 @@ index 2aac479ce9886cfef99823a41205eb52b7996d26..ff9945a04ffbda5766bc794fced24f14 return InteractionResult.SUCCESS; } else { diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index b7bd5475d5f099515381cfc4e51f2b84af3aca6c..d1f0e4ebecc7ddd9c6728334d6e784113a657a10 100644 +index 9b330eaabc237472b2901eb5919df4fe298b0786..992c178a540753ae13ca3cb7c23dabf7663be160 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -721,9 +721,13 @@ public class PurpurWorldConfig { diff --git a/patches/server/0259-Fix-legacy-colors-in-console.patch b/patches/server/0261-Fix-legacy-colors-in-console.patch similarity index 100% rename from patches/server/0259-Fix-legacy-colors-in-console.patch rename to patches/server/0261-Fix-legacy-colors-in-console.patch diff --git a/patches/server/0260-Option-to-disable-turtle-egg-trampling-with-feather-.patch b/patches/server/0262-Option-to-disable-turtle-egg-trampling-with-feather-.patch similarity index 96% rename from patches/server/0260-Option-to-disable-turtle-egg-trampling-with-feather-.patch rename to patches/server/0262-Option-to-disable-turtle-egg-trampling-with-feather-.patch index 522bb5956..a3d7e16eb 100644 --- a/patches/server/0260-Option-to-disable-turtle-egg-trampling-with-feather-.patch +++ b/patches/server/0262-Option-to-disable-turtle-egg-trampling-with-feather-.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Option to disable turtle egg trampling with feather falling diff --git a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java -index d4896c4d1eca6a1494571a40024422ada41d1e78..9f56496fd327f5baaf6b12f40d75646a0be5a6d4 100644 +index a1c6d0bfc38f57737dcf885488c8bd7ffcab393a..f39b902bea3e7dca15d3af2bc590182685e34c7f 100644 --- a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java @@ -211,6 +211,10 @@ public class TurtleEggBlock extends Block { diff --git a/patches/server/0261-Add-toggle-for-enchant-level-clamping.patch b/patches/server/0263-Add-toggle-for-enchant-level-clamping.patch similarity index 97% rename from patches/server/0261-Add-toggle-for-enchant-level-clamping.patch rename to patches/server/0263-Add-toggle-for-enchant-level-clamping.patch index 7e61cbf15..b668ab2d1 100644 --- a/patches/server/0261-Add-toggle-for-enchant-level-clamping.patch +++ b/patches/server/0263-Add-toggle-for-enchant-level-clamping.patch @@ -31,7 +31,7 @@ index 659cd2d43d3cabc9bcc50857d6de858f417b7c31..b96b1e4efa35b796a985bf1eb4a7158c @Nullable diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index 65f2c37e667f78c4f2bb59e5db7f870d2534513a..6ae12d6684620a0e524294b28a5abcbc53392089 100644 +index acae4b236427f10bae3b9180e9e2387bd523fa72..8a517170c6076badd47e48b64538816857ed413e 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -412,6 +412,7 @@ public class PurpurConfig { diff --git a/patches/server/0262-Skip-junit-tests-for-purpur-commands.patch b/patches/server/0264-Skip-junit-tests-for-purpur-commands.patch similarity index 100% rename from patches/server/0262-Skip-junit-tests-for-purpur-commands.patch rename to patches/server/0264-Skip-junit-tests-for-purpur-commands.patch diff --git a/patches/server/0263-Implement-configurable-search-radius-for-villagers-t.patch b/patches/server/0265-Implement-configurable-search-radius-for-villagers-t.patch similarity index 94% rename from patches/server/0263-Implement-configurable-search-radius-for-villagers-t.patch rename to patches/server/0265-Implement-configurable-search-radius-for-villagers-t.patch index 23c68a1f4..f7e954730 100644 --- a/patches/server/0263-Implement-configurable-search-radius-for-villagers-t.patch +++ b/patches/server/0265-Implement-configurable-search-radius-for-villagers-t.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Implement configurable search radius for villagers to spawn diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index f8c78da70ad8b36c07c02259227a43444642e926..dd724eccd08c60f482f74dfadea21ef6087856a4 100644 +index ab1e841f14c6776644f8a2f92f6db98e83724afc..700d32abc957769960fd081072c941681474f7f0 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -1073,6 +1073,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -1081,6 +1081,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } public void spawnGolemIfNeeded(ServerLevel world, long time, int requiredCount) { diff --git a/patches/server/0264-Stonecutter-damage.patch b/patches/server/0266-Stonecutter-damage.patch similarity index 100% rename from patches/server/0264-Stonecutter-damage.patch rename to patches/server/0266-Stonecutter-damage.patch diff --git a/patches/server/0265-Configurable-damage-settings-for-magma-blocks.patch b/patches/server/0267-Configurable-damage-settings-for-magma-blocks.patch similarity index 100% rename from patches/server/0265-Configurable-damage-settings-for-magma-blocks.patch rename to patches/server/0267-Configurable-damage-settings-for-magma-blocks.patch diff --git a/patches/server/0266-Add-config-for-snow-on-blue-ice.patch b/patches/server/0268-Add-config-for-snow-on-blue-ice.patch similarity index 100% rename from patches/server/0266-Add-config-for-snow-on-blue-ice.patch rename to patches/server/0268-Add-config-for-snow-on-blue-ice.patch diff --git a/patches/server/0267-Skeletons-eat-wither-roses.patch b/patches/server/0269-Skeletons-eat-wither-roses.patch similarity index 100% rename from patches/server/0267-Skeletons-eat-wither-roses.patch rename to patches/server/0269-Skeletons-eat-wither-roses.patch diff --git a/patches/server/0268-Enchantment-Table-Persists-Lapis.patch b/patches/server/0270-Enchantment-Table-Persists-Lapis.patch similarity index 100% rename from patches/server/0268-Enchantment-Table-Persists-Lapis.patch rename to patches/server/0270-Enchantment-Table-Persists-Lapis.patch diff --git a/patches/server/0269-Spark-Profiler.patch b/patches/server/0271-Spark-Profiler.patch similarity index 96% rename from patches/server/0269-Spark-Profiler.patch rename to patches/server/0271-Spark-Profiler.patch index 01ea58478..159f498c5 100644 --- a/patches/server/0269-Spark-Profiler.patch +++ b/patches/server/0271-Spark-Profiler.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Spark Profiler diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 1e926f952f18128859604c866423639472c4d77b..c77f76d3b346d25aa48233ad8516a85118f26a9f 100644 +index 34de9d0061626e083fcf70d4720d2ef9a90f72bd..bc7c2aa4aa2a002faaaccf5f499218d390772e3b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -433,7 +433,38 @@ public final class CraftServer implements Server { diff --git a/patches/server/0270-Option-to-disable-kick-for-out-of-order-chat.patch b/patches/server/0272-Option-to-disable-kick-for-out-of-order-chat.patch similarity index 87% rename from patches/server/0270-Option-to-disable-kick-for-out-of-order-chat.patch rename to patches/server/0272-Option-to-disable-kick-for-out-of-order-chat.patch index ed8f97f35..3f895970e 100644 --- a/patches/server/0270-Option-to-disable-kick-for-out-of-order-chat.patch +++ b/patches/server/0272-Option-to-disable-kick-for-out-of-order-chat.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Option to disable kick for out of order chat diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 69011c01936eae6a8939b94acfaac56c2cf6cae6..cf948e263d33d0b6f7f3ab498c5afbad2325d893 100644 +index e90bb1c52063e8747a8d05cb481d3447b74d31a0..6dfb1474278329231c1e64d48a9d895b45e07d0c 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2440,7 +2440,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2442,7 +2442,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic do { instant1 = (Instant) this.lastChatTimeStamp.get(); if (timestamp.isBefore(instant1)) { @@ -18,7 +18,7 @@ index 69011c01936eae6a8939b94acfaac56c2cf6cae6..cf948e263d33d0b6f7f3ab498c5afbad } while (!this.lastChatTimeStamp.compareAndSet(instant1, timestamp)); diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index fec6308aeb99826040fdf5424362b99e07b42838..986f4daaf054b0807deab5066c6734b18ddaa7a1 100644 +index 44d6b32ad6a760a12fa8ea27f09b2f950e1376f3..dd4ddb63a21b65cff85e30f3bfb571cd05f97933 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -478,9 +478,11 @@ public class PurpurConfig { diff --git a/patches/server/0271-Config-for-sculk-shrieker-can_summon-state.patch b/patches/server/0273-Config-for-sculk-shrieker-can_summon-state.patch similarity index 100% rename from patches/server/0271-Config-for-sculk-shrieker-can_summon-state.patch rename to patches/server/0273-Config-for-sculk-shrieker-can_summon-state.patch diff --git a/patches/server/0272-Config-to-not-let-coral-die.patch b/patches/server/0274-Config-to-not-let-coral-die.patch similarity index 100% rename from patches/server/0272-Config-to-not-let-coral-die.patch rename to patches/server/0274-Config-to-not-let-coral-die.patch diff --git a/patches/server/0273-Add-local-difficulty-api.patch b/patches/server/0275-Add-local-difficulty-api.patch similarity index 100% rename from patches/server/0273-Add-local-difficulty-api.patch rename to patches/server/0275-Add-local-difficulty-api.patch diff --git a/patches/server/0274-Add-toggle-for-RNG-manipulation.patch b/patches/server/0276-Add-toggle-for-RNG-manipulation.patch similarity index 91% rename from patches/server/0274-Add-toggle-for-RNG-manipulation.patch rename to patches/server/0276-Add-toggle-for-RNG-manipulation.patch index 4174974b6..471366a91 100644 --- a/patches/server/0274-Add-toggle-for-RNG-manipulation.patch +++ b/patches/server/0276-Add-toggle-for-RNG-manipulation.patch @@ -7,10 +7,10 @@ Paper patches RNG maniplulation by using a shared (and locked) random source. This comes with a performance gain, but technical players may prefer the ability to manipulate RNG. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 542f527231ae1fc1e079752eeb64d9a93d077c35..742a4aff9d43c03d9a311641b0d4f93571a6bcf0 100644 +index 128ab97fbf3e52437aaf3094e1cff86cf3925609..0bbf6c9879ebd286135cbf145c1eb8a95a1ef881 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -549,7 +549,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -577,7 +577,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { this.bb = Entity.INITIAL_AABB; this.stuckSpeedMultiplier = Vec3.ZERO; this.nextStep = 1.0F; @@ -33,7 +33,7 @@ index 21f5304e01e0844f1bbf3e1b2f9d50c01f8bf8fd..8afdb5d4fecbb45bad2ed801fc0e526d } diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index d8067822ee9b94a070773950bc893032b10e7c3a..189d409e83529740221df7565c343bb108ca1203 100644 +index a34e8a7ec9c42c562646cbf7db767919e3128086..30ca7197711f0e8f18a7afb290a17be4489f6499 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -207,9 +207,11 @@ public class PurpurWorldConfig { diff --git a/patches/server/0275-Send-client-custom-name-of-BE.patch b/patches/server/0277-Send-client-custom-name-of-BE.patch similarity index 100% rename from patches/server/0275-Send-client-custom-name-of-BE.patch rename to patches/server/0277-Send-client-custom-name-of-BE.patch diff --git a/patches/server/0276-PaperPR-Fix-exact-choice-recipe-book-clicks.patch b/patches/server/0278-PaperPR-Fix-exact-choice-recipe-book-clicks.patch similarity index 100% rename from patches/server/0276-PaperPR-Fix-exact-choice-recipe-book-clicks.patch rename to patches/server/0278-PaperPR-Fix-exact-choice-recipe-book-clicks.patch diff --git a/patches/server/0277-Allow-custom-ChatDecorators.patch b/patches/server/0279-Allow-custom-ChatDecorators.patch similarity index 90% rename from patches/server/0277-Allow-custom-ChatDecorators.patch rename to patches/server/0279-Allow-custom-ChatDecorators.patch index 44ec40a2c..e8799ed2c 100644 --- a/patches/server/0277-Allow-custom-ChatDecorators.patch +++ b/patches/server/0279-Allow-custom-ChatDecorators.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Allow custom ChatDecorators Requires NMS to utilize. I'll write an API for this once our upstreams calm down with the changes. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 732b2e703d25dde4af9808e940aca2f21b7ca71e..65ca6866465c4c427735652901be112273a3e1ba 100644 +index 15285d2b132a82a7b7f9c2c558e1157b7585d43f..7b37dc81bca016ecad7a89013326053f74ba0ca1 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -2634,6 +2634,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { return ichunkaccess1; -@@ -598,17 +598,17 @@ public class ServerChunkCache extends ChunkSource { +@@ -601,17 +601,17 @@ public class ServerChunkCache extends ChunkSource { public void save(boolean flush) { this.runDistanceManagerUpdates(); @@ -383,7 +392,7 @@ index ca84eddbdb1e198b899750e5f6b3eafd25ce970f..2338be893b15eeecda336aea12803b7d } // Paper end -@@ -638,22 +638,22 @@ public class ServerChunkCache extends ChunkSource { +@@ -641,22 +641,22 @@ public class ServerChunkCache extends ChunkSource { @Override public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) { this.level.getProfiler().push("purge"); @@ -412,7 +421,7 @@ index ca84eddbdb1e198b899750e5f6b3eafd25ce970f..2338be893b15eeecda336aea12803b7d this.level.getProfiler().pop(); this.clearCache(); } -@@ -707,7 +707,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -711,7 +711,7 @@ public class ServerChunkCache extends ChunkSource { boolean flag1 = level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && worlddata.getGameTime() % level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit gameprofilerfiller.push("naturalSpawnCount"); @@ -421,14 +430,14 @@ index ca84eddbdb1e198b899750e5f6b3eafd25ce970f..2338be893b15eeecda336aea12803b7d int l = this.distanceManager.getNaturalSpawnChunkCount(); // Paper start - per player mob spawning NaturalSpawner.SpawnState spawnercreature_d; // moved down -@@ -721,12 +721,12 @@ public class ServerChunkCache extends ChunkSource { - spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, this.chunkMap.playerMobDistanceMap == null ? new LocalMobCapCalculator(this.chunkMap) : null, false); +@@ -732,12 +732,12 @@ public class ServerChunkCache extends ChunkSource { + // Pufferfish end } // Paper end - this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings + //this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings // Purpur - this.lastSpawnState = spawnercreature_d; + //this.lastSpawnState = spawnercreature_d; // Pufferfish - this is managed asynchronously gameprofilerfiller.popPush("filteringLoadedChunks"); // Paper - moved down - this.level.timings.chunkTicks.startTiming(); // Paper @@ -436,7 +445,7 @@ index ca84eddbdb1e198b899750e5f6b3eafd25ce970f..2338be893b15eeecda336aea12803b7d // Paper - moved down -@@ -780,17 +780,17 @@ public class ServerChunkCache extends ChunkSource { +@@ -791,17 +791,17 @@ public class ServerChunkCache extends ChunkSource { } } // Paper end - optimise chunk tick iteration @@ -458,7 +467,7 @@ index ca84eddbdb1e198b899750e5f6b3eafd25ce970f..2338be893b15eeecda336aea12803b7d if (!this.chunkMap.needsChangeBroadcasting.isEmpty()) { ReferenceOpenHashSet copy = this.chunkMap.needsChangeBroadcasting.clone(); this.chunkMap.needsChangeBroadcasting.clear(); -@@ -802,7 +802,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -813,7 +813,7 @@ public class ServerChunkCache extends ChunkSource { } } } @@ -468,7 +477,7 @@ index ca84eddbdb1e198b899750e5f6b3eafd25ce970f..2338be893b15eeecda336aea12803b7d // Paper end - use set of chunks requiring updates, rather than iterating every single one loaded // Paper start - controlled flush for entity tracker packets diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 8fd3511d484cfd2b56238530aea95c84effcd1f1..747b8571ae8b324b0bd2f6eee1391948d6ab66b8 100644 +index e2dd2917486ccdadc20de7df7b82f22fd3459fd3..6169078be600a850d68c437a33fb5531f20ae4ec 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -689,7 +689,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -524,9 +533,9 @@ index 8fd3511d484cfd2b56238530aea95c84effcd1f1..747b8571ae8b324b0bd2f6eee1391948 - timings.entityTick.startTiming(); // Spigot + //timings.entityTick.startTiming(); // Spigot // Purpur this.entityTickList.forEach((entity) -> { + entity.activatedPriorityReset = false; // Pufferfish - DAB if (!entity.isRemoved()) { - if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed -@@ -757,8 +757,8 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -771,8 +771,8 @@ public class ServerLevel extends Level implements WorldGenLevel { } } }); @@ -537,7 +546,7 @@ index 8fd3511d484cfd2b56238530aea95c84effcd1f1..747b8571ae8b324b0bd2f6eee1391948 gameprofilerfiller.pop(); this.tickBlockEntities(); } -@@ -938,7 +938,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -954,7 +954,7 @@ public class ServerLevel extends Level implements WorldGenLevel { // Paper start - optimise random block ticking gameprofilerfiller.popPush("randomTick"); @@ -546,7 +555,7 @@ index 8fd3511d484cfd2b56238530aea95c84effcd1f1..747b8571ae8b324b0bd2f6eee1391948 if (randomTickSpeed > 0) { LevelChunkSection[] sections = chunk.getSections(); int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this); -@@ -972,7 +972,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -988,7 +988,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } } // Paper end - optimise random block ticking @@ -555,7 +564,7 @@ index 8fd3511d484cfd2b56238530aea95c84effcd1f1..747b8571ae8b324b0bd2f6eee1391948 gameprofilerfiller.pop(); } -@@ -1265,8 +1265,8 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1281,8 +1281,8 @@ public class ServerLevel extends Level implements WorldGenLevel { // Spigot end // Paper start- timings final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity); @@ -566,7 +575,7 @@ index 8fd3511d484cfd2b56238530aea95c84effcd1f1..747b8571ae8b324b0bd2f6eee1391948 // Paper end - timings entity.setOldPosAndRot(); ProfilerFiller gameprofilerfiller = this.getProfiler(); -@@ -1282,7 +1282,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1298,7 +1298,7 @@ public class ServerLevel extends Level implements WorldGenLevel { entity.postTick(); // CraftBukkit } else { entity.inactiveTick(); } // Paper - EAR 2 this.getProfiler().pop(); @@ -575,7 +584,7 @@ index 8fd3511d484cfd2b56238530aea95c84effcd1f1..747b8571ae8b324b0bd2f6eee1391948 Iterator iterator = entity.getPassengers().iterator(); while (iterator.hasNext()) { -@@ -1305,8 +1305,8 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1321,8 +1321,8 @@ public class ServerLevel extends Level implements WorldGenLevel { if (passenger instanceof Player || this.entityTickList.contains(passenger)) { // Paper - EAR 2 final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(passenger); @@ -586,7 +595,7 @@ index 8fd3511d484cfd2b56238530aea95c84effcd1f1..747b8571ae8b324b0bd2f6eee1391948 // Paper end passenger.setOldPosAndRot(); ++passenger.tickCount; -@@ -1336,7 +1336,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1352,7 +1352,7 @@ public class ServerLevel extends Level implements WorldGenLevel { this.tickPassenger(passenger, entity2); } @@ -595,7 +604,7 @@ index 8fd3511d484cfd2b56238530aea95c84effcd1f1..747b8571ae8b324b0bd2f6eee1391948 } } else { passenger.stopRiding(); -@@ -1356,14 +1356,14 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1372,14 +1372,14 @@ public class ServerLevel extends Level implements WorldGenLevel { org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); } @@ -613,7 +622,7 @@ index 8fd3511d484cfd2b56238530aea95c84effcd1f1..747b8571ae8b324b0bd2f6eee1391948 // Copied from save() // CraftBukkit start - moved from MinecraftServer.saveChunks -@@ -1375,7 +1375,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1391,7 +1391,7 @@ public class ServerLevel extends Level implements WorldGenLevel { this.convertable.saveDataTag(this.server.registryAccess(), this.serverLevelData, this.server.getPlayerList().getSingleplayerData()); } // CraftBukkit end @@ -622,7 +631,7 @@ index 8fd3511d484cfd2b56238530aea95c84effcd1f1..747b8571ae8b324b0bd2f6eee1391948 } // Paper end -@@ -1389,7 +1389,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1405,7 +1405,7 @@ public class ServerLevel extends Level implements WorldGenLevel { if (!savingDisabled) { org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit @@ -631,7 +640,7 @@ index 8fd3511d484cfd2b56238530aea95c84effcd1f1..747b8571ae8b324b0bd2f6eee1391948 if (progressListener != null) { progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel")); } -@@ -1399,11 +1399,11 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1415,11 +1415,11 @@ public class ServerLevel extends Level implements WorldGenLevel { progressListener.progressStage(Component.translatable("menu.savingChunks")); } @@ -647,10 +656,10 @@ index 8fd3511d484cfd2b56238530aea95c84effcd1f1..747b8571ae8b324b0bd2f6eee1391948 } else if (close) { chunkproviderserver.close(false); } // Paper - rewrite chunk system diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index cf948e263d33d0b6f7f3ab498c5afbad2325d893..524f513a9f2571f71eb01a1e9935b8176c18409b 100644 +index 6dfb1474278329231c1e64d48a9d895b45e07d0c..fd835cd58213078df4a5a53ce710263d564644d1 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2577,7 +2577,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2579,7 +2579,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } } // Paper End @@ -659,7 +668,7 @@ index cf948e263d33d0b6f7f3ab498c5afbad2325d893..524f513a9f2571f71eb01a1e9935b817 if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s); -@@ -2587,7 +2587,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2589,7 +2589,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.cserver.getPluginManager().callEvent(event); if (event.isCancelled()) { @@ -668,7 +677,7 @@ index cf948e263d33d0b6f7f3ab498c5afbad2325d893..524f513a9f2571f71eb01a1e9935b817 return; } -@@ -2600,7 +2600,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2602,7 +2602,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); return; } finally { @@ -749,10 +758,10 @@ index fcdb9bde8e1605e30dde3e580491522d4b62cdc0..7094701d213c73ba47ace806962244c1 } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 730a6e8bac4436a62c4ef5a122f55fc92432ae6a..d677e51e82d51a5b1a2387d5aa5d236e76e717e1 100644 +index f289d51d216dc503ffadd3210d7f781a4918ff08..8a9269c207c6b39d440d213679c31878bc689735 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -912,15 +912,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1015,15 +1015,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { ProfilerFiller gameprofilerfiller = this.getProfiler(); gameprofilerfiller.push("blockEntities"); @@ -771,7 +780,7 @@ index 730a6e8bac4436a62c4ef5a122f55fc92432ae6a..d677e51e82d51a5b1a2387d5aa5d236e // Spigot start // Iterator iterator = this.blockEntityTickers.iterator(); int tilesThisCycle = 0; -@@ -953,7 +953,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1056,7 +1056,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } this.blockEntityTickers.removeAll(toRemove); @@ -781,7 +790,7 @@ index 730a6e8bac4436a62c4ef5a122f55fc92432ae6a..d677e51e82d51a5b1a2387d5aa5d236e co.aikar.timings.TimingHistory.tileEntityTicks += this.blockEntityTickers.size(); // Paper gameprofilerfiller.pop(); diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 01b21f520ef1c834b9bafc3de85c1fa4fcf539d6..940e324efa81981a17cd5d6e5e09aa3379b66afc 100644 +index 5521418fa307b3eeb4f02a10c39f05b360d1d06e..31cab107a606409af5c1fe56cd0956d707637cc0 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -133,7 +133,7 @@ public final class NaturalSpawner { @@ -803,10 +812,10 @@ index 01b21f520ef1c834b9bafc3de85c1fa4fcf539d6..940e324efa81981a17cd5d6e5e09aa33 } diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 28e4b302284f955a73e75d0f4276d55fb51826f5..fda4c4f03983d31f04047fe6d277e2cf06189965 100644 +index aa327e549949052b5babf4101cc2fc9a37868fa8..bb501042649f9b992d4d126595a5bdea75c1887f 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -917,7 +917,7 @@ public class LevelChunk extends ChunkAccess { +@@ -930,7 +930,7 @@ public class LevelChunk extends ChunkAccess { this.chunkHolder.getEntityChunk().callEntitiesLoadEvent(); // Paper - rewrite chunk system if (this.needsDecoration) { @@ -815,7 +824,7 @@ index 28e4b302284f955a73e75d0f4276d55fb51826f5..fda4c4f03983d31f04047fe6d277e2cf this.needsDecoration = false; java.util.Random random = new java.util.Random(); random.setSeed(this.level.getSeed()); -@@ -937,7 +937,7 @@ public class LevelChunk extends ChunkAccess { +@@ -950,7 +950,7 @@ public class LevelChunk extends ChunkAccess { } } server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(this.bukkitChunk)); @@ -824,7 +833,7 @@ index 28e4b302284f955a73e75d0f4276d55fb51826f5..fda4c4f03983d31f04047fe6d277e2cf } } } -@@ -1297,7 +1297,7 @@ public class LevelChunk extends ChunkAccess { +@@ -1310,7 +1310,7 @@ public class LevelChunk extends ChunkAccess { ProfilerFiller gameprofilerfiller = LevelChunk.this.level.getProfiler(); gameprofilerfiller.push(this::getType); @@ -833,7 +842,7 @@ index 28e4b302284f955a73e75d0f4276d55fb51826f5..fda4c4f03983d31f04047fe6d277e2cf BlockState iblockdata = LevelChunk.this.getBlockState(blockposition); if (this.blockEntity.getType().isValid(iblockdata)) { -@@ -1319,7 +1319,7 @@ public class LevelChunk extends ChunkAccess { +@@ -1332,7 +1332,7 @@ public class LevelChunk extends ChunkAccess { // Paper end // Spigot start } finally { @@ -920,10 +929,10 @@ index 138407c2d4b0bc55ddb9aac5d2aa3edadda090fb..a6e9e503a496c18e2501b03ec84f4600 // Paper end - add timings for scoreboard search } diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 3783186d0c3f2f7b241d38f8ee011e8a5c172980..43d962f634c25da159c4935a3c5c8994a3a4930e 100644 +index 383a13a26ee9445fa6201770bb9bef274d72283a..fe830a419c81811f0a72add63a3f09a94392e4a7 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -166,7 +166,7 @@ public class ActivationRange +@@ -170,7 +170,7 @@ public class ActivationRange */ public static void activateEntities(Level world) { @@ -932,7 +941,7 @@ index 3783186d0c3f2f7b241d38f8ee011e8a5c172980..43d962f634c25da159c4935a3c5c8994 final int miscActivationRange = world.spigotConfig.miscActivationRange; final int raiderActivationRange = world.spigotConfig.raiderActivationRange; final int animalActivationRange = world.spigotConfig.animalActivationRange; -@@ -221,7 +221,7 @@ public class ActivationRange +@@ -244,7 +244,7 @@ public class ActivationRange } // Paper end } diff --git a/patches/server/0280-Remove-Mojang-Profiler.patch b/patches/server/0282-Remove-Mojang-Profiler.patch similarity index 89% rename from patches/server/0280-Remove-Mojang-Profiler.patch rename to patches/server/0282-Remove-Mojang-Profiler.patch index b5bab8c8b..e36506e76 100644 --- a/patches/server/0280-Remove-Mojang-Profiler.patch +++ b/patches/server/0282-Remove-Mojang-Profiler.patch @@ -39,10 +39,10 @@ index 244f5b5a7a7e781c27d21477d798f65ff77d4bc6..a6996259f9fcb2d6520ca45fa42b11c4 return b0; diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 48b0390b5c19b6e8ac598c2622784d271edf5048..99727dd2ee576c8c2fe2be1e6dcf9b1f6be0c894 100644 +index 58da87f8b01f438ab282d960026b7e4cc6c0b5a2..0aeb570d86bbfd2d056bf9630e8ccaeefd9d5306 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -337,13 +337,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.tickCount % autosavePeriod == 0; try { this.isSaving = true; -@@ -1462,7 +1462,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Purpur net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper @@ -192,7 +192,7 @@ index 48b0390b5c19b6e8ac598c2622784d271edf5048..99727dd2ee576c8c2fe2be1e6dcf9b1f try { //worldserver.timings.doTick.startTiming(); // Spigot // Purpur -@@ -1580,17 +1580,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { this.executeBlocking(() -> { this.saveDebugReport(path.resolve("server")); -@@ -2509,40 +2510,40 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> completablefuture = this.getChunkFutureMainThread(x, z, leastStatus, create, true); // Paper ServerChunkCache.MainThreadExecutor chunkproviderserver_b = this.mainThreadProcessor; -@@ -625,24 +625,24 @@ public class ServerChunkCache extends ChunkSource { +@@ -628,24 +628,24 @@ public class ServerChunkCache extends ChunkSource { // CraftBukkit start - modelled on below public void purgeUnload() { if (true) return; // Paper - tickets will be removed later, this behavior isn't really well accounted for by the chunk system @@ -452,7 +453,7 @@ index 2338be893b15eeecda336aea12803b7d2636f4be..105cdab3a1c912299dbcfb670ace810b if (tickChunks) { //this.level.timings.chunks.startTiming(); // Paper - timings // Purpur this.chunkMap.playerChunkManager.tick(); // Paper - this is mostly is to account for view distance changes -@@ -651,10 +651,10 @@ public class ServerChunkCache extends ChunkSource { +@@ -654,10 +654,10 @@ public class ServerChunkCache extends ChunkSource { } //this.level.timings.doChunkUnload.startTiming(); // Spigot // Purpur @@ -465,7 +466,7 @@ index 2338be893b15eeecda336aea12803b7d2636f4be..105cdab3a1c912299dbcfb670ace810b this.clearCache(); } -@@ -700,13 +700,13 @@ public class ServerChunkCache extends ChunkSource { +@@ -703,14 +703,14 @@ public class ServerChunkCache extends ChunkSource { } // Paper end - optimize isOutisdeRange LevelData worlddata = this.level.getLevelData(); @@ -474,6 +475,7 @@ index 2338be893b15eeecda336aea12803b7d2636f4be..105cdab3a1c912299dbcfb670ace810b - gameprofilerfiller.push("pollingChunks"); + //gameprofilerfiller.push("pollingChunks"); // Purpur + this.level.resetIceAndSnowTick(); // Pufferfish - reset ice & snow tick random int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); boolean flag1 = level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && worlddata.getGameTime() % level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit @@ -482,10 +484,10 @@ index 2338be893b15eeecda336aea12803b7d2636f4be..105cdab3a1c912299dbcfb670ace810b //this.level.timings.countNaturalMobs.startTiming(); // Paper - timings // Purpur int l = this.distanceManager.getNaturalSpawnChunkCount(); // Paper start - per player mob spawning -@@ -724,13 +724,13 @@ public class ServerChunkCache extends ChunkSource { +@@ -735,13 +735,13 @@ public class ServerChunkCache extends ChunkSource { //this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings // Purpur - this.lastSpawnState = spawnercreature_d; + //this.lastSpawnState = spawnercreature_d; // Pufferfish - this is managed asynchronously - gameprofilerfiller.popPush("filteringLoadedChunks"); + //gameprofilerfiller.popPush("filteringLoadedChunks"); // Purpur // Paper - moved down @@ -498,7 +500,7 @@ index 2338be893b15eeecda336aea12803b7d2636f4be..105cdab3a1c912299dbcfb670ace810b boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit // Paper - only shuffle if per-player mob spawning is disabled -@@ -781,15 +781,15 @@ public class ServerChunkCache extends ChunkSource { +@@ -792,15 +792,15 @@ public class ServerChunkCache extends ChunkSource { } // Paper end - optimise chunk tick iteration //this.level.timings.chunkTicks.stopTiming(); // Paper // Purpur @@ -517,7 +519,7 @@ index 2338be893b15eeecda336aea12803b7d2636f4be..105cdab3a1c912299dbcfb670ace810b //this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing // Purpur if (!this.chunkMap.needsChangeBroadcasting.isEmpty()) { ReferenceOpenHashSet copy = this.chunkMap.needsChangeBroadcasting.clone(); -@@ -803,7 +803,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -814,7 +814,7 @@ public class ServerChunkCache extends ChunkSource { } } //this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing // Purpur @@ -526,7 +528,7 @@ index 2338be893b15eeecda336aea12803b7d2636f4be..105cdab3a1c912299dbcfb670ace810b // Paper end - use set of chunks requiring updates, rather than iterating every single one loaded // Paper start - controlled flush for entity tracker packets List disabledFlushes = new java.util.ArrayList<>(this.level.players.size()); -@@ -994,7 +994,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -1029,7 +1029,7 @@ public class ServerChunkCache extends ChunkSource { @Override protected void doRunTask(Runnable task) { @@ -536,7 +538,7 @@ index 2338be893b15eeecda336aea12803b7d2636f4be..105cdab3a1c912299dbcfb670ace810b } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 747b8571ae8b324b0bd2f6eee1391948d6ab66b8..e21559ebc4d5ffcf10fc50f5bcc31ccff3b8394f 100644 +index 6169078be600a850d68c437a33fb5531f20ae4ec..9aebb5166fcd4dbb247295ff0ca8461f83ab3d27 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -656,12 +656,12 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -612,7 +614,7 @@ index 747b8571ae8b324b0bd2f6eee1391948d6ab66b8..e21559ebc4d5ffcf10fc50f5bcc31ccf } org.spigotmc.ActivationRange.activateEntities(this); // Spigot -@@ -736,9 +736,9 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -737,9 +737,9 @@ public class ServerLevel extends Level implements WorldGenLevel { if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed entity.discard(); } else { @@ -624,13 +626,19 @@ index 747b8571ae8b324b0bd2f6eee1391948d6ab66b8..e21559ebc4d5ffcf10fc50f5bcc31ccf if (true || this.chunkSource.chunkMap.getDistanceManager().inEntityTickingRange(entity.chunkPosition().toLong())) { // Paper - now always true if in the ticking list Entity entity1 = entity.getVehicle(); -@@ -750,22 +750,21 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -751,7 +751,7 @@ public class ServerLevel extends Level implements WorldGenLevel { entity.stopRiding(); } - gameprofilerfiller.push("tick"); + //gameprofilerfiller.push("tick"); // Purpur - this.guardEntityTick(this::tickNonPassenger, entity); + // Pufferfish start - copied from this.guardEntityTick + try { + this.tickNonPassenger(entity); // Pufferfish - changed +@@ -766,20 +766,19 @@ public class ServerLevel extends Level implements WorldGenLevel { + // Paper end + } + // Pufferfish end - gameprofilerfiller.pop(); + //gameprofilerfiller.pop(); // Purpur } @@ -651,7 +659,7 @@ index 747b8571ae8b324b0bd2f6eee1391948d6ab66b8..e21559ebc4d5ffcf10fc50f5bcc31ccf } @Override -@@ -845,9 +844,9 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -861,9 +860,9 @@ public class ServerLevel extends Level implements WorldGenLevel { boolean flag = this.isRaining(); int j = chunkcoordintpair.getMinBlockX(); int k = chunkcoordintpair.getMinBlockZ(); @@ -662,8 +670,8 @@ index 747b8571ae8b324b0bd2f6eee1391948d6ab66b8..e21559ebc4d5ffcf10fc50f5bcc31ccf + //gameprofilerfiller.push("thunder"); // Purpur final BlockPos.MutableBlockPos blockposition = this.chunkTickMutablePosition; // Paper - use mutable to reduce allocation rate, final to force compile fail on change - if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - disable thunder -@@ -885,7 +884,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && /*this.random.nextInt(this.spigotConfig.thunderChance) == 0 &&*/ chunk.shouldDoLightning(this.random)) { // Spigot // Paper - disable thunder // Pufferfish - replace random with shouldDoLightning +@@ -901,7 +900,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } } @@ -671,8 +679,8 @@ index 747b8571ae8b324b0bd2f6eee1391948d6ab66b8..e21559ebc4d5ffcf10fc50f5bcc31ccf + //gameprofilerfiller.popPush("iceandsnow"); // Purpur int l; - if (!this.paperConfig().environment.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow -@@ -937,7 +936,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + if (!this.paperConfig().environment.disableIceAndSnow && (this.currentIceAndSnowTick++ & 15) == 0) { // Paper - Disable ice and snow // Paper - optimise random ticking // Pufferfish - optimize further random ticking +@@ -953,7 +952,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } // Paper start - optimise random block ticking @@ -681,7 +689,7 @@ index 747b8571ae8b324b0bd2f6eee1391948d6ab66b8..e21559ebc4d5ffcf10fc50f5bcc31ccf //timings.chunkTicksBlocks.startTiming(); // Paper // Purpur if (randomTickSpeed > 0) { LevelChunkSection[] sections = chunk.getSections(); -@@ -973,7 +972,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -989,7 +988,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } // Paper end - optimise random block ticking //timings.chunkTicksBlocks.stopTiming(); // Paper // Purpur @@ -690,7 +698,7 @@ index 747b8571ae8b324b0bd2f6eee1391948d6ab66b8..e21559ebc4d5ffcf10fc50f5bcc31ccf } public Optional findLightningRod(BlockPos pos) { -@@ -1269,19 +1268,19 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1285,19 +1284,19 @@ public class ServerLevel extends Level implements WorldGenLevel { //try { // Purpur // Paper end - timings entity.setOldPosAndRot(); @@ -715,7 +723,7 @@ index 747b8571ae8b324b0bd2f6eee1391948d6ab66b8..e21559ebc4d5ffcf10fc50f5bcc31ccf //} finally { timer.stopTiming(); } // Paper - timings // Purpur Iterator iterator = entity.getPassengers().iterator(); -@@ -1310,12 +1309,12 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1326,12 +1325,12 @@ public class ServerLevel extends Level implements WorldGenLevel { // Paper end passenger.setOldPosAndRot(); ++passenger.tickCount; @@ -732,7 +740,7 @@ index 747b8571ae8b324b0bd2f6eee1391948d6ab66b8..e21559ebc4d5ffcf10fc50f5bcc31ccf // Paper start - EAR 2 if (isActive) { passenger.rideTick(); -@@ -1327,7 +1326,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1343,7 +1342,7 @@ public class ServerLevel extends Level implements WorldGenLevel { vehicle.positionRider(passenger); } // Paper end - EAR 2 @@ -775,7 +783,7 @@ index 05c442041e11d7a87359857ad9d6fed3b8132dd6..5e495c427abaae7476149c19a2131d58 this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities())); playerlist.sendLevelInfo(this, worldserver); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 367d1455a015884a74f2c36a87ce6e3c266babfe..54ea94ee62309371b575835a8e87509974f40702 100644 +index fd835cd58213078df4a5a53ce710263d564644d1..1f7b2bef85cb881cf5db0ff9a4df325612134179 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -409,7 +409,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -1001,19 +1009,19 @@ index 5725c6593480fada65facc29664a00a8cc073512..ccb1f998ae3122d1856d77149ff7e7df }; } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 742a4aff9d43c03d9a311641b0d4f93571a6bcf0..4759b7e70792003769a79880e2c04cf7ed3ec50a 100644 +index 0bbf6c9879ebd286135cbf145c1eb8a95a1ef881..46a979fcafcd1492f63f7c0a8ac9a7c2a708b0a5 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -788,7 +788,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { - // CraftBukkit end - - public void baseTick() { +@@ -822,7 +822,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + return; + } + // Pufferfish end - entity TTL - this.level.getProfiler().push("entityBaseTick"); + //this.level.getProfiler().push("entityBaseTick"); // Purpur if (firstTick && this instanceof net.minecraft.world.entity.NeutralMob neutralMob) neutralMob.tickInitialPersistentAnger(level); // Paper - Update last hurt when ticking this.feetBlockState = null; if (this.isPassenger() && this.getVehicle().isRemoved()) { -@@ -849,7 +849,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -883,7 +883,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } this.firstTick = false; @@ -1022,7 +1030,7 @@ index 742a4aff9d43c03d9a311641b0d4f93571a6bcf0..4759b7e70792003769a79880e2c04cf7 } public void setSharedFlagOnFire(boolean onFire) { -@@ -1023,7 +1023,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -1057,7 +1057,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } } @@ -1031,7 +1039,7 @@ index 742a4aff9d43c03d9a311641b0d4f93571a6bcf0..4759b7e70792003769a79880e2c04cf7 if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7D) { movement = movement.multiply(this.stuckSpeedMultiplier); this.stuckSpeedMultiplier = Vec3.ZERO; -@@ -1032,7 +1032,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -1066,7 +1066,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { // Paper start - ignore movement changes while inactive. if (isTemporarilyActive && !(this instanceof ItemEntity || this instanceof net.minecraft.world.entity.vehicle.AbstractMinecart) && movement == getDeltaMovement() && movementType == MoverType.SELF) { setDeltaMovement(Vec3.ZERO); @@ -1040,7 +1048,7 @@ index 742a4aff9d43c03d9a311641b0d4f93571a6bcf0..4759b7e70792003769a79880e2c04cf7 return; } // Paper end -@@ -1053,8 +1053,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -1087,8 +1087,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { this.setPos(this.getX() + vec3d1.x, this.getY() + vec3d1.y, this.getZ() + vec3d1.z); } @@ -1051,7 +1059,7 @@ index 742a4aff9d43c03d9a311641b0d4f93571a6bcf0..4759b7e70792003769a79880e2c04cf7 boolean flag = !Mth.equal(movement.x, vec3d1.x); boolean flag1 = !Mth.equal(movement.z, vec3d1.z); -@@ -1073,7 +1073,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -1107,7 +1107,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { this.checkFallDamage(vec3d1.y, this.onGround, iblockdata, blockposition); if (this.isRemoved()) { @@ -1060,7 +1068,7 @@ index 742a4aff9d43c03d9a311641b0d4f93571a6bcf0..4759b7e70792003769a79880e2c04cf7 } else { if (this.horizontalCollision) { Vec3 vec3d2 = this.getDeltaMovement(); -@@ -1214,7 +1214,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -1248,7 +1248,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { this.setRemainingFireTicks(-this.getFireImmuneTicks()); } @@ -1069,7 +1077,7 @@ index 742a4aff9d43c03d9a311641b0d4f93571a6bcf0..4759b7e70792003769a79880e2c04cf7 } } // Paper start - detailed watchdog information -@@ -2902,7 +2902,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2936,7 +2936,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { ServerLevel worldserver1 = minecraftserver.getLevel(resourcekey); if (true && !this.isPassenger() && this.portalTime++ >= i) { // CraftBukkit @@ -1078,7 +1086,7 @@ index 742a4aff9d43c03d9a311641b0d4f93571a6bcf0..4759b7e70792003769a79880e2c04cf7 this.portalTime = i; // Paper start io.papermc.paper.event.entity.EntityPortalReadyEvent event = new io.papermc.paper.event.entity.EntityPortalReadyEvent(this.getBukkitEntity(), worldserver1 == null ? null : worldserver1.getWorld(), org.bukkit.PortalType.NETHER); -@@ -2920,7 +2920,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2954,7 +2954,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } } // Paper // CraftBukkit end @@ -1087,7 +1095,7 @@ index 742a4aff9d43c03d9a311641b0d4f93571a6bcf0..4759b7e70792003769a79880e2c04cf7 } this.isInsidePortal = false; -@@ -3385,14 +3385,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3419,14 +3419,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } // Paper end if (this.level instanceof ServerLevel && !this.isRemoved()) { @@ -1104,7 +1112,7 @@ index 742a4aff9d43c03d9a311641b0d4f93571a6bcf0..4759b7e70792003769a79880e2c04cf7 PortalInfo shapedetectorshape = (location == null) ? this.findDimensionEntryPoint(worldserver) : new PortalInfo(new Vec3(location.x(), location.y(), location.z()), Vec3.ZERO, this.yRot, this.xRot, worldserver, null); // CraftBukkit if (shapedetectorshape == null) { -@@ -3426,7 +3426,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3460,7 +3460,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { this.unRide(); // CraftBukkit end @@ -1113,7 +1121,7 @@ index 742a4aff9d43c03d9a311641b0d4f93571a6bcf0..4759b7e70792003769a79880e2c04cf7 // Paper start - Change lead drop timing to prevent dupe if (this instanceof Mob) { ((Mob) this).dropLeash(true, true); // Paper drop lead -@@ -3449,10 +3449,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3483,10 +3483,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } this.removeAfterChangingDimensions(); @@ -1127,10 +1135,10 @@ index 742a4aff9d43c03d9a311641b0d4f93571a6bcf0..4759b7e70792003769a79880e2c04cf7 } } else { diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index cbee6924e6c26fafe51d996491ed89434ce1e0e5..8916d51bb543cce1b7b52ba14d01ecfbee77e6e3 100644 +index 938b224c833c0bc678cb4a6f4c856d57f6778233..57c73ae309ea38c220c3016c9eb8900c78d8aa78 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -399,7 +399,7 @@ public abstract class LivingEntity extends Entity { +@@ -398,7 +398,7 @@ public abstract class LivingEntity extends Entity { } super.baseTick(); @@ -1139,7 +1147,7 @@ index cbee6924e6c26fafe51d996491ed89434ce1e0e5..8916d51bb543cce1b7b52ba14d01ecfb if (this.fireImmune() || this.level.isClientSide) { this.clearFire(); } -@@ -502,7 +502,7 @@ public abstract class LivingEntity extends Entity { +@@ -501,7 +501,7 @@ public abstract class LivingEntity extends Entity { this.yHeadRotO = this.yHeadRot; this.yRotO = this.getYRot(); this.xRotO = this.getXRot(); @@ -1148,7 +1156,7 @@ index cbee6924e6c26fafe51d996491ed89434ce1e0e5..8916d51bb543cce1b7b52ba14d01ecfb } public boolean canSpawnSoulSpeedParticle() { -@@ -3104,10 +3104,10 @@ public abstract class LivingEntity extends Entity { +@@ -3126,10 +3126,10 @@ public abstract class LivingEntity extends Entity { } this.run += (f3 - this.run) * 0.3F; @@ -1162,7 +1170,7 @@ index cbee6924e6c26fafe51d996491ed89434ce1e0e5..8916d51bb543cce1b7b52ba14d01ecfb // Paper start - stop large pitch and yaw changes from crashing the server this.yRotO += Math.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F; -@@ -3119,7 +3119,7 @@ public abstract class LivingEntity extends Entity { +@@ -3141,7 +3141,7 @@ public abstract class LivingEntity extends Entity { this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F; // Paper end @@ -1171,7 +1179,7 @@ index cbee6924e6c26fafe51d996491ed89434ce1e0e5..8916d51bb543cce1b7b52ba14d01ecfb this.animStep += f2; if (this.isFallFlying()) { ++this.fallFlyTicks; -@@ -3416,19 +3416,19 @@ public abstract class LivingEntity extends Entity { +@@ -3438,19 +3438,19 @@ public abstract class LivingEntity extends Entity { } this.setDeltaMovement(d4, d5, d6); @@ -1196,7 +1204,7 @@ index cbee6924e6c26fafe51d996491ed89434ce1e0e5..8916d51bb543cce1b7b52ba14d01ecfb if (this.jumping && this.isAffectedByFluids()) { double d7; -@@ -3455,8 +3455,8 @@ public abstract class LivingEntity extends Entity { +@@ -3477,8 +3477,8 @@ public abstract class LivingEntity extends Entity { this.noJumpDelay = 0; } @@ -1207,7 +1215,7 @@ index cbee6924e6c26fafe51d996491ed89434ce1e0e5..8916d51bb543cce1b7b52ba14d01ecfb this.xxa *= 0.98F; this.zza *= 0.98F; this.updateFallFlying(); -@@ -3465,8 +3465,8 @@ public abstract class LivingEntity extends Entity { +@@ -3487,8 +3487,8 @@ public abstract class LivingEntity extends Entity { // SpigotTimings.timerEntityAIMove.startTiming(); // Spigot // Paper this.travel(new Vec3((double) this.xxa, (double) this.yya, (double) this.zza)); // SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot // Paper @@ -1218,7 +1226,7 @@ index cbee6924e6c26fafe51d996491ed89434ce1e0e5..8916d51bb543cce1b7b52ba14d01ecfb boolean flag1 = this.getType().is(EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES); int i; -@@ -3486,15 +3486,15 @@ public abstract class LivingEntity extends Entity { +@@ -3508,15 +3508,15 @@ public abstract class LivingEntity extends Entity { this.hurt(DamageSource.FREEZE, (float) i); } @@ -1238,10 +1246,10 @@ index cbee6924e6c26fafe51d996491ed89434ce1e0e5..8916d51bb543cce1b7b52ba14d01ecfb // Purpur start if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) { diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 8df6af3a4ceea5ed6209df489a0f728d384bef89..db23506c44de328c74eb509caf6cc4d8d91cbc52 100644 +index 535b13206e4a8a68e1fb226b3c44890face3b55f..7bd4e95fcaf3855a4fe412b5898a97d7992caad3 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -330,14 +330,14 @@ public abstract class Mob extends LivingEntity { +@@ -332,14 +332,14 @@ public abstract class Mob extends LivingEntity { @Override public void baseTick() { super.baseTick(); @@ -1258,7 +1266,7 @@ index 8df6af3a4ceea5ed6209df489a0f728d384bef89..db23506c44de328c74eb509caf6cc4d8 } // Purpur start -@@ -667,7 +667,7 @@ public abstract class Mob extends LivingEntity { +@@ -669,7 +669,7 @@ public abstract class Mob extends LivingEntity { @Override public void aiStep() { super.aiStep(); @@ -1267,7 +1275,7 @@ index 8df6af3a4ceea5ed6209df489a0f728d384bef89..db23506c44de328c74eb509caf6cc4d8 if (!this.level.isClientSide && this.canPickUpLoot() && this.isAlive() && !this.dead && (this.level.purpurConfig.entitiesPickUpLootBypassMobGriefing || this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { Vec3i baseblockposition = this.getPickupReach(); List list = this.level.getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate((double) baseblockposition.getX(), (double) baseblockposition.getY(), (double) baseblockposition.getZ())); -@@ -687,7 +687,7 @@ public abstract class Mob extends LivingEntity { +@@ -689,7 +689,7 @@ public abstract class Mob extends LivingEntity { } } @@ -1276,7 +1284,7 @@ index 8df6af3a4ceea5ed6209df489a0f728d384bef89..db23506c44de328c74eb509caf6cc4d8 } protected Vec3i getPickupReach() { -@@ -900,42 +900,42 @@ public abstract class Mob extends LivingEntity { +@@ -902,46 +902,46 @@ public abstract class Mob extends LivingEntity { return; } // Paper end @@ -1290,22 +1298,26 @@ index 8df6af3a4ceea5ed6209df489a0f728d384bef89..db23506c44de328c74eb509caf6cc4d8 if (i % 2 != 0 && this.tickCount > 1) { - this.level.getProfiler().push("targetSelector"); + //this.level.getProfiler().push("targetSelector"); // Purpur + if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking this.targetSelector.tickRunningGoals(false); - this.level.getProfiler().pop(); - this.level.getProfiler().push("goalSelector"); + //this.level.getProfiler().pop(); // Purpur + //this.level.getProfiler().push("goalSelector"); // Purpur + if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking this.goalSelector.tickRunningGoals(false); - this.level.getProfiler().pop(); + //this.level.getProfiler().pop(); // Purpur } else { - this.level.getProfiler().push("targetSelector"); + //this.level.getProfiler().push("targetSelector"); // Purpur + if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking this.targetSelector.tick(); - this.level.getProfiler().pop(); - this.level.getProfiler().push("goalSelector"); + //this.level.getProfiler().pop(); // Purpur + //this.level.getProfiler().push("goalSelector"); // Purpur + if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking this.goalSelector.tick(); - this.level.getProfiler().pop(); + //this.level.getProfiler().pop(); // Purpur @@ -1340,10 +1352,10 @@ index 8df6af3a4ceea5ed6209df489a0f728d384bef89..db23506c44de328c74eb509caf6cc4d8 } 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 b738ee2d3801fadfd09313f05ae24593e56b0ec6..8a70bc63e12838f45fa3eade74f2899438715886 100644 +index 1635818fc4b1788c0d397085239df6dd75b210ab..02978315bc2b828cc603ce7478408f3f82c249c2 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -@@ -102,8 +102,8 @@ public class GoalSelector { +@@ -105,8 +105,8 @@ public class GoalSelector { } public void tick() { @@ -1354,7 +1366,7 @@ index b738ee2d3801fadfd09313f05ae24593e56b0ec6..8a70bc63e12838f45fa3eade74f28994 for(WrappedGoal wrappedGoal : this.availableGoals) { if (wrappedGoal.isRunning() && (goalContainsAnyFlags(wrappedGoal, this.goalTypes) || !wrappedGoal.canContinueToUse())) { -@@ -120,8 +120,8 @@ public class GoalSelector { +@@ -123,8 +123,8 @@ public class GoalSelector { } } @@ -1365,7 +1377,7 @@ index b738ee2d3801fadfd09313f05ae24593e56b0ec6..8a70bc63e12838f45fa3eade74f28994 for(WrappedGoal wrappedGoal2 : this.availableGoals) { // Paper start -@@ -141,13 +141,13 @@ public class GoalSelector { +@@ -144,13 +144,13 @@ public class GoalSelector { } } @@ -1382,7 +1394,7 @@ index b738ee2d3801fadfd09313f05ae24593e56b0ec6..8a70bc63e12838f45fa3eade74f28994 for(WrappedGoal wrappedGoal : this.availableGoals) { if (wrappedGoal.isRunning() && (tickAll || wrappedGoal.requiresUpdateEveryTick())) { -@@ -155,7 +155,7 @@ public class GoalSelector { +@@ -158,7 +158,7 @@ public class GoalSelector { } } @@ -1427,15 +1439,16 @@ index 288c6627906d07c0d223eacd84ae4eb31a349998..9babe636176da3c40598eb5bdac0919a this.seen.add(i); } else { diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java -index 3c60ad2c26c46f900e537ea39d74a97068f44561..c03eca3f9e5ca87e7607aeca86ff62638d294ff9 100644 +index d98b726de2030662cb79e6c8446436c313a25d50..910bf19c7325180f3121ae3982dddae9e4ea0e97 100644 --- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java +++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java -@@ -265,12 +265,12 @@ public class Allay extends PathfinderMob implements InventoryCarrier { - +@@ -266,13 +266,13 @@ public class Allay extends PathfinderMob implements InventoryCarrier { + private int behaviorTick = 0; // Pufferfish @Override protected void customServerAiStep() { - this.level.getProfiler().push("allayBrain"); + //this.level.getProfiler().push("allayBrain"); // Purpur + if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish this.getBrain().tick((ServerLevel) this.level, this); - this.level.getProfiler().pop(); - this.level.getProfiler().push("allayActivityUpdate"); @@ -1448,15 +1461,16 @@ index 3c60ad2c26c46f900e537ea39d74a97068f44561..c03eca3f9e5ca87e7607aeca86ff6263 } diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java -index 66371759b99371db21a910d2e4e5cb9219e70b9c..3ec9d0b60b695efd1ea3bf17784004ca835b0361 100644 +index 183f67a32203b02b43ca3d612f950f288c754eac..867091706521dbb16e66bdf5c9f4136759ab2677 100644 --- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java +++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java -@@ -329,12 +329,12 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder optional = this.getBrain().getMemory(MemoryModuleType.PLAY_DEAD_TICKS); diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -index 4026333d47bc919a37f120ea8ca16ae2c90048f4..5cea7fd17a6fc79ed2a9c2ff6097519a66491662 100644 +index e81b65476a6885b949b96f1d85df652c8cf56d5c..f9d77ad2493b9ba67e8f45ce248d29a8e9ab7b80 100644 --- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java +++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java @@ -153,13 +153,13 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Rider @@ -1491,15 +1505,16 @@ index 4026333d47bc919a37f120ea8ca16ae2c90048f4..5cea7fd17a6fc79ed2a9c2ff6097519a } diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -index 8aaf0fb4a7444fad23c46404d33b4a96d3740185..5afb3b788e68efe39f298a0d93454b99b18e35cb 100644 +index 1164fdc49115f5178344276f073ac6c43a49411e..fe1f01d7aa27907298dd2e97e6b4d4fa9c507628 100644 --- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java +++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -@@ -232,12 +232,12 @@ public class Frog extends Animal implements VariantHolder { - +@@ -233,13 +233,13 @@ public class Frog extends Animal implements VariantHolder { + private int behaviorTick = 0; // Pufferfish @Override protected void customServerAiStep() { - this.level.getProfiler().push("frogBrain"); + //this.level.getProfiler().push("frogBrain"); // Purpur + if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish this.getBrain().tick((ServerLevel)this.level, this); - this.level.getProfiler().pop(); - this.level.getProfiler().push("frogActivityUpdate"); @@ -1512,15 +1527,16 @@ index 8aaf0fb4a7444fad23c46404d33b4a96d3740185..5afb3b788e68efe39f298a0d93454b99 } diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java -index b33b3714f18f5bcd1f7d9d4974a8c1e254d83f5b..b65dde04fdbeb6f4c7b3856b83209dff4a737167 100644 +index 7b7daf5232a446b8774bbf53f2f09d9811d1dbbc..ee248e701fe5e84b21b44754cc471f67b0bcb91d 100644 --- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java +++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java -@@ -115,12 +115,12 @@ public class Tadpole extends AbstractFish { - +@@ -116,13 +116,13 @@ public class Tadpole extends AbstractFish { + private int behaviorTick = 0; // Pufferfish @Override protected void customServerAiStep() { - this.level.getProfiler().push("tadpoleBrain"); + //this.level.getProfiler().push("tadpoleBrain"); // Purpur + if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish this.getBrain().tick((ServerLevel) this.level, this); - this.level.getProfiler().pop(); - this.level.getProfiler().push("tadpoleActivityUpdate"); @@ -1533,16 +1549,16 @@ index b33b3714f18f5bcd1f7d9d4974a8c1e254d83f5b..b65dde04fdbeb6f4c7b3856b83209dff } diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java -index 7f69d4b76f8cb7bbef105a7685f98803ae2cc0ca..dee2c9b1b1ed9e03170123e6b13eea2ed70c374e 100644 +index d30a08f081a5a96660fdae62f0c860c234a8f877..6d9ce5be57aeb882bdfd68c4a2ca352c972e3b36 100644 --- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java +++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java -@@ -227,13 +227,13 @@ public class Goat extends Animal { - +@@ -228,13 +228,13 @@ public class Goat extends Animal { + private int behaviorTick = 0; // Pufferfish @Override protected void customServerAiStep() { - this.level.getProfiler().push("goatBrain"); + //this.level.getProfiler().push("goatBrain"); // Purpur - if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider + if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider this.getBrain().tick((ServerLevel) this.level, this); - this.level.getProfiler().pop(); - this.level.getProfiler().push("goatActivityUpdate"); @@ -1572,16 +1588,16 @@ index 8b522186395d570bb14db94df8df2c4fa3705a7e..70d891d85748039b517a87b2438b04a9 } diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -index f7165eb68704b152fd4ead658e5504fa71f68e21..7bcbcc2122f355601b6b096458ae91b639f8a4ef 100644 +index 9d65b412e30f528d378de9072b48632c56c3e5bb..9ff882352b3fb69d8a8ecaf1908709761b3e9658 100644 --- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -@@ -165,10 +165,10 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { - +@@ -166,10 +166,10 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { + private int behaviorTick; // Pufferfish @Override protected void customServerAiStep() { - this.level.getProfiler().push("hoglinBrain"); + //this.level.getProfiler().push("hoglinBrain"); // Purpur - if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider + if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider this.getBrain().tick((ServerLevel)this.level, this); - this.level.getProfiler().pop(); + //this.level.getProfiler().pop(); // Purpur @@ -1589,16 +1605,16 @@ index f7165eb68704b152fd4ead658e5504fa71f68e21..7bcbcc2122f355601b6b096458ae91b6 if (this.isConverting()) { ++this.timeInOverworld; diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java -index f478fec2f603fc4994b726e145c22108d9c717e0..4f8602bfe1b54ccd7c144bfcfb7633600e2c5a73 100644 +index 01d92bca8a97b1ddb63edf246303e41003469d81..d606a351210486fc8656c0bfd224347150af7faf 100644 --- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java -@@ -342,10 +342,10 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento - +@@ -343,10 +343,10 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento + private int behaviorTick; // Pufferfish @Override protected void customServerAiStep() { - this.level.getProfiler().push("piglinBrain"); + //this.level.getProfiler().push("piglinBrain"); // Purpur - if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider + if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider this.getBrain().tick((ServerLevel) this.level, this); - this.level.getProfiler().pop(); + //this.level.getProfiler().pop(); // Purpur @@ -1623,15 +1639,16 @@ index 760015f7a98e70b735707c77472c084d8bd052bb..bc6572b1025d74a7590d7e1cc49132f9 PiglinBruteAi.maybePlayActivitySound(this); super.customServerAiStep(); diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -index 98176fde2760ab1d85d0b5afc1fd776487eef5e0..8d02b93e96a5a16288f7ca7d9470eb0373c8c2da 100644 +index 456ebb0829d19d13abe05d83035c4abe3589962f..17df2b09542f67cdd1d83f795d9b2aad9ccd4e05 100644 --- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java +++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -@@ -298,9 +298,9 @@ public class Warden extends Monster implements VibrationListener.VibrationListen +@@ -299,10 +299,10 @@ public class Warden extends Monster implements VibrationListener.VibrationListen protected void customServerAiStep() { ServerLevel worldserver = (ServerLevel) this.level; - worldserver.getProfiler().push("wardenBrain"); + //worldserver.getProfiler().push("wardenBrain"); // Purpur + if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish this.getBrain().tick(worldserver, this); - this.level.getProfiler().pop(); + //this.level.getProfiler().pop(); // Purpur @@ -1639,10 +1656,10 @@ index 98176fde2760ab1d85d0b5afc1fd776487eef5e0..8d02b93e96a5a16288f7ca7d9470eb03 if ((this.tickCount + this.getId()) % 120 == 0) { Warden.applyDarknessAround(worldserver, this.position(), this, 20); diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index dd724eccd08c60f482f74dfadea21ef6087856a4..cb4c86179f2e908927ce20fc7b9f84bed55088fc 100644 +index 700d32abc957769960fd081072c941681474f7f0..832469e39901d9ec666ddaf3aff77419f6195b1c 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -332,7 +332,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -335,7 +335,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @Override protected void customServerAiStep() { mobTick(false); } protected void mobTick(boolean inactive) { @@ -1651,7 +1668,7 @@ index dd724eccd08c60f482f74dfadea21ef6087856a4..cb4c86179f2e908927ce20fc7b9f84be // Purpur start if (this.level.purpurConfig.villagerLobotomizeEnabled) { // treat as inactive if lobotomized -@@ -349,7 +349,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -357,7 +357,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler restock(); } // Purpur end @@ -1661,7 +1678,7 @@ index dd724eccd08c60f482f74dfadea21ef6087856a4..cb4c86179f2e908927ce20fc7b9f84be this.assignProfessionWhenSpawned = false; } diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index e7ce14ab0732034107e735787354a6fb0ec90f54..a89e5b7a9e8733cb34a2bd59c8fbddc7e46a3b5c 100644 +index 122880ca3cfe6528e10e6df4c3200d6c66421c8b..51d8271cb8fe246f4c11db8fbc061ed63f416da0 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -362,7 +362,7 @@ public class Explosion { @@ -1683,10 +1700,10 @@ index e7ce14ab0732034107e735787354a6fb0ec90f54..a89e5b7a9e8733cb34a2bd59c8fbddc7 } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index d677e51e82d51a5b1a2387d5aa5d236e76e717e1..3778ad438b3a5f6cdbc465c7356bf9e11340753e 100644 +index 8a9269c207c6b39d440d213679c31878bc689735..a9289072b048095330ea32d7c965e8dda61a36fc 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -608,9 +608,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -711,9 +711,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable { BlockState iblockdata2 = this.getBlockState(pos); if ((flags & 128) == 0 && iblockdata2 != iblockdata1 && (iblockdata2.getLightBlock(this, pos) != iblockdata1.getLightBlock(this, pos) || iblockdata2.getLightEmission() != iblockdata1.getLightEmission() || iblockdata2.useShapeForLightOcclusion() || iblockdata1.useShapeForLightOcclusion())) { @@ -1698,7 +1715,7 @@ index d677e51e82d51a5b1a2387d5aa5d236e76e717e1..3778ad438b3a5f6cdbc465c7356bf9e1 } /* -@@ -909,9 +909,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1012,9 +1012,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } protected void tickBlockEntities() { @@ -1710,7 +1727,7 @@ index d677e51e82d51a5b1a2387d5aa5d236e76e717e1..3778ad438b3a5f6cdbc465c7356bf9e1 //timings.tileEntityPending.startTiming(); // Spigot // Purpur this.tickingBlockEntities = true; if (!this.pendingBlockEntityTickers.isEmpty()) { -@@ -956,7 +956,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1059,7 +1059,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { //timings.tileEntityTick.stopTiming(); // Spigot // Purpur this.tickingBlockEntities = false; co.aikar.timings.TimingHistory.tileEntityTicks += this.blockEntityTickers.size(); // Paper @@ -1719,7 +1736,7 @@ index d677e51e82d51a5b1a2387d5aa5d236e76e717e1..3778ad438b3a5f6cdbc465c7356bf9e1 spigotConfig.currentPrimedTnt = 0; // Spigot } -@@ -1149,7 +1149,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1252,7 +1252,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @Override public List getEntities(@Nullable Entity except, AABB box, Predicate predicate) { @@ -1728,7 +1745,7 @@ index d677e51e82d51a5b1a2387d5aa5d236e76e717e1..3778ad438b3a5f6cdbc465c7356bf9e1 List list = Lists.newArrayList(); ((ServerLevel)this).getEntityLookup().getEntities(except, box, list, predicate); // Paper - optimise this call return list; -@@ -1168,7 +1168,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1271,7 +1271,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } public void getEntities(EntityTypeTest filter, AABB box, Predicate predicate, List result, int limit) { @@ -1737,16 +1754,17 @@ index d677e51e82d51a5b1a2387d5aa5d236e76e717e1..3778ad438b3a5f6cdbc465c7356bf9e1 // Paper start - optimise this call //TODO use limit if (filter instanceof net.minecraft.world.entity.EntityType entityTypeTest) { -@@ -1497,6 +1497,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1600,7 +1600,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } public ProfilerFiller getProfiler() { -+ // Purpur - diff on change +- if (gg.pufferfish.pufferfish.PufferfishConfig.disableMethodProfiler) return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Pufferfish ++ if (true || gg.pufferfish.pufferfish.PufferfishConfig.disableMethodProfiler) return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Pufferfish // Purpur return (ProfilerFiller) this.profiler.get(); } diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 940e324efa81981a17cd5d6e5e09aa3379b66afc..55ad593b3380ed6ff3ce2ef0e9a9e80aa03024b4 100644 +index 31cab107a606409af5c1fe56cd0956d707637cc0..fbb735915759ea59660daa809e23849a60fa5974 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -132,7 +132,7 @@ public final class NaturalSpawner { @@ -1768,10 +1786,10 @@ index 940e324efa81981a17cd5d6e5e09aa3379b66afc..55ad593b3380ed6ff3ce2ef0e9a9e80a // Paper start diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index fda4c4f03983d31f04047fe6d277e2cf06189965..09e357833f9bbe26da7fa7142875daf2733d6420 100644 +index bb501042649f9b992d4d126595a5bdea75c1887f..79bf9c277fe98df176113de39360fb34ad917577 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -1294,9 +1294,9 @@ public class LevelChunk extends ChunkAccess { +@@ -1307,9 +1307,9 @@ public class LevelChunk extends ChunkAccess { if (LevelChunk.this.isTicking(blockposition)) { try { @@ -1783,7 +1801,7 @@ index fda4c4f03983d31f04047fe6d277e2cf06189965..09e357833f9bbe26da7fa7142875daf2 //this.blockEntity.tickTimer.startTiming(); // Spigot // Purpur BlockState iblockdata = LevelChunk.this.getBlockState(blockposition); -@@ -1308,7 +1308,7 @@ public class LevelChunk extends ChunkAccess { +@@ -1321,7 +1321,7 @@ public class LevelChunk extends ChunkAccess { LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new Object[]{LogUtils.defer(this::getType), LogUtils.defer(this::getPos), iblockdata}); } diff --git a/patches/server/0281-Add-more-logger-output-for-invalid-movement-kicks.patch b/patches/server/0283-Add-more-logger-output-for-invalid-movement-kicks.patch similarity index 94% rename from patches/server/0281-Add-more-logger-output-for-invalid-movement-kicks.patch rename to patches/server/0283-Add-more-logger-output-for-invalid-movement-kicks.patch index ca363b691..66cba8fff 100644 --- a/patches/server/0281-Add-more-logger-output-for-invalid-movement-kicks.patch +++ b/patches/server/0283-Add-more-logger-output-for-invalid-movement-kicks.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add more logger output for invalid movement kicks diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 77f67560a004779c3091435d3d04e36c393b9a19..7e0522f1d8ae7b4fb5a6acac4ffc5d1f2ced21ec 100644 +index 1f7b2bef85cb881cf5db0ff9a4df325612134179..86d7552acc7bea0e0a5af4c16b8a0dd3af4e6560 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -849,6 +849,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -16,7 +16,7 @@ index 77f67560a004779c3091435d3d04e36c393b9a19..7e0522f1d8ae7b4fb5a6acac4ffc5d1f return; } -@@ -1428,8 +1429,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1429,8 +1430,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handleMovePlayer(ServerboundMovePlayerPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); diff --git a/patches/server/0282-Add-Bee-API.patch b/patches/server/0284-Add-Bee-API.patch similarity index 100% rename from patches/server/0282-Add-Bee-API.patch rename to patches/server/0284-Add-Bee-API.patch diff --git a/patches/server/0283-Debug-Marker-API.patch b/patches/server/0285-Debug-Marker-API.patch similarity index 97% rename from patches/server/0283-Debug-Marker-API.patch rename to patches/server/0285-Debug-Marker-API.patch index 3d76dccf7..a0987f7e0 100644 --- a/patches/server/0283-Debug-Marker-API.patch +++ b/patches/server/0285-Debug-Marker-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Debug Marker API diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index c77f76d3b346d25aa48233ad8516a85118f26a9f..79ee10b16295d2eafe1555331c03d45526c3b480 100644 +index bc7c2aa4aa2a002faaaccf5f499218d390772e3b..12652b1123417a093d4b7a934eb71798fe038a99 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1487,6 +1487,42 @@ public final class CraftServer implements Server { +@@ -1492,6 +1492,42 @@ public final class CraftServer implements Server { public void removeFuel(org.bukkit.Material material) { net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity.removeFuel(net.minecraft.world.item.ItemStack.fromBukkitCopy(new ItemStack(material))); } diff --git a/patches/server/0284-add-Player-showCreditScreen.patch b/patches/server/0286-add-Player-showCreditScreen.patch similarity index 100% rename from patches/server/0284-add-Player-showCreditScreen.patch rename to patches/server/0286-add-Player-showCreditScreen.patch diff --git a/patches/server/0285-mob-spawning-option-to-ignore-creative-players.patch b/patches/server/0287-mob-spawning-option-to-ignore-creative-players.patch similarity index 94% rename from patches/server/0285-mob-spawning-option-to-ignore-creative-players.patch rename to patches/server/0287-mob-spawning-option-to-ignore-creative-players.patch index 2a3c5b43e..4f5ebb124 100644 --- a/patches/server/0285-mob-spawning-option-to-ignore-creative-players.patch +++ b/patches/server/0287-mob-spawning-option-to-ignore-creative-players.patch @@ -5,7 +5,7 @@ Subject: [PATCH] mob spawning option to ignore creative players diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 55ad593b3380ed6ff3ce2ef0e9a9e80aa03024b4..decf30b590658a627d47cb688531ec1cc24ba001 100644 +index fbb735915759ea59660daa809e23849a60fa5974..81ba3c4fa9502cdd2a5c58b0ff51fea6b7553f4a 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -260,7 +260,7 @@ public final class NaturalSpawner { @@ -18,7 +18,7 @@ index 55ad593b3380ed6ff3ce2ef0e9a9e80aa03024b4..decf30b590658a627d47cb688531ec1c if (entityhuman != null) { double d2 = entityhuman.distanceToSqr(d0, (double) i, d1); diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 189d409e83529740221df7565c343bb108ca1203..57469d9f1fe5153ac140a8e36d411084d802f2c1 100644 +index 30ca7197711f0e8f18a7afb290a17be4489f6499..ec87511c3cbb0300fd7e918971b43ec94db630d4 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -376,6 +376,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0286-Make-pufferfish-config-relocatable.patch b/patches/server/0288-Make-pufferfish-config-relocatable.patch similarity index 52% rename from patches/server/0286-Make-pufferfish-config-relocatable.patch rename to patches/server/0288-Make-pufferfish-config-relocatable.patch index a98706522..77705a941 100644 --- a/patches/server/0286-Make-pufferfish-config-relocatable.patch +++ b/patches/server/0288-Make-pufferfish-config-relocatable.patch @@ -4,20 +4,41 @@ Date: Sun, 12 Jun 2022 09:18:57 -0500 Subject: [PATCH] Make pufferfish config relocatable +diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java +index 9e3f279d759a49c051544f54f76790d549132ac0..81206fcab3c943ec12e582fb811014b6bd1423ba 100644 +--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java ++++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java +@@ -28,6 +28,7 @@ public class PufferfishConfig { + + private static final YamlFile config = new YamlFile(); + private static int updates = 0; ++ public static File pufferfishFile; // Purpur + + private static ConfigurationSection convertToBukkit(org.simpleyaml.configuration.ConfigurationSection section) { + ConfigurationSection newSection = new MemoryConfiguration(); +@@ -50,7 +51,7 @@ public class PufferfishConfig { + } + + public static void load() throws IOException { +- File configFile = new File("pufferfish.yml"); ++ File configFile = pufferfishFile; // Purpur + + if (configFile.exists()) { + try { diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index fa87a019247a23cd71b6ca57146ef55d14afd2a1..5b44f7512f21dba3f3306c7f42fa2d78e600847a 100644 +index 14c31ac94202e5266610869d3dd93b871cfb4557..46858fb57f122033a68aeb4ad3943132a677fb46 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -230,6 +230,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider // Paper end -+ // gg.pufferfish.pufferfish.PufferfishConfig.pufferfishFile = (java.io.File) options.valueOf("pufferfish-settings"); // Purpur ++ gg.pufferfish.pufferfish.PufferfishConfig.pufferfishFile = (java.io.File) options.valueOf("pufferfish-settings"); // Purpur + gg.pufferfish.pufferfish.PufferfishConfig.load(); // Pufferfish + gg.pufferfish.pufferfish.PufferfishCommand.init(); // Pufferfish - this.setPvpAllowed(dedicatedserverproperties.pvp); - this.setFlightAllowed(dedicatedserverproperties.allowFlight); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 7b6063bede6771eb15bc5b01dc8bce7c2949c6b4..72810905cc50af204161a02872d599af4aba8dbb 100644 +index c2c5c560165eb9ac9920727aaf730a5280107782..082d0516c80cf231dd7ceb454508bb77407c499b 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -172,6 +172,12 @@ public class Main { diff --git a/patches/server/0287-Add-skeleton-bow-accuracy-option.patch b/patches/server/0289-Add-skeleton-bow-accuracy-option.patch similarity index 100% rename from patches/server/0287-Add-skeleton-bow-accuracy-option.patch rename to patches/server/0289-Add-skeleton-bow-accuracy-option.patch diff --git a/patches/server/0288-Allay-respect-item-NBT.patch b/patches/server/0290-Allay-respect-item-NBT.patch similarity index 94% rename from patches/server/0288-Allay-respect-item-NBT.patch rename to patches/server/0290-Allay-respect-item-NBT.patch index 4ee3eb376..dbff0db85 100644 --- a/patches/server/0288-Allay-respect-item-NBT.patch +++ b/patches/server/0290-Allay-respect-item-NBT.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allay respect item NBT diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java -index c03eca3f9e5ca87e7607aeca86ff62638d294ff9..a3d34e100647853f887d6ee8a5cf87a3f0d051a5 100644 +index 910bf19c7325180f3121ae3982dddae9e4ea0e97..e8f42ad6cc32cb21584d8988fcf3d1e4b6552f0c 100644 --- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java +++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java -@@ -412,9 +412,31 @@ public class Allay extends PathfinderMob implements InventoryCarrier { +@@ -414,9 +414,31 @@ public class Allay extends PathfinderMob implements InventoryCarrier { @Override public boolean wantsToPickUp(ItemStack stack) { diff --git a/patches/server/0289-Add-death-screen-API.patch b/patches/server/0291-Add-death-screen-API.patch similarity index 100% rename from patches/server/0289-Add-death-screen-API.patch rename to patches/server/0291-Add-death-screen-API.patch diff --git a/patches/server/0290-Implement-ram-and-rambar-commands.patch b/patches/server/0292-Implement-ram-and-rambar-commands.patch similarity index 99% rename from patches/server/0290-Implement-ram-and-rambar-commands.patch rename to patches/server/0292-Implement-ram-and-rambar-commands.patch index 9883a770d..d08596bbe 100644 --- a/patches/server/0290-Implement-ram-and-rambar-commands.patch +++ b/patches/server/0292-Implement-ram-and-rambar-commands.patch @@ -61,7 +61,7 @@ index 5e495c427abaae7476149c19a2131d5804aecab2..7f2a811505c2aeaad6e1a91a0719613a return this.tpsBar; } diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index 986f4daaf054b0807deab5066c6734b18ddaa7a1..49a2b0f141cdd02217240fdad78d554e7dc06d25 100644 +index dd4ddb63a21b65cff85e30f3bfb571cd05f97933..6dfdc0eae1fbd6e19c4aada0514d27da299ed44e 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -181,6 +181,8 @@ public class PurpurConfig { diff --git a/patches/server/0291-Add-item-packet-serialize-event.patch b/patches/server/0293-Add-item-packet-serialize-event.patch similarity index 93% rename from patches/server/0291-Add-item-packet-serialize-event.patch rename to patches/server/0293-Add-item-packet-serialize-event.patch index a32a31285..5202cc26c 100644 --- a/patches/server/0291-Add-item-packet-serialize-event.patch +++ b/patches/server/0293-Add-item-packet-serialize-event.patch @@ -32,10 +32,10 @@ index 32ee4ed11aefd82dca2e3e78b3108f041fdc3695..314318a21b6fa9e827945d8996c6ed0f this.writeId(BuiltInRegistries.ITEM, item); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 99727dd2ee576c8c2fe2be1e6dcf9b1f6be0c894..b915e6a13a518f05d109c707142efa3946892f0c 100644 +index 0aeb570d86bbfd2d056bf9630e8ccaeefd9d5306..cea4447aad2d64db56a76e4ba180dc7326d2e13b 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1535,6 +1535,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop(this, Zombie.class, 8.0F, 0.5D, 0.5D)); diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 3784bb4df9b77fe63c0b2edafa44310460d4f487..309485bcbab8ab132bec492ae3ad44e58dc61078 100644 +index 1234a56a9320d79cf524e11dc959f672e12b45ae..0ccc7acb4e11b45cf95ea3b79e80611da9ffa8e7 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -131,6 +131,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0299-MC-121706-Fix-mobs-not-looking-up-and-down-when-stra.patch b/patches/server/0301-MC-121706-Fix-mobs-not-looking-up-and-down-when-stra.patch similarity index 100% rename from patches/server/0299-MC-121706-Fix-mobs-not-looking-up-and-down-when-stra.patch rename to patches/server/0301-MC-121706-Fix-mobs-not-looking-up-and-down-when-stra.patch diff --git a/patches/server/0300-Add-log-suppression-for-LibraryLoader.patch b/patches/server/0302-Add-log-suppression-for-LibraryLoader.patch similarity index 94% rename from patches/server/0300-Add-log-suppression-for-LibraryLoader.patch rename to patches/server/0302-Add-log-suppression-for-LibraryLoader.patch index 2bd49eeb9..17a386e53 100644 --- a/patches/server/0300-Add-log-suppression-for-LibraryLoader.patch +++ b/patches/server/0302-Add-log-suppression-for-LibraryLoader.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add log suppression for LibraryLoader diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index 14ebe9d00704a97876775c23d92cdb8b23271aee..8123dcff4ce0a6c7536fe6369458b397a9f685a4 100644 +index f33b2d54c3eceed3937dd324f9d9b1a4372d521d..134a594c6e1d63615124ec391718be236673e2f3 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -487,11 +487,14 @@ public class PurpurConfig { diff --git a/patches/server/0301-Allow-Transparent-Blocks-In-Enchanting-Box.patch b/patches/server/0303-Allow-Transparent-Blocks-In-Enchanting-Box.patch similarity index 96% rename from patches/server/0301-Allow-Transparent-Blocks-In-Enchanting-Box.patch rename to patches/server/0303-Allow-Transparent-Blocks-In-Enchanting-Box.patch index da65b9118..d949d4267 100644 --- a/patches/server/0301-Allow-Transparent-Blocks-In-Enchanting-Box.patch +++ b/patches/server/0303-Allow-Transparent-Blocks-In-Enchanting-Box.patch @@ -20,7 +20,7 @@ index 37a888e5db65b927094b43775ae9d4098244f809..c4a91d7f1320027ee6a2b364303c01eb } diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index 8123dcff4ce0a6c7536fe6369458b397a9f685a4..0cacfe28097db2d2b7c0b54d0163607628d63840 100644 +index 134a594c6e1d63615124ec391718be236673e2f3..76cbfb7e900bf2698776f54cfe498f4b42965221 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -432,6 +432,7 @@ public class PurpurConfig { diff --git a/patches/server/0302-Add-option-to-allow-creeper-to-encircle-target-when-.patch b/patches/server/0304-Add-option-to-allow-creeper-to-encircle-target-when-.patch similarity index 100% rename from patches/server/0302-Add-option-to-allow-creeper-to-encircle-target-when-.patch rename to patches/server/0304-Add-option-to-allow-creeper-to-encircle-target-when-.patch diff --git a/patches/server/0303-Fire-Immunity-API.patch b/patches/server/0305-Fire-Immunity-API.patch similarity index 93% rename from patches/server/0303-Fire-Immunity-API.patch rename to patches/server/0305-Fire-Immunity-API.patch index 14ce37081..4e6341f68 100644 --- a/patches/server/0303-Fire-Immunity-API.patch +++ b/patches/server/0305-Fire-Immunity-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fire Immunity API diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 4759b7e70792003769a79880e2c04cf7ed3ec50a..b52af4f5f17814c5e4bfc4bf4de756e5c15b40c7 100644 +index 46a979fcafcd1492f63f7c0a8ac9a7c2a708b0a5..c647d46783deb4bf135e535933a0dc9c76a7f7f9 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -398,6 +398,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -16,7 +16,7 @@ index 4759b7e70792003769a79880e2c04cf7ed3ec50a..b52af4f5f17814c5e4bfc4bf4de756e5 public void setOrigin(@javax.annotation.Nonnull Location location) { this.origin = location.toVector(); -@@ -1641,7 +1642,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -1675,7 +1676,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } public boolean fireImmune() { @@ -25,7 +25,7 @@ index 4759b7e70792003769a79880e2c04cf7ed3ec50a..b52af4f5f17814c5e4bfc4bf4de756e5 } public boolean causeFallDamage(float fallDistance, float damageMultiplier, DamageSource damageSource) { -@@ -2283,6 +2284,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2317,6 +2318,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { nbt.putBoolean("Paper.FreezeLock", true); } // Paper end @@ -37,7 +37,7 @@ index 4759b7e70792003769a79880e2c04cf7ed3ec50a..b52af4f5f17814c5e4bfc4bf4de756e5 return nbt; } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT"); -@@ -2450,6 +2456,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2484,6 +2490,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { freezeLocked = nbt.getBoolean("Paper.FreezeLock"); } // Paper end diff --git a/patches/server/0304-Add-option-to-teleport-to-spawn-on-nether-ceiling-da.patch b/patches/server/0306-Add-option-to-teleport-to-spawn-on-nether-ceiling-da.patch similarity index 83% rename from patches/server/0304-Add-option-to-teleport-to-spawn-on-nether-ceiling-da.patch rename to patches/server/0306-Add-option-to-teleport-to-spawn-on-nether-ceiling-da.patch index 968422611..9ea4a627c 100644 --- a/patches/server/0304-Add-option-to-teleport-to-spawn-on-nether-ceiling-da.patch +++ b/patches/server/0306-Add-option-to-teleport-to-spawn-on-nether-ceiling-da.patch @@ -5,18 +5,19 @@ Subject: [PATCH] Add option to teleport to spawn on nether ceiling damage diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index b52af4f5f17814c5e4bfc4bf4de756e5c15b40c7..64b91d72fca05f2e74bcaf83bccf061a25a0c868 100644 +index c647d46783deb4bf135e535933a0dc9c76a7f7f9..6b0e44f77c11e51a570de71b537f75c0dd942006 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -415,6 +415,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { - return this.originWorld; - } - // Paper end +@@ -420,7 +420,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + public int activatedPriority = gg.pufferfish.pufferfish.PufferfishConfig.maximumActivationPrio; // golf score + public final BlockPos.MutableBlockPos cachedBlockPos = new BlockPos.MutableBlockPos(); // used where needed + // Pufferfish end +- + public float getBukkitYaw() { return this.yRot; } -@@ -863,6 +864,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -897,6 +897,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> this.getY() >= v) && (!(this instanceof Player player) || !player.getAbilities().invulnerable))) { // Paper end @@ -25,7 +26,7 @@ index b52af4f5f17814c5e4bfc4bf4de756e5c15b40c7..64b91d72fca05f2e74bcaf83bccf061a } diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 994fa545487dd00b94ef4f5d26c0301297904528..0a9b48c7a6dc88a123522ca9c85be94836fd59b8 100644 +index cee5ba9488fe7823b5c86647c22fa042b5c43333..856024f31ca1eeab6e4d4ee7f547509bc9581bf8 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -418,6 +418,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0305-Added-got-ram-event.patch b/patches/server/0307-Added-got-ram-event.patch similarity index 86% rename from patches/server/0305-Added-got-ram-event.patch rename to patches/server/0307-Added-got-ram-event.patch index 922e0cdd7..431aac0dd 100644 --- a/patches/server/0305-Added-got-ram-event.patch +++ b/patches/server/0307-Added-got-ram-event.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Added got ram event diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java -index dee2c9b1b1ed9e03170123e6b13eea2ed70c374e..ab497376c8ebd5527f63035fbed684aaafd49f88 100644 +index 6d9ce5be57aeb882bdfd68c4a2ca352c972e3b36..8f3817df5996bb63ab15ee1ab1ef38e90715018a 100644 --- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java +++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java -@@ -425,6 +425,7 @@ public class Goat extends Animal { +@@ -426,6 +426,7 @@ public class Goat extends Animal { // Paper start - Goat ram API public void ram(net.minecraft.world.entity.LivingEntity entity) { diff --git a/patches/server/0306-Log-skipped-entity-s-position.patch b/patches/server/0308-Log-skipped-entity-s-position.patch similarity index 86% rename from patches/server/0306-Log-skipped-entity-s-position.patch rename to patches/server/0308-Log-skipped-entity-s-position.patch index 879dac2bd..5c8806110 100644 --- a/patches/server/0306-Log-skipped-entity-s-position.patch +++ b/patches/server/0308-Log-skipped-entity-s-position.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Log skipped entity's position diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index 94f72cf064e408c80b0f6ec644c9f69e66f94f36..14ba4c3befd36c2f2d5e9a1b1de3d933e5e0f39f 100644 +index 4bfb370869bb6a6c7e5a9b67361fbac9d2d2e280..7ba73edc37d14eca0fee178cf576e115689010b6 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -595,6 +595,12 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -597,6 +597,12 @@ public class EntityType implements FeatureElement, EntityTypeT entity.load(nbt); }, () -> { EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id")); diff --git a/patches/server/0307-Fix-Paper-8640.patch b/patches/server/0309-Fix-Paper-8640.patch similarity index 100% rename from patches/server/0307-Fix-Paper-8640.patch rename to patches/server/0309-Fix-Paper-8640.patch