First 1.19 build
This commit is contained in:
@@ -15,7 +15,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
remapper("net.fabricmc:tiny-remapper:0.8.4:fat")
|
||||
remapper("net.fabricmc:tiny-remapper:0.8.5:fat")
|
||||
decompiler("org.quiltmc:quiltflower:1.8.1")
|
||||
paperclip("io.papermc:paperclip:3.0.3-SNAPSHOT")
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ group=wtf.etil.mirai
|
||||
version=1.19-R0.1-SNAPSHOT
|
||||
mcVersion=1.19
|
||||
packageVersion=1_19_R1
|
||||
pufferfishRef=2073617ddbb07b42c1b71d983d29fd46a90a9a12
|
||||
pufferfishRef=8aafc1392d75feb3c2afa6116972b6cf49d5136a
|
||||
|
||||
org.gradle.caching=true
|
||||
org.gradle.caching.debug=false
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Mirai Configuration
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 79b26045a68ebb9b01e5bd06abbccaaef5489777..3dd9204c639737ad0c508d2d4a0ac8bc61c74910 100644
|
||||
index e756edf56995f4552387c2e1082307eb3dd48bb3..58bb08e35e26400f967af89bfe963b23bc4ff79d 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1897,6 +1897,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -1922,6 +1922,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
}
|
||||
// Paper end
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Kerllenevich <ben@omega24.dev>
|
||||
Date: Sat, 12 Jun 2021 12:35:38 -0400
|
||||
Subject: [PATCH] Build System Changes
|
||||
|
||||
Original code by PurpurMC, licensed under MIT
|
||||
You can find the original code on https://github.com/PurpurMC/Purpur
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 3a1c5a4aa8d512d50565b22a383e44b73b276ee5..ea01ad75a874944a16f817f0a27e12b251111192 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -103,6 +103,8 @@ tasks.jar {
|
||||
}
|
||||
|
||||
tasks.withType<Javadoc> {
|
||||
+ (options as StandardJavadocDocletOptions).addStringOption("-add-modules", "jdk.incubator.vector") // Purpur - our javadocs need this for pufferfish's SIMD patch
|
||||
+ (options as StandardJavadocDocletOptions).addStringOption("Xdoclint:none", "-quiet") // Purpur - silence Paper's bajillion javadoc warnings
|
||||
val options = options as StandardJavadocDocletOptions
|
||||
options.overview = "src/main/javadoc/overview.html"
|
||||
options.isDocFilesSubDirs = true
|
||||
@@ -7,7 +7,7 @@ Original code by YatopiaMC, licensed under MIT
|
||||
You can find the original code on https://github.com/YatopiaMC/Yatopia
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
index 0c7ba0718de2b93d013968ca0fec34ffd423990f..535800197c43f43c30854d2b193107808dc3b6c7 100644
|
||||
index 3ec32b46264cfff857b50129b5e0fa5584943ec6..e6678639df52c3497606f3a0f6529fa8c3a663d6 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
@@ -21,6 +21,17 @@ public class ReloadCommand extends BukkitCommand {
|
||||
@@ -7,10 +7,10 @@ Original code by YatopiaMC, licensed under MIT
|
||||
You can find the original code on https://github.com/YatopiaMC/Yatopia
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index d8666481f9a407403d0114ff02024fd3c50c27c4..cfa749cfa9fc8bade80018f0deaa6420c57d8272 100644
|
||||
index 3506a7fa07ee6e53704b1df8d8d2bb08704bfc37..920b55c2b9f0209490271ce416c05f7a7d8e9b13 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -2336,6 +2336,16 @@ public final class Bukkit {
|
||||
@@ -2380,6 +2380,16 @@ public final class Bukkit {
|
||||
return server.isStopping();
|
||||
}
|
||||
|
||||
@@ -28,10 +28,10 @@ index d8666481f9a407403d0114ff02024fd3c50c27c4..cfa749cfa9fc8bade80018f0deaa6420
|
||||
* Returns the {@link com.destroystokyo.paper.entity.ai.MobGoals} manager
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 3dd9204c639737ad0c508d2d4a0ac8bc61c74910..2e6bd4a4b333eea52339ebd99410ec13300bda67 100644
|
||||
index 58bb08e35e26400f967af89bfe963b23bc4ff79d..932fea11c30ddea6e7a3bf9d4ff516a8f792849c 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2046,6 +2046,26 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -2081,6 +2081,26 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
boolean isStopping();
|
||||
|
||||
@@ -24,10 +24,10 @@ index 419aec56b0e3fa8bcec2ea7f340caa3456b57d00..8530d926931a54ed1300c40cd1e0908b
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index dba9041784e7d3051b5248cbc24e4879e60103c1..20408d8668aa17bb6ab9ecee94db32a0cae5e95e 100644
|
||||
index aed2209b66f11a0d03473cf19437f3da0e9e573a..1e482ee08b2c0b155ac0a64f0913155f9612b83f 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -653,11 +653,15 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@@ -648,11 +648,15 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@Override
|
||||
public void callEvent(@NotNull Event event) {
|
||||
// Paper - replace callEvent by merging to below method
|
||||
@@ -7,10 +7,10 @@ Original code by Titaniumtown, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://gitlab.com/Titaniumtown/JettPack
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index 20408d8668aa17bb6ab9ecee94db32a0cae5e95e..3a93a1e4d0f0345a601428f2758653dc406be122 100644
|
||||
index 1e482ee08b2c0b155ac0a64f0913155f9612b83f..c525e93712ceea029ed50237932d998610249205 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -652,6 +652,13 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@@ -647,6 +647,13 @@ public final class SimplePluginManager implements PluginManager {
|
||||
*/
|
||||
@Override
|
||||
public void callEvent(@NotNull Event event) {
|
||||
@@ -24,7 +24,7 @@ index 20408d8668aa17bb6ab9ecee94db32a0cae5e95e..3a93a1e4d0f0345a601428f2758653dc
|
||||
// Paper - replace callEvent by merging to below method
|
||||
// KTP start - optimize spigot event bus
|
||||
final boolean isAsync = event.isAsynchronous();
|
||||
@@ -663,8 +670,8 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@@ -658,8 +665,8 @@ public final class SimplePluginManager implements PluginManager {
|
||||
}
|
||||
// KTP end - optimize spigot event bus
|
||||
|
||||
@@ -7,7 +7,7 @@ Original code by PatinaMC, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://github.com/PatinaMC/Patina
|
||||
|
||||
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
index 57cf9fab2501da6f1abd12e14697630ca82b0a6d..cca7e9876c7609acb26a6c9116b191b0e467a0b0 100644
|
||||
index bbe81f7a420f913ffdcad913a3c43ff41ead41f5..7cb7618df43793836a3151925b8c615628d707f9 100644
|
||||
--- a/src/test/java/org/bukkit/AnnotationTest.java
|
||||
+++ b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
@@ -63,6 +63,7 @@ public class AnnotationTest {
|
||||
257
patches/api/0007-Suspected-plugins-report.patch
Normal file
257
patches/api/0007-Suspected-plugins-report.patch
Normal file
@@ -0,0 +1,257 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: ishland <ishlandmc@yeah.net>
|
||||
Date: Fri, 29 Jan 2021 09:57:47 +0800
|
||||
Subject: [PATCH] Suspected plugins report
|
||||
|
||||
Added "Suspected Plugins" to Watchdog, crash reports and exception messages
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index c525e93712ceea029ed50237932d998610249205..434d7c02001d16e542fd892ded23085fcf9e78a2 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -618,7 +618,11 @@ 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);
|
||||
+ // Yatopia start - detailed report
|
||||
+ server.getLogger().log(Level.SEVERE, msg);
|
||||
+ org.yatopiamc.yatopia.api.internal.StackTraceUtils.print(ex, _msg -> server.getLogger().log(Level.SEVERE, _msg));
|
||||
+ server.getLogger().log(Level.SEVERE, org.yatopiamc.yatopia.api.internal.StackTraceUtils.EXCEPTION_DETAILS_BELOW, ex);
|
||||
+ // Yatopia end
|
||||
gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish
|
||||
callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerPluginEnableDisableException(msg, ex, plugin)));
|
||||
}
|
||||
@@ -692,7 +696,11 @@ public final class SimplePluginManager implements PluginManager {
|
||||
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);
|
||||
+ // Yatopia start - detailed report
|
||||
+ server.getLogger().log(Level.SEVERE, msg);
|
||||
+ org.yatopiamc.yatopia.api.internal.StackTraceUtils.print(ex, _msg -> server.getLogger().log(Level.SEVERE, _msg));
|
||||
+ server.getLogger().log(Level.SEVERE, org.yatopiamc.yatopia.api.internal.StackTraceUtils.EXCEPTION_DETAILS_BELOW, ex);
|
||||
+ // Yatopia end
|
||||
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)));
|
||||
@@ -978,4 +986,10 @@ public final class SimplePluginManager implements PluginManager {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
+ // Yatopia start - Accessor
|
||||
+ @NotNull
|
||||
+ public Collection<PluginLoader> getPluginLoaders() {
|
||||
+ return new HashSet<>(fileAssociations.values());
|
||||
+ }
|
||||
+ // Yatopia end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
|
||||
index 3bea5dd67ad0393160ccede4ac99a3c7baa1803b..65f1aa94652d0efacb0184bf41b519adc26bef50 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
|
||||
@@ -112,7 +112,7 @@ public abstract class JavaPlugin extends PluginBase {
|
||||
* @return File containing this plugin
|
||||
*/
|
||||
@NotNull
|
||||
- protected File getFile() {
|
||||
+ public File getFile() { // Yatopia
|
||||
return file;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
index a16c841751bc44e46d27fc4efbfc2ab23cc7b0d7..d1ba0d556edf6675952cb74dd31254704a9588cb 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -370,7 +370,11 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
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);
|
||||
+ // Yatopia start - detailed report
|
||||
+ server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)");
|
||||
+ org.yatopiamc.yatopia.api.internal.StackTraceUtils.print(ex, _msg -> server.getLogger().log(Level.SEVERE, _msg));
|
||||
+ server.getLogger().log(Level.SEVERE, org.yatopiamc.yatopia.api.internal.StackTraceUtils.EXCEPTION_DETAILS_BELOW, ex);
|
||||
+ // Yatopia end
|
||||
gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish
|
||||
// Paper start - Disable plugins that fail to load
|
||||
this.server.getPluginManager().disablePlugin(jPlugin);
|
||||
@@ -401,7 +405,11 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
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);
|
||||
+ // Yatopia start - detailed report
|
||||
+ server.getLogger().log(Level.SEVERE, "Error occurred while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)");
|
||||
+ org.yatopiamc.yatopia.api.internal.StackTraceUtils.print(ex, _msg -> server.getLogger().log(Level.SEVERE, _msg));
|
||||
+ server.getLogger().log(Level.SEVERE, org.yatopiamc.yatopia.api.internal.StackTraceUtils.EXCEPTION_DETAILS_BELOW, ex);
|
||||
+ // Yatopia end
|
||||
gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish
|
||||
}
|
||||
|
||||
@@ -418,10 +426,18 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
try {
|
||||
loader.close();
|
||||
} catch (IOException ex) {
|
||||
- //
|
||||
+ // Yatopia start - detailed report
|
||||
this.server.getLogger().log(Level.WARNING, "Error closing the PluginClassLoader for '" + plugin.getDescription().getFullName() + "'", ex); // Paper - log exception
|
||||
+ org.yatopiamc.yatopia.api.internal.StackTraceUtils.print(ex, _msg -> server.getLogger().log(Level.WARNING, _msg));
|
||||
+ server.getLogger().log(Level.WARNING, org.yatopiamc.yatopia.api.internal.StackTraceUtils.EXCEPTION_DETAILS_BELOW, ex);
|
||||
+ // Yatopia end
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+ // Yatopia start - Accessor
|
||||
+ public List<PluginClassLoader> getClassLoaders() {
|
||||
+ return java.util.Collections.unmodifiableList(loaders);
|
||||
+ }
|
||||
+ // Yatopia end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
index 4f736a267eb4c8a3bedb2d02fb30468484b991d5..c6102c9b40a05eb8ddaef40ce1c9bb8e14371389 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
@@ -251,4 +251,13 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||
'}';
|
||||
}
|
||||
// Paper end
|
||||
+
|
||||
+ // Yatopia start - Accessor
|
||||
+ public java.util.Collection<Class<?>> getLoadedClasses() {
|
||||
+ return java.util.Collections.unmodifiableCollection(
|
||||
+ new java.util.HashSet<>(classes.values()).stream()
|
||||
+ .filter(clazz -> clazz.getClassLoader() == this).collect(java.util.stream.Collectors.toSet())
|
||||
+ );
|
||||
+ }
|
||||
+ // Yatopia end
|
||||
}
|
||||
diff --git a/src/main/java/org/yatopiamc/yatopia/api/internal/StackTraceUtils.java b/src/main/java/org/yatopiamc/yatopia/api/internal/StackTraceUtils.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0aa9bc6ad0a85d469b29201b9da29165bafb874c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/yatopiamc/yatopia/api/internal/StackTraceUtils.java
|
||||
@@ -0,0 +1,105 @@
|
||||
+package org.yatopiamc.yatopia.api.internal;
|
||||
+
|
||||
+import com.google.common.base.Suppliers;
|
||||
+import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
+import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.plugin.Plugin;
|
||||
+import org.bukkit.plugin.PluginLoader;
|
||||
+import org.bukkit.plugin.SimplePluginManager;
|
||||
+import org.bukkit.plugin.java.JavaPlugin;
|
||||
+import org.bukkit.plugin.java.JavaPluginLoader;
|
||||
+import org.bukkit.plugin.java.PluginClassLoader;
|
||||
+
|
||||
+import java.util.Arrays;
|
||||
+import java.util.Collection;
|
||||
+import java.util.Collections;
|
||||
+import java.util.HashSet;
|
||||
+import java.util.List;
|
||||
+import java.util.Map;
|
||||
+import java.util.Set;
|
||||
+import java.util.concurrent.TimeUnit;
|
||||
+import java.util.function.Consumer;
|
||||
+import java.util.function.Supplier;
|
||||
+import java.util.stream.Collectors;
|
||||
+
|
||||
+public class StackTraceUtils {
|
||||
+
|
||||
+ public static final String EXCEPTION_DETAILS_BELOW = "Exception details below: ";
|
||||
+
|
||||
+ private static final Supplier<Map<Plugin, Set<Class<?>>>> loadedClassesSupplier = Suppliers.memoizeWithExpiration(StackTraceUtils::scanForPluginClasses, 5, TimeUnit.SECONDS);
|
||||
+
|
||||
+ public static void print(StackTraceElement[] stackTrace, Consumer<String> out) {
|
||||
+ Set<Plugin> suspectedPlugins = getSuspectedPluginsFromStackTrace(stackTrace);
|
||||
+
|
||||
+ printSuspectedPlugins(out, suspectedPlugins);
|
||||
+ }
|
||||
+
|
||||
+ public static void print(Throwable t, Consumer<String> out) {
|
||||
+ Set<Plugin> suspectedPlugins = getSuspectedPluginsFromStackTrace(getStackTracesFromThrowable(t).toArray(new StackTraceElement[0]));
|
||||
+
|
||||
+ printSuspectedPlugins(out, suspectedPlugins);
|
||||
+ }
|
||||
+
|
||||
+ private static Set<StackTraceElement> getStackTracesFromThrowable(Throwable t) {
|
||||
+ if(t == null) return Collections.emptySet();
|
||||
+ Set<StackTraceElement> elements = new ObjectOpenHashSet<>();
|
||||
+ elements.addAll(getStackTracesFromThrowable(t.getCause()));
|
||||
+ elements.addAll(Arrays.stream(t.getSuppressed()).flatMap(throwable -> getStackTracesFromThrowable(throwable).stream()).collect(Collectors.toSet()));
|
||||
+ elements.addAll(Arrays.asList(t.getStackTrace()));
|
||||
+ return elements;
|
||||
+ }
|
||||
+
|
||||
+ private static void printSuspectedPlugins(Consumer<String> out, Set<Plugin> suspectedPlugins) {
|
||||
+ if (!suspectedPlugins.isEmpty()) {
|
||||
+ out.accept("Suspected Plugins: ");
|
||||
+ for (Plugin plugin : suspectedPlugins) {
|
||||
+ StringBuilder builder = new StringBuilder("\t");
|
||||
+ builder.append(plugin.getName())
|
||||
+ .append("{")
|
||||
+ .append(plugin.isEnabled() ? "enabled" : "disabled")
|
||||
+ .append(",").append("ver=").append(plugin.getDescription().getVersion());
|
||||
+ if (!plugin.isNaggable())
|
||||
+ builder.append(",").append("nag");
|
||||
+ if (plugin instanceof JavaPlugin)
|
||||
+ builder.append(",").append("path=").append(((JavaPlugin) plugin).getFile());
|
||||
+
|
||||
+ builder.append("}");
|
||||
+ out.accept(builder.toString());
|
||||
+ }
|
||||
+ } else {
|
||||
+ out.accept("Suspected Plugins: None");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static Set<Plugin> getSuspectedPluginsFromStackTrace(StackTraceElement[] stackTrace) {
|
||||
+ Map<Plugin, Set<Class<?>>> loadedClasses = loadedClassesSupplier.get();
|
||||
+ Set<Plugin> suspectedPlugins = new HashSet<>();
|
||||
+ for (StackTraceElement stackTraceElement : stackTrace) {
|
||||
+ for (Map.Entry<Plugin, Set<Class<?>>> pluginSetEntry : loadedClasses.entrySet()) {
|
||||
+ if (pluginSetEntry.getValue().stream().anyMatch(clazz -> clazz.getName().equals(stackTraceElement.getClassName())))
|
||||
+ suspectedPlugins.add(pluginSetEntry.getKey());
|
||||
+ }
|
||||
+ }
|
||||
+ return suspectedPlugins;
|
||||
+ }
|
||||
+
|
||||
+ private static Map<Plugin, Set<Class<?>>> scanForPluginClasses() {
|
||||
+ Map<Plugin, Set<Class<?>>> loadedClasses = new Object2ObjectOpenHashMap<>();
|
||||
+ if (Bukkit.getPluginManager() instanceof SimplePluginManager) {
|
||||
+ final SimplePluginManager pluginManager = (SimplePluginManager) Bukkit.getPluginManager();
|
||||
+ final Collection<PluginLoader> pluginLoaders = pluginManager.getPluginLoaders();
|
||||
+ for (PluginLoader pluginLoader : pluginLoaders) {
|
||||
+ if (pluginLoader instanceof JavaPluginLoader) {
|
||||
+ JavaPluginLoader javaPluginLoader = (JavaPluginLoader) pluginLoader;
|
||||
+ final List<PluginClassLoader> classLoaders = javaPluginLoader.getClassLoaders();
|
||||
+ for (PluginClassLoader classLoader : classLoaders) {
|
||||
+ loadedClasses.put(classLoader.getPlugin(), new ObjectOpenHashSet<>(classLoader.getLoadedClasses()));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return loadedClasses;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
index 7cb7618df43793836a3151925b8c615628d707f9..6734be90d7121755ca3f81138ffaa8955152eee2 100644
|
||||
--- a/src/test/java/org/bukkit/AnnotationTest.java
|
||||
+++ b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
@@ -57,8 +57,11 @@ public class AnnotationTest {
|
||||
"co/aikar/timings/TimingHistory$2$1$2",
|
||||
"co/aikar/timings/TimingHistory$3",
|
||||
"co/aikar/timings/TimingHistory$4",
|
||||
- "co/aikar/timings/TimingHistoryEntry$1"
|
||||
+ "co/aikar/timings/TimingHistoryEntry$1",
|
||||
// Paper end
|
||||
+ // Yatopia start
|
||||
+ "org/yatopiamc/yatopia/api/internal/StackTraceUtils"
|
||||
+ // Yatopia end
|
||||
};
|
||||
|
||||
@Test
|
||||
@@ -1,37 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Thu, 7 Apr 2022 16:35:36 -0500
|
||||
Subject: [PATCH] Set multiple Team settings with a single packet
|
||||
|
||||
Original license: MIT
|
||||
Original project: https://github.com/Cryptite/Slice
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
index 0f5c49d41c9460da0ba913b4ca8bef375f2c23df..46eee49bb149910c01db377c9cc8a96da9ead797 100644
|
||||
--- a/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
+++ b/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
@@ -534,6 +534,24 @@ public interface Team {
|
||||
boolean hasEntity(@NotNull org.bukkit.entity.Entity entity) throws IllegalStateException, IllegalArgumentException;
|
||||
// Paper end
|
||||
|
||||
+ // Slice start
|
||||
+ /**
|
||||
+ * Fully set all team options, combining all 5 options into one packet send, rather than one packet sent
|
||||
+ * for every single option change.
|
||||
+ * @param displayName New display name
|
||||
+ * @param prefix New prefix
|
||||
+ * @param suffix New suffix
|
||||
+ * @param color new color
|
||||
+ * @param options A Paired list of options
|
||||
+ * @throws IllegalStateException
|
||||
+ */
|
||||
+ void teamOptions(net.kyori.adventure.text.Component displayName,
|
||||
+ net.kyori.adventure.text.Component prefix,
|
||||
+ net.kyori.adventure.text.Component suffix,
|
||||
+ net.kyori.adventure.text.format.NamedTextColor color,
|
||||
+ java.util.List<org.apache.commons.lang3.tuple.Pair<Option, OptionStatus>> options) throws IllegalStateException;
|
||||
+ // Slice end
|
||||
+
|
||||
/**
|
||||
* Represents an option which may be applied to this team.
|
||||
*/
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Mirai Branding Changes
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index b04e9ab317fbce9c090b61076eb07c40f069dc59..0321eac313212c717cf02889589bbc5f73c7d6ca 100644
|
||||
index a4a146d9c3e07bdf941d81147ca31daf4689a687..fb0da758cce2c7022aa23dfb3dc62f29513ba6a9 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -9,7 +9,7 @@ plugins {
|
||||
@@ -15,9 +15,9 @@ index b04e9ab317fbce9c090b61076eb07c40f069dc59..0321eac313212c717cf02889589bbc5f
|
||||
- implementation(project(":pufferfish-api")) // Pufferfish // Paper
|
||||
+ implementation(project(":mirai-api")) // Mirai // Pufferfish // Paper
|
||||
// Pufferfish start
|
||||
implementation("io.papermc.paper:paper-mojangapi:1.18.2-R0.1-SNAPSHOT") {
|
||||
implementation("io.papermc.paper:paper-mojangapi:1.19-R0.1-SNAPSHOT") {
|
||||
exclude("io.papermc.paper", "paper-api")
|
||||
@@ -74,13 +74,13 @@ tasks.jar {
|
||||
@@ -78,13 +78,13 @@ tasks.jar {
|
||||
manifest {
|
||||
val git = Git(rootProject.layout.projectDirectory.path)
|
||||
val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
|
||||
@@ -34,7 +34,7 @@ index b04e9ab317fbce9c090b61076eb07c40f069dc59..0321eac313212c717cf02889589bbc5f
|
||||
"Specification-Title" to "Bukkit",
|
||||
"Specification-Version" to project.version,
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
index f2fe6ea3719ff8b2913b7a3a939d7a5b75cb8b28..d7d614f679ac30360eee431044962614b498a72e 100644
|
||||
index 061716934ba0a1f01e4d85d664034f72b3c7a765..0db2c292fe1fd1504f6d50b7bfa5121598b762c1 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 {
|
||||
@@ -56,7 +56,7 @@ index f2fe6ea3719ff8b2913b7a3a939d7a5b75cb8b28..d7d614f679ac30360eee431044962614
|
||||
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
|
||||
Map<String, Map<String, Integer>> map = new HashMap<>();
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||
index e0b1f0671d16ddddcb6725acd25a1d1d69e42701..c5dc798bb272a94520404e0e14c17500d3d045ae 100644
|
||||
index b0390eedb507d27426d1e1d73bd4ab63aec89ebe..509a9a5326d94200ca3d7a83ae47c6bb093d6969 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||
@@ -17,7 +17,7 @@ public final class PaperConsole extends SimpleTerminalConsole {
|
||||
@@ -69,10 +69,10 @@ index e0b1f0671d16ddddcb6725acd25a1d1d69e42701..c5dc798bb272a94520404e0e14c17500
|
||||
.completer(new ConsoleCommandCompleter(this.server))
|
||||
.option(LineReader.Option.COMPLETE_IN_WORD, true);
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 371b0f95b23d67c9913875a3dd7888e722551f18..7ba86703433322e2b166cc263cedd6e7310d36a4 100644
|
||||
index e96ff8b13b1237d7c70359b78e4d72938877191f..fc3d65885cc704f807ddcb07561b4a529827166c 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1695,7 +1695,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1656,7 +1656,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
@@ -82,10 +82,10 @@ index 371b0f95b23d67c9913875a3dd7888e722551f18..7ba86703433322e2b166cc263cedd6e7
|
||||
|
||||
public SystemReport fillSystemReport(SystemReport details) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index ce1ca033b351785fb67304b8933990d7f2f22d29..ccf826e4d9815af19e598a2320c880c9235eb15a 100644
|
||||
index 33218552405c526955d30031469d3044c724dde3..008e8cdb9bc17bbdcd4886fca8a50311262e457e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -249,7 +249,7 @@ import javax.annotation.Nullable; // Paper
|
||||
@@ -245,7 +245,7 @@ import javax.annotation.Nullable; // Paper
|
||||
import javax.annotation.Nonnull; // Paper
|
||||
|
||||
public final class CraftServer implements Server {
|
||||
@@ -95,7 +95,7 @@ index ce1ca033b351785fb67304b8933990d7f2f22d29..ccf826e4d9815af19e598a2320c880c9
|
||||
private final String bukkitVersion = Versioning.getBukkitVersion();
|
||||
private final Logger logger = Logger.getLogger("Minecraft");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index f71af7ecad4b6b0328da8cf8c4e5a8e163866e19..1e74799bb012ca45769a3fd103f0b24eba0a9a99 100644
|
||||
index 2d9c98931df5d1c54adcfba78a9136841764f853..ae2965796f5c0a5c8629159714a245557c17f423 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -430,7 +430,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -122,10 +122,10 @@ index 80553face9c70c2a3d897681e7761df85b22d464..4c7515fa391ee9b631cb9cd3da67b50a
|
||||
if (stream != null) {
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiVersionFetcher.java b/src/main/java/wtf/etil/mirai/MiraiVersionFetcher.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2a7ea9e238be3a253d560ebcacc433258ea636d9
|
||||
index 0000000000000000000000000000000000000000..b01fd6deb9b437bfd499558334fea422de22b522
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiVersionFetcher.java
|
||||
@@ -0,0 +1,112 @@
|
||||
@@ -0,0 +1,106 @@
|
||||
+package wtf.etil.mirai;
|
||||
+
|
||||
+import com.destroystokyo.paper.VersionHistoryManager;
|
||||
@@ -156,16 +156,10 @@ index 0000000000000000000000000000000000000000..2a7ea9e238be3a253d560ebcacc43325
|
||||
+
|
||||
+public class MiraiVersionFetcher implements VersionFetcher {
|
||||
+
|
||||
+ /*
|
||||
+ * Huge shoutout to Airplane for providing basically this entire class.
|
||||
+ * My brain and fingers thank you.
|
||||
+ * ~ Code
|
||||
+ */
|
||||
+
|
||||
+ private static final Logger LOGGER = Logger.getLogger("MiraiVersionFetcher");
|
||||
+ private static final HttpClient client = HttpClient.newHttpClient();
|
||||
+
|
||||
+ private static final String GITHUB_FORMAT = "https://api.github.com/repos/etil2jz/Mirai/compare/ver/1.18.2...%s";
|
||||
+ private static final String GITHUB_FORMAT = "https://api.github.com/repos/etil2jz/Mirai/compare/ver/1.19...%s";
|
||||
+
|
||||
+ private static final HttpResponse.BodyHandler<JsonObject> JSON_OBJECT_BODY_HANDLER = responseInfo -> HttpResponse.BodySubscribers.mapping(
|
||||
+ HttpResponse.BodySubscribers.ofString(StandardCharsets.UTF_8),
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Mirai Configuration
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 27e90ca03275a42271bbe97ee1a63a355b098ede..201319ddb8a0f1817ec5328aa5757212ea6a4b49 100644
|
||||
index 5d6ceeecfbb55a1bfe77a1f1ac39b02993e714e3..3e232156774b9df5be318dc6dc5035b326f1f1b3 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -237,6 +237,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -228,6 +228,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
// Paper end
|
||||
gg.pufferfish.pufferfish.PufferfishConfig.load(); // Pufferfish
|
||||
gg.pufferfish.pufferfish.PufferfishCommand.init(); // Pufferfish
|
||||
@@ -26,22 +26,22 @@ index 27e90ca03275a42271bbe97ee1a63a355b098ede..201319ddb8a0f1817ec5328aa5757212
|
||||
this.setPvpAllowed(dedicatedserverproperties.pvp);
|
||||
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index fd4d672eeb8bcedae0965d883fde52cfb8d1e9b4..a8e4cff4567d55db8da902d0a387e55e4a1192ac 100644
|
||||
index 008e8cdb9bc17bbdcd4886fca8a50311262e457e..2e81f3eaec2d04e6bc88f7ce9a2bc861297e0383 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -956,6 +956,7 @@ public final class CraftServer implements Server {
|
||||
@@ -957,6 +957,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
|
||||
com.destroystokyo.paper.PaperConfig.init((File) console.options.valueOf("paper-settings")); // Paper
|
||||
this.console.paperConfigurations.reloadConfigs(this.console);
|
||||
+ wtf.etil.mirai.MiraiConfig.init((File) console.options.valueOf("mirai-settings")); // Mirai
|
||||
for (ServerLevel world : this.console.getAllLevels()) {
|
||||
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
||||
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index fbe68bd4739d9a0e7d9bc4c3d5ba8ecfd2d13954..298c20e4abc04a8bdc93719c282d0b4ef4560819 100644
|
||||
index 1b9e91b20dd9a9375a0a2a6a4d7a0bcdce9e7b1a..dab3d736ae60b255b3151ddcf2b5832c14ecef53 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -153,6 +153,14 @@ public class Main {
|
||||
@@ -158,6 +158,14 @@ public class Main {
|
||||
.describedAs("Jar file");
|
||||
// Paper end
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Simon Gardling <titaniumtown@gmail.com>
|
||||
Date: Tue, 9 Nov 2021 16:53:39 -0500
|
||||
Subject: [PATCH] reduce allocs
|
||||
Subject: [PATCH] Reduce constants allocations
|
||||
|
||||
This patch includes code from the lithium project under the GNU Lesser General Public License v3.0: https://github.com/CaffeineMC/lithium-fabric/ but also original code created by your's truly
|
||||
|
||||
@@ -9,10 +9,10 @@ Original code by Titaniumtown, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://gitlab.com/Titaniumtown/JettPack
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
index 45d1807b31f5acd5f08f729701cec4b464ad9398..e85175910454fc08704ea01e4b852136a6c6c60f 100644
|
||||
index 8ec20f17a3f8c39ae3ebf3fb630f98b35283ba88..bb220f27f5d472514d9a1620a40ed50fcb31ae16 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
@@ -214,7 +214,7 @@ public class PaperCommand extends Command {
|
||||
@@ -218,7 +218,7 @@ public class PaperCommand extends Command {
|
||||
case "version":
|
||||
Command ver = MinecraftServer.getServer().server.getCommandMap().getCommand("version");
|
||||
if (ver != null) {
|
||||
@@ -22,16 +22,15 @@ index 45d1807b31f5acd5f08f729701cec4b464ad9398..e85175910454fc08704ea01e4b852136
|
||||
}
|
||||
// else - fall through to default
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java
|
||||
index 0133ea6feb1ab88f021f66855669f58367e7420b..cd5499e750764eaa5e361e73eb581bfce7f9f7c1 100644
|
||||
index 0133ea6feb1ab88f021f66855669f58367e7420b..027b9a6a917aae43357c7a7b5595e6cf64fdbd22 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java
|
||||
@@ -17,9 +17,9 @@ public final class EntityList implements Iterable<Entity> {
|
||||
@@ -17,9 +17,7 @@ public final class EntityList implements Iterable<Entity> {
|
||||
this.entityToIndex.defaultReturnValue(Integer.MIN_VALUE);
|
||||
}
|
||||
|
||||
- protected static final Entity[] EMPTY_LIST = new Entity[0];
|
||||
+ // protected static final Entity[] EMPTY_LIST = new Entity[0]; // JettPack
|
||||
|
||||
-
|
||||
- protected Entity[] entities = EMPTY_LIST;
|
||||
+ protected Entity[] entities = me.titaniumtown.Constants.EMPTY_entity_arr; // JettPack
|
||||
protected int count;
|
||||
@@ -53,7 +52,7 @@ index 277cfd9d1e8fff5d9b5e534b75c3c5162d58b0b7..52ec153be9d7177102dd137dfc356e29
|
||||
|
||||
public static int getLocationKey(final int x, final int y, final int z) {
|
||||
diff --git a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
index 47b5f75d9f27cf3ab947fd1f69cbd609fb9f2749..a919e8a2aa10ba01d7f389985591a0681c1b4426 100644
|
||||
index 47b5f75d9f27cf3ab947fd1f69cbd609fb9f2749..d3cdf40330a99af729412a7a537ec705c16cc327 100644
|
||||
--- a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
+++ b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
@@ -63,7 +63,7 @@ public final class ChunkEntitySlices {
|
||||
@@ -65,16 +64,15 @@ index 47b5f75d9f27cf3ab947fd1f69cbd609fb9f2749..a919e8a2aa10ba01d7f389985591a068
|
||||
}
|
||||
// Paper end - optimise CraftChunk#getEntities
|
||||
|
||||
@@ -189,7 +189,7 @@ public final class ChunkEntitySlices {
|
||||
@@ -189,7 +189,6 @@ public final class ChunkEntitySlices {
|
||||
|
||||
protected static final class BasicEntityList<E extends Entity> {
|
||||
|
||||
- protected static final Entity[] EMPTY = new Entity[0];
|
||||
+ // protected static final Entity[] EMPTY = new Entity[0]; // JettPack
|
||||
protected static final int DEFAULT_CAPACITY = 4;
|
||||
|
||||
protected E[] storage;
|
||||
@@ -200,7 +200,7 @@ public final class ChunkEntitySlices {
|
||||
@@ -200,7 +199,7 @@ public final class ChunkEntitySlices {
|
||||
}
|
||||
|
||||
public BasicEntityList(final int cap) {
|
||||
@@ -83,7 +81,7 @@ index 47b5f75d9f27cf3ab947fd1f69cbd609fb9f2749..a919e8a2aa10ba01d7f389985591a068
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
@@ -212,7 +212,7 @@ public final class ChunkEntitySlices {
|
||||
@@ -212,7 +211,7 @@ public final class ChunkEntitySlices {
|
||||
}
|
||||
|
||||
private void resize() {
|
||||
@@ -127,7 +125,7 @@ index 3dd8a189c26f41759c59c3b9d0e5282038989a9f..147beddf8ef369cdae4b1ed2dcd0d7b2
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java
|
||||
index 29f6fc5f83042713704b83f3b5257eb8b9b747f2..0211e70eede03cbe6cdc657e2265c5a1683b7b6c 100644
|
||||
index 912fd5135e89348bdd3c0a8b6c07860ebc106df3..beecf9d1effea5cd12d1f826cc8071cd83b5a4d5 100644
|
||||
--- a/src/main/java/net/minecraft/nbt/CompoundTag.java
|
||||
+++ b/src/main/java/net/minecraft/nbt/CompoundTag.java
|
||||
@@ -364,7 +364,7 @@ public class CompoundTag implements Tag {
|
||||
@@ -171,10 +169,10 @@ index a14b01cee7a8d7022c4fa7264d349a76be143ba5..44f441d6c102fa5bd50071cae991a8a6
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/nbt/ListTag.java b/src/main/java/net/minecraft/nbt/ListTag.java
|
||||
index 17a37d453b3d6cdb838dd7e8071bb9ad34cd2c20..1e2aca86f30c43f25aea7f18b67b4f6ddbd4c2cf 100644
|
||||
index f346306d61854bdc6b395f5d8f799909537a1b50..3dd6526c3550a08f7da75ce0b80be4ba090ed272 100644
|
||||
--- a/src/main/java/net/minecraft/nbt/ListTag.java
|
||||
+++ b/src/main/java/net/minecraft/nbt/ListTag.java
|
||||
@@ -221,7 +221,7 @@ public class ListTag extends CollectionTag<Tag> {
|
||||
@@ -217,7 +217,7 @@ public class ListTag extends CollectionTag<Tag> {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +181,7 @@ index 17a37d453b3d6cdb838dd7e8071bb9ad34cd2c20..1e2aca86f30c43f25aea7f18b67b4f6d
|
||||
}
|
||||
|
||||
public long[] getLongArray(int index) {
|
||||
@@ -232,7 +232,7 @@ public class ListTag extends CollectionTag<Tag> {
|
||||
@@ -228,7 +228,7 @@ public class ListTag extends CollectionTag<Tag> {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,10 +191,10 @@ index 17a37d453b3d6cdb838dd7e8071bb9ad34cd2c20..1e2aca86f30c43f25aea7f18b67b4f6d
|
||||
|
||||
public double getDouble(int index) {
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index 9bbf990212ee55a267d0eb1e863618c50fa706da..b9b93606b5771de854cd0e1af0001cc8cf6aca2f 100644
|
||||
index b65a3626d2e0817cd1e223ec3b10e82fa0339663..e3d2d71c31e2257810ee1da00958d43887062200 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -316,7 +316,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -315,7 +315,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
}
|
||||
|
||||
public void setListener(PacketListener listener) {
|
||||
@@ -206,10 +204,10 @@ index 9bbf990212ee55a267d0eb1e863618c50fa706da..b9b93606b5771de854cd0e1af0001cc8
|
||||
}
|
||||
// Paper start
|
||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||
index 1e0d261439255091a6f61485c0747231fbd5b1db..490f5d86df7fff6537c7080361a7df80951647df 100644
|
||||
index 0a843e0afbcb1af8e2641515eb244b791b819b8c..c420ce5c1bebdb0abe273d73a61a15e5424fb1bb 100644
|
||||
--- a/src/main/java/net/minecraft/server/Main.java
|
||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||
@@ -80,7 +80,7 @@ public class Main {
|
||||
@@ -81,7 +81,7 @@ public class Main {
|
||||
OptionSpec<Void> optionspec6 = optionparser.accepts("safeMode", "Loads level with vanilla datapack only");
|
||||
OptionSpec<Void> optionspec7 = optionparser.accepts("help").forHelp();
|
||||
OptionSpec<String> optionspec8 = optionparser.accepts("singleplayer").withRequiredArg();
|
||||
@@ -219,10 +217,10 @@ index 1e0d261439255091a6f61485c0747231fbd5b1db..490f5d86df7fff6537c7080361a7df80
|
||||
OptionSpec<Integer> optionspec11 = optionparser.accepts("port").withRequiredArg().ofType(Integer.class).defaultsTo(-1, new Integer[0]);
|
||||
OptionSpec<String> optionspec12 = optionparser.accepts("serverId").withRequiredArg();
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 7ba86703433322e2b166cc263cedd6e7310d36a4..26841729126b022f75e55e584fe850771dedd4cd 100644
|
||||
index fc3d65885cc704f807ddcb07561b4a529827166c..ed25891919bbd372b042f343d3b3360fb1654ca3 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1412,8 +1412,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1371,8 +1371,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
try {
|
||||
BufferedImage bufferedimage = ImageIO.read(file);
|
||||
|
||||
@@ -234,10 +232,10 @@ index 7ba86703433322e2b166cc263cedd6e7310d36a4..26841729126b022f75e55e584fe85077
|
||||
|
||||
ImageIO.write(bufferedimage, "PNG", bytearrayoutputstream);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index d52072ab126f2fdee30bb114f3058338edd72fd5..44560edcf339c1749b9df78e6e57075499d5813d 100644
|
||||
index 1eb912ad97f9663bf6bd336ad739f2552b0a5c9b..9901ffe9de585a73e9ef32c700b1e8702f8786d3 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -314,7 +314,7 @@ public class ServerEntity {
|
||||
@@ -303,7 +303,7 @@ public class ServerEntity {
|
||||
|
||||
if (this.entity instanceof LivingEntity) {
|
||||
List<Pair<EquipmentSlot, ItemStack>> list = Lists.newArrayList();
|
||||
@@ -247,19 +245,19 @@ index d52072ab126f2fdee30bb114f3058338edd72fd5..44560edcf339c1749b9df78e6e570754
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 93c1f9e3e9d62cc993fedb93fe43cbeed7d39542..da6156f1d61ca20fd39f35da36c64afe62b2731b 100644
|
||||
index d0cfbaf3fd5573f33ad3afc47a35157c0da5233a..1936cd779223f0ca7f6fa266725560fef40c3653 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -851,7 +851,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -871,7 +871,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
BlockPos blockposition2 = blockposition.set(j + randomX, randomY, k + randomZ);
|
||||
BlockState iblockdata = com.destroystokyo.paper.util.maplist.IBlockDataList.getBlockDataFromRaw(raw);
|
||||
|
||||
- iblockdata.randomTick(this, blockposition2, this.randomTickRandom);
|
||||
+ iblockdata.randomTick(this, blockposition2.immutable(), this.randomTickRandom); // JettPack - reduce allocs
|
||||
+ iblockdata.randomTick(this, blockposition2.immutable(), this.randomTickRandom); // JettPack
|
||||
// We drop the fluid tick since LAVA is ALREADY TICKED by the above method (See LiquidBlock).
|
||||
// TODO CHECK ON UPDATE
|
||||
}
|
||||
@@ -1106,7 +1106,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1126,7 +1126,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
public static List<Entity> getCurrentlyTickingEntities() {
|
||||
Entity ticking = currentlyTickingEntity.get();
|
||||
@@ -269,87 +267,77 @@ index 93c1f9e3e9d62cc993fedb93fe43cbeed7d39542..da6156f1d61ca20fd39f35da36c64afe
|
||||
return ret;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 676f2cd4b152984aa76903fcf4377c745775bfc8..f0e7c7c84052f29349b60ad06ec4f9ee1771f4bb 100644
|
||||
index 60373551c49386652de286127636b61f31e88527..ab084c7590ff777889dccbbb821bb099cdd7e215 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -359,7 +359,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -385,7 +385,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
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
|
||||
- this.disconnect(new TranslatableComponent("disconnect.timeout", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
|
||||
+ this.disconnect(new TranslatableComponent("disconnect.timeout", me.titaniumtown.Constants.EMPTY_object_arr), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause // JettPack
|
||||
- this.disconnect(Component.translatable("disconnect.timeout", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
|
||||
+ this.disconnect(Component.translatable("disconnect.timeout", me.titaniumtown.Constants.EMPTY_object_arr), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause // JettPack
|
||||
}
|
||||
} else {
|
||||
if (elapsedTime >= 15000L) { // 15 seconds
|
||||
@@ -799,13 +799,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
// PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async
|
||||
@@ -831,13 +831,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
// PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // Paper - run this async
|
||||
// CraftBukkit start
|
||||
if (this.chatSpamTickCount.addAndGet(com.destroystokyo.paper.PaperConfig.tabSpamIncrement) > com.destroystokyo.paper.PaperConfig.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable
|
||||
- server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
|
||||
+ server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", me.titaniumtown.Constants.EMPTY_object_arr), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause // JettPack
|
||||
if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable
|
||||
- server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
|
||||
+ server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", me.titaniumtown.Constants.EMPTY_object_arr), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause // JettPack
|
||||
return;
|
||||
}
|
||||
// Paper start
|
||||
String str = packet.getCommand(); int index = -1;
|
||||
if (str.length() > 64 && ((index = str.indexOf(' ')) == -1 || index >= 64)) {
|
||||
- server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
|
||||
+ server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", me.titaniumtown.Constants.EMPTY_object_arr), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause // JettPack
|
||||
- server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
|
||||
+ server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", me.titaniumtown.Constants.EMPTY_object_arr), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause // JettPack
|
||||
return;
|
||||
}
|
||||
// Paper end
|
||||
@@ -2952,7 +2952,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -3138,7 +3138,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
// Paper start
|
||||
if (!org.bukkit.Bukkit.isPrimaryThread()) {
|
||||
if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) {
|
||||
- server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
|
||||
+ server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", me.titaniumtown.Constants.EMPTY_object_arr), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause // JettPack
|
||||
if (recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
|
||||
- server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
|
||||
+ server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", me.titaniumtown.Constants.EMPTY_object_arr), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause // JettPack
|
||||
return;
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index befcb501b4b1b6330bf3cd53e00e30b01efade6f..0c4e34c02060c00bdbed6388989660ec023b4d1c 100644
|
||||
index 039b47e19d672ec9066c41fcc6342523992bf7b6..9903316fe3164a987a7745104c2f1875ca0c0a47 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -249,9 +249,9 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
|
||||
@@ -285,8 +285,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
|
||||
|
||||
@Override
|
||||
public void handleHello(ServerboundHelloPacket packet) {
|
||||
- Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", new Object[0]);
|
||||
- Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(packet.name()), "Invalid characters in username", new Object[0]);
|
||||
+ Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", me.titaniumtown.Constants.EMPTY_object_arr); // JettPack
|
||||
this.gameProfile = packet.getGameProfile();
|
||||
- Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(this.gameProfile.getName()), "Invalid characters in username", new Object[0]);
|
||||
+ Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(this.gameProfile.getName()), "Invalid characters in username", me.titaniumtown.Constants.EMPTY_object_arr); // JettPack
|
||||
+ Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(packet.name()), "Invalid characters in username", me.titaniumtown.Constants.EMPTY_object_arr); // JettPack
|
||||
// Paper start - validate usernames
|
||||
if (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode() && com.destroystokyo.paper.PaperConfig.performUsernameValidation) {
|
||||
if (!this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation && !validateUsername(this.gameProfile.getName())) {
|
||||
@@ -300,7 +300,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
|
||||
if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation) {
|
||||
if (!this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation && !validateUsername(packet.name())) {
|
||||
@@ -356,7 +356,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
|
||||
|
||||
@Override
|
||||
public void handleKey(ServerboundKeyPacket packet) {
|
||||
- Validate.validState(this.state == ServerLoginPacketListenerImpl.State.KEY, "Unexpected key packet", new Object[0]);
|
||||
+ Validate.validState(this.state == ServerLoginPacketListenerImpl.State.KEY, "Unexpected key packet", me.titaniumtown.Constants.EMPTY_object_arr); // JettPack
|
||||
PrivateKey privatekey = this.server.getKeyPair().getPrivate();
|
||||
|
||||
final String s;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 624946f48f0811c94d05174f28d0b1fc6d5e6a00..49e27efb5fdf26f6a8026c8c17e25d87026ab45d 100644
|
||||
index 20cdfdb3b9351f74e89bc45b3ab972384165659a..4030818ff51eca95e1c2ec38c7eca5bff79a0a4a 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -316,7 +316,7 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
void disconnectPendingPlayer(ServerPlayer entityplayer) {
|
||||
- TranslatableComponent msg = new TranslatableComponent("multiplayer.disconnect.duplicate_login", new Object[0]);
|
||||
+ TranslatableComponent msg = new TranslatableComponent("multiplayer.disconnect.duplicate_login", me.titaniumtown.Constants.EMPTY_object_arr); // JettPack
|
||||
entityplayer.networkManager.send(new ClientboundDisconnectPacket(msg), (future) -> {
|
||||
entityplayer.networkManager.disconnect(msg);
|
||||
entityplayer.networkManager = null;
|
||||
@@ -731,7 +731,7 @@ public abstract class PlayerList {
|
||||
@@ -734,7 +734,7 @@ public abstract class PlayerList {
|
||||
while (iterator.hasNext()) {
|
||||
entityplayer = (ServerPlayer) iterator.next();
|
||||
this.save(entityplayer); // CraftBukkit - Force the player's inventory to be saved
|
||||
- entityplayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.duplicate_login", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.DUPLICATE_LOGIN); // Paper - kick event cause
|
||||
+ entityplayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.duplicate_login", me.titaniumtown.Constants.EMPTY_object_arr), org.bukkit.event.player.PlayerKickEvent.Cause.DUPLICATE_LOGIN); // Paper - kick event cause // JettPack
|
||||
- entityplayer.connection.disconnect(Component.translatable("multiplayer.disconnect.duplicate_login", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.DUPLICATE_LOGIN); // Paper - kick event cause
|
||||
+ entityplayer.connection.disconnect(Component.translatable("multiplayer.disconnect.duplicate_login", me.titaniumtown.Constants.EMPTY_object_arr), org.bukkit.event.player.PlayerKickEvent.Cause.DUPLICATE_LOGIN); // Paper - kick event cause // JettPack
|
||||
}
|
||||
|
||||
// Instead of kicking then returning, we need to store the kick reason
|
||||
@@ -367,7 +355,7 @@ index 4fd709a550bf8da1e996894a1ca6b91206c31e9e..63c0fe30ff035b6b5c1b4b35d3ad6c64
|
||||
|
||||
// CraftBukkit start
|
||||
diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java
|
||||
index eec830f9924f1458e9d3035192408f31a0b87871..225324615cc5d20b928714695f62adee91f43c5a 100644
|
||||
index 5d8e9bdf5538b19681f21949368d862fab8a89ad..97c744508cc535418eba65fa722859c81c22d647 100644
|
||||
--- a/src/main/java/net/minecraft/util/ZeroBitStorage.java
|
||||
+++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java
|
||||
@@ -5,7 +5,7 @@ import java.util.function.IntConsumer;
|
||||
@@ -380,23 +368,22 @@ index eec830f9924f1458e9d3035192408f31a0b87871..225324615cc5d20b928714695f62adee
|
||||
|
||||
public ZeroBitStorage(int size) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EquipmentSlot.java b/src/main/java/net/minecraft/world/entity/EquipmentSlot.java
|
||||
index b68e7db2fbb085c2b25af3e93d501fbaac98893b..d7d39f11fdf4646a78868c22310e77fc4e86ea06 100644
|
||||
index c82bb38b5b1c9204daef21455723d21509ad1c44..4aa044ab8748c01b0022096733e5bacf7220510a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EquipmentSlot.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EquipmentSlot.java
|
||||
@@ -13,6 +13,8 @@ public enum EquipmentSlot {
|
||||
@@ -12,6 +12,7 @@ public enum EquipmentSlot {
|
||||
private final int index;
|
||||
private final int filterFlag;
|
||||
private final String name;
|
||||
+ public static final EquipmentSlot[] VALUES = EquipmentSlot.values(); // JettPack
|
||||
|
||||
+ public static final EquipmentSlot[] VALUES = EquipmentSlot.values(); // JettPack - reduce allocs
|
||||
+
|
||||
private EquipmentSlot(EquipmentSlot.Type type, int entityId, int armorStandId, String name) {
|
||||
this.type = type;
|
||||
this.index = entityId;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 2fe2307a10cb2e4e2b055cbe615b3750bf8fd310..f646545ee7178717c1e3bb48e98fd2af2af745e0 100644
|
||||
index 8a9b6cacfb87d4ba825f3386894c25631ecbb1f7..d8f7361960eff24022a15505dec00613310db3b0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3032,7 +3032,7 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -3064,7 +3064,7 @@ public abstract class LivingEntity extends Entity {
|
||||
@Nullable
|
||||
private Map<EquipmentSlot, ItemStack> collectEquipmentChanges() {
|
||||
Map<EquipmentSlot, ItemStack> map = null;
|
||||
@@ -406,68 +393,68 @@ index 2fe2307a10cb2e4e2b055cbe615b3750bf8fd310..f646545ee7178717c1e3bb48e98fd2af
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 8ee0a80e3427ecef9fa15b7388a8287e26a25fd6..340589e02b316553acefee480f86cf53d5d17560 100644
|
||||
index e8e60ea8b9e97ed87be78752f398ab25ba8e9a1b..9980df9128dfc51f2afbca8f4aa2031e3728796a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -1010,7 +1010,7 @@ public abstract class Mob extends LivingEntity {
|
||||
@@ -1021,7 +1021,7 @@ public abstract class Mob extends LivingEntity {
|
||||
@Override
|
||||
protected void dropCustomDeathLoot(DamageSource source, int lootingMultiplier, boolean allowDrops) {
|
||||
super.dropCustomDeathLoot(source, lootingMultiplier, allowDrops);
|
||||
- EquipmentSlot[] aenumitemslot = EquipmentSlot.values();
|
||||
+ EquipmentSlot[] aenumitemslot = EquipmentSlot.VALUES; // JettPack - reduce allocs
|
||||
+ EquipmentSlot[] aenumitemslot = EquipmentSlot.VALUES; // JettPack
|
||||
int j = aenumitemslot.length;
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
@@ -1072,7 +1072,7 @@ public abstract class Mob extends LivingEntity {
|
||||
@@ -1083,7 +1083,7 @@ public abstract class Mob extends LivingEntity {
|
||||
}
|
||||
|
||||
boolean flag = true;
|
||||
- EquipmentSlot[] aenumitemslot = EquipmentSlot.values();
|
||||
+ EquipmentSlot[] aenumitemslot = EquipmentSlot.VALUES; // JettPack - reduce allocs
|
||||
+ EquipmentSlot[] aenumitemslot = EquipmentSlot.VALUES; // JettPack
|
||||
int j = aenumitemslot.length;
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
@@ -1159,7 +1159,7 @@ public abstract class Mob extends LivingEntity {
|
||||
float f = difficulty.getSpecialMultiplier();
|
||||
@@ -1170,7 +1170,7 @@ public abstract class Mob extends LivingEntity {
|
||||
float f = localDifficulty.getSpecialMultiplier();
|
||||
|
||||
this.enchantSpawnedWeapon(f);
|
||||
this.enchantSpawnedWeapon(random, f);
|
||||
- EquipmentSlot[] aenumitemslot = EquipmentSlot.values();
|
||||
+ EquipmentSlot[] aenumitemslot = EquipmentSlot.VALUES; // JettPack - reduce allocs
|
||||
+ EquipmentSlot[] aenumitemslot = EquipmentSlot.VALUES; // JettPack
|
||||
int i = aenumitemslot.length;
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
@@ -1370,7 +1370,7 @@ public abstract class Mob extends LivingEntity {
|
||||
@@ -1384,7 +1384,7 @@ public abstract class Mob extends LivingEntity {
|
||||
t0.setInvulnerable(this.isInvulnerable());
|
||||
if (flag) {
|
||||
t0.setCanPickUpLoot(this.canPickUpLoot());
|
||||
- EquipmentSlot[] aenumitemslot = EquipmentSlot.values();
|
||||
+ EquipmentSlot[] aenumitemslot = EquipmentSlot.VALUES; // JettPack - reduce allocs
|
||||
+ EquipmentSlot[] aenumitemslot = EquipmentSlot.VALUES; // JettPack
|
||||
int i = aenumitemslot.length;
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
index fc6639bd33a13c84c84603db7f9bbb1c5df239a4..814e5abe38087f6ca3322923564b59fb31b2bc83 100644
|
||||
index 7fe5908020c4577c1e4d6c00af382cf536351d96..5bad71b56b45085c01ae2b0ab95067c85cad1f61 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
@@ -229,7 +229,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
|
||||
@@ -227,7 +227,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
- EquipmentSlot[] aenumitemslot = EquipmentSlot.values();
|
||||
+ EquipmentSlot[] aenumitemslot = EquipmentSlot.VALUES; // JettPack - reduce allocs
|
||||
+ EquipmentSlot[] aenumitemslot = EquipmentSlot.VALUES; // JettPack
|
||||
int i = aenumitemslot.length;
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 6837c965592d4584cfc958a1008b98791a0fc780..586ce0bec1ab2a17a3818690e47be23643cd5a48 100644
|
||||
index 6b3cfc19c4fd1382ddf534265a1114995a4f6b55..24cf8fba9515dfbeb1422e69968c085f1d4f8f6e 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -957,7 +957,7 @@ public final class ItemStack {
|
||||
@@ -969,7 +969,7 @@ public final class ItemStack {
|
||||
int k;
|
||||
|
||||
if (ItemStack.shouldShowInTooltip(i, ItemStack.TooltipPart.MODIFIERS)) {
|
||||
- EquipmentSlot[] aenumitemslot = EquipmentSlot.values();
|
||||
+ EquipmentSlot[] aenumitemslot = EquipmentSlot.VALUES; // JettPack - reduce allocs
|
||||
+ EquipmentSlot[] aenumitemslot = EquipmentSlot.VALUES; // JettPack
|
||||
|
||||
k = aenumitemslot.length;
|
||||
|
||||
@@ -485,10 +472,10 @@ index 9e3f9099cc47e6c6e40d11ef6d6e83fbf19a3cf7..b9c1db394ee35ed1acead620f7e9e47c
|
||||
String[] astring1 = new String[pattern.length - l - k];
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/enchantment/Enchantments.java b/src/main/java/net/minecraft/world/item/enchantment/Enchantments.java
|
||||
index ef36f0a9b1849dd3152c0a1c81cded5c4f06aa3c..946bb3c6a59d0e611d28549ceee8946b46eaa9e3 100644
|
||||
index 1367908a54e1c1703d14b3c25852da5ec1b02019..be33c4c28bbc0bf80cbf2921664fcc4aaa465950 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/enchantment/Enchantments.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/enchantment/Enchantments.java
|
||||
@@ -42,8 +42,8 @@ public class Enchantments {
|
||||
@@ -43,8 +43,8 @@ public class Enchantments {
|
||||
public static final Enchantment MULTISHOT = Enchantments.register("multishot", new MultiShotEnchantment(Enchantment.Rarity.RARE, new EquipmentSlot[]{EquipmentSlot.MAINHAND}));
|
||||
public static final Enchantment QUICK_CHARGE = Enchantments.register("quick_charge", new QuickChargeEnchantment(Enchantment.Rarity.UNCOMMON, new EquipmentSlot[]{EquipmentSlot.MAINHAND}));
|
||||
public static final Enchantment PIERCING = Enchantments.register("piercing", new ArrowPiercingEnchantment(Enchantment.Rarity.COMMON, new EquipmentSlot[]{EquipmentSlot.MAINHAND}));
|
||||
@@ -500,7 +487,7 @@ index ef36f0a9b1849dd3152c0a1c81cded5c4f06aa3c..946bb3c6a59d0e611d28549ceee8946b
|
||||
// CraftBukkit start
|
||||
static {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java b/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java
|
||||
index 4257e5bf92a219f20026e4ec7e0d7323f2adf30e..24612061174b659666e3c09a44ddc597b34f549a 100644
|
||||
index 2f9f15d99f8b31e9f13f7f32378b2a9e09bcb5e5..b9579e3d1610ddcb5251baa2dd9462e0557c4cf4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java
|
||||
@@ -15,9 +15,17 @@ public class EntityBasedExplosionDamageCalculator extends ExplosionDamageCalcula
|
||||
@@ -525,10 +512,10 @@ index 4257e5bf92a219f20026e4ec7e0d7323f2adf30e..24612061174b659666e3c09a44ddc597
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index b830c2199a22252116619520f407fd84eddb28f3..5df2601aecb93fd6014b70d0da645085ddec8076 100644
|
||||
index a26799f92db1699d2d5173e2e93be29273e1a317..a4e29b171a4f47bafdc9ff278ca00a071b4269c0 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -1566,7 +1566,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1522,7 +1522,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public org.bukkit.entity.Entity[] getChunkEntities(int chunkX, int chunkZ) {
|
||||
io.papermc.paper.world.ChunkEntitySlices slices = this.entitySliceManager.getChunk(chunkX, chunkZ);
|
||||
if (slices == null) {
|
||||
@@ -538,10 +525,10 @@ index b830c2199a22252116619520f407fd84eddb28f3..5df2601aecb93fd6014b70d0da645085
|
||||
return slices.getChunkEntities();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
|
||||
index fb8b8a9733ac50096d8406487ab1ae167ef5f7b1..644714723911d950fb179216c4976baa2da85644 100644
|
||||
index 2b1983d61fd3ed856770146de5cdfd33b4f63a46..c7ca1390bc8becb46dd843a4e1006af99b8639bb 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
|
||||
@@ -373,7 +373,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
||||
@@ -376,7 +376,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(Direction side) {
|
||||
@@ -550,7 +537,7 @@ index fb8b8a9733ac50096d8406487ab1ae167ef5f7b1..644714723911d950fb179216c4976baa
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -422,7 +422,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
||||
@@ -425,7 +425,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(Direction side) {
|
||||
@@ -559,7 +546,7 @@ index fb8b8a9733ac50096d8406487ab1ae167ef5f7b1..644714723911d950fb179216c4976baa
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -459,7 +459,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
||||
@@ -462,7 +462,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(Direction side) {
|
||||
@@ -568,6 +555,19 @@ index fb8b8a9733ac50096d8406487ab1ae167ef5f7b1..644714723911d950fb179216c4976baa
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
index 4977f3fad3bfc12fd4c5f9fbe8beea2895247c57..f86ac933490d50179e09fa61e2f6e5af339249c3 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
@@ -64,7 +64,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
protected static final int SLOT_FUEL = 1;
|
||||
protected static final int SLOT_RESULT = 2;
|
||||
public static final int DATA_LIT_TIME = 0;
|
||||
- private static final int[] SLOTS_FOR_UP = new int[]{0};
|
||||
+ private static final int[] SLOTS_FOR_UP = me.titaniumtown.Constants.ZERO_int_arr; // JettPack
|
||||
private static final int[] SLOTS_FOR_DOWN = new int[]{2, 1};
|
||||
private static final int[] SLOTS_FOR_SIDES = new int[]{1};
|
||||
public static final int DATA_LIT_DURATION = 1;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
index 601f8099f74e81c17600566b3c9b7a6dd39c9bcb..f816fae46568b83ef4441bd3bb06f2081308921e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
@@ -582,7 +582,7 @@ index 601f8099f74e81c17600566b3c9b7a6dd39c9bcb..f816fae46568b83ef4441bd3bb06f208
|
||||
|
||||
for (int i = 0; i < astring.length; ++i) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftEquipmentSlot.java b/src/main/java/org/bukkit/craftbukkit/CraftEquipmentSlot.java
|
||||
index e91714a66f582c14184ddb5e4bf2443d3ed45efb..174585c55450d6005c822801b0ce43b29091fc64 100644
|
||||
index e91714a66f582c14184ddb5e4bf2443d3ed45efb..375107cbc51b907342379bb5539500d76fb76a92 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftEquipmentSlot.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftEquipmentSlot.java
|
||||
@@ -4,8 +4,8 @@ import org.bukkit.inventory.EquipmentSlot;
|
||||
@@ -591,13 +591,13 @@ index e91714a66f582c14184ddb5e4bf2443d3ed45efb..174585c55450d6005c822801b0ce43b2
|
||||
|
||||
- private static final net.minecraft.world.entity.EquipmentSlot[] slots = new net.minecraft.world.entity.EquipmentSlot[EquipmentSlot.values().length];
|
||||
- private static final EquipmentSlot[] enums = new EquipmentSlot[net.minecraft.world.entity.EquipmentSlot.values().length];
|
||||
+ private static final net.minecraft.world.entity.EquipmentSlot[] slots = net.minecraft.world.entity.EquipmentSlot.VALUES;
|
||||
+ private static final EquipmentSlot[] enums = new EquipmentSlot[net.minecraft.world.entity.EquipmentSlot.VALUES.length];
|
||||
+ private static final net.minecraft.world.entity.EquipmentSlot[] slots = net.minecraft.world.entity.EquipmentSlot.VALUES; // JettPack
|
||||
+ private static final EquipmentSlot[] enums = new EquipmentSlot[net.minecraft.world.entity.EquipmentSlot.VALUES.length]; // JettPack
|
||||
|
||||
static {
|
||||
set(EquipmentSlot.HAND, net.minecraft.world.entity.EquipmentSlot.MAINHAND);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java
|
||||
index 6827979a5b270ced53b46ecb9eff548727dadb81..d42175344699d3742c17e658aa689755813ec0ac 100644
|
||||
index 6827979a5b270ced53b46ecb9eff548727dadb81..4b42ae96bc786d2a9d57086ae8d1f5cadc70f2bb 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java
|
||||
@@ -165,7 +165,7 @@ public class CraftEntityEquipment implements EntityEquipment {
|
||||
@@ -605,12 +605,12 @@ index 6827979a5b270ced53b46ecb9eff548727dadb81..d42175344699d3742c17e658aa689755
|
||||
@Override
|
||||
public void clear() {
|
||||
- for (net.minecraft.world.entity.EquipmentSlot slot : net.minecraft.world.entity.EquipmentSlot.values()) {
|
||||
+ for (net.minecraft.world.entity.EquipmentSlot slot : net.minecraft.world.entity.EquipmentSlot.VALUES) {
|
||||
+ for (net.minecraft.world.entity.EquipmentSlot slot : net.minecraft.world.entity.EquipmentSlot.VALUES) { // JettPack
|
||||
this.setEquipment(slot, null, false);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java b/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java
|
||||
index 049d750d3af991dd14ac8cf644330404e74b2151..f965d6751c8f5a8ec4b26e6ac65414540345b04a 100644
|
||||
index 049d750d3af991dd14ac8cf644330404e74b2151..2f69484a8970f78c11f8fbb187e7a9f8f0fb994d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java
|
||||
@@ -166,7 +166,7 @@ public final class WeakCollection<T> implements Collection<T> {
|
||||
@@ -618,7 +618,7 @@ index 049d750d3af991dd14ac8cf644330404e74b2151..f965d6751c8f5a8ec4b26e6ac6541454
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
- return this.toArray(new Object[0]);
|
||||
+ return this.toArray(me.titaniumtown.Constants.EMPTY_object_arr);
|
||||
+ return this.toArray(me.titaniumtown.Constants.EMPTY_object_arr); // JettPack
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,76 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?=
|
||||
<tsao-chi@the-lingo.org>
|
||||
Date: Fri, 10 Apr 2020 15:47:15 +0800
|
||||
Subject: [PATCH] Swaps the predicate order of collision
|
||||
|
||||
Original code by Akarin-project, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://github.com/Akarin-project/Akarin
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index c9e23c09bc9db25a813e703817d51e1763b0b3b6..38cb136d34cbc83dde1c766196f60a30d38005e3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1869,37 +1869,35 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
public void playerTouch(Player player) {}
|
||||
|
||||
public void push(Entity entity) {
|
||||
- if (!this.isPassengerOfSameVehicle(entity)) {
|
||||
- if (!entity.noPhysics && !this.noPhysics) {
|
||||
- if (this.level.paperConfig.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper
|
||||
- double d0 = entity.getX() - this.getX();
|
||||
- double d1 = entity.getZ() - this.getZ();
|
||||
- double d2 = Mth.absMax(d0, d1);
|
||||
-
|
||||
- if (d2 >= 0.009999999776482582D) {
|
||||
- d2 = Math.sqrt(d2);
|
||||
- d0 /= d2;
|
||||
- d1 /= d2;
|
||||
- double d3 = 1.0D / d2;
|
||||
-
|
||||
- if (d3 > 1.0D) {
|
||||
- d3 = 1.0D;
|
||||
- }
|
||||
-
|
||||
- d0 *= d3;
|
||||
- d1 *= d3;
|
||||
- d0 *= 0.05000000074505806D;
|
||||
- d1 *= 0.05000000074505806D;
|
||||
- if (!this.isVehicle()) {
|
||||
- this.push(-d0, 0.0D, -d1);
|
||||
- }
|
||||
+ if (!entity.noPhysics && !this.noPhysics && !this.isPassengerOfSameVehicle(entity)) { // Akarin - Swap the predicate order of collision
|
||||
+ if (this.level.paperConfig.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper
|
||||
+ double d0 = entity.getX() - this.getX();
|
||||
+ double d1 = entity.getZ() - this.getZ();
|
||||
+ double d2 = Mth.absMax(d0, d1);
|
||||
+
|
||||
+ if (d2 >= 0.009999999776482582D) {
|
||||
+ d2 = Math.sqrt(d2);
|
||||
+ d0 /= d2;
|
||||
+ d1 /= d2;
|
||||
+ double d3 = 1.0D / d2;
|
||||
+
|
||||
+ if (d3 > 1.0D) {
|
||||
+ d3 = 1.0D;
|
||||
+ }
|
||||
|
||||
- if (!entity.isVehicle()) {
|
||||
- entity.push(d0, 0.0D, d1);
|
||||
- }
|
||||
+ d0 *= d3;
|
||||
+ d1 *= d3;
|
||||
+ d0 *= 0.05000000074505806D;
|
||||
+ d1 *= 0.05000000074505806D;
|
||||
+ if (!this.isVehicle()) {
|
||||
+ this.push(-d0, 0.0D, -d1);
|
||||
}
|
||||
|
||||
+ if (!entity.isVehicle()) {
|
||||
+ entity.push(d0, 0.0D, d1);
|
||||
+ }
|
||||
}
|
||||
+
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,40 +7,32 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java
|
||||
index a75a7a83bea89db4e4a4ca1c06233b3f4350fa73..4be4d9e6611dc3b7a34dbf2f5d6990bc0980ee63 100644
|
||||
index a3bbebcdaea9e0dfddd9825272f84fc76cd13e89..ee725b972d3d5fb22538aaff9c72e47c6bad0cea 100644
|
||||
--- a/src/main/java/net/minecraft/core/Direction.java
|
||||
+++ b/src/main/java/net/minecraft/core/Direction.java
|
||||
@@ -191,7 +191,7 @@ public enum Direction implements StringRepresentable {
|
||||
@@ -196,7 +196,7 @@ public enum Direction implements StringRepresentable {
|
||||
}
|
||||
|
||||
public Direction getOpposite() {
|
||||
- return from3DDataValue(this.oppositeIndex);
|
||||
+ return VALUES[this.oppositeIndex]; // JettPack - lithium: fast_util
|
||||
+ return VALUES[this.oppositeIndex]; // JettPack - lithium: fast util
|
||||
}
|
||||
|
||||
public Direction getClockWise(Direction.Axis axis) {
|
||||
@@ -441,7 +441,7 @@ public enum Direction implements StringRepresentable {
|
||||
@@ -446,7 +446,7 @@ public enum Direction implements StringRepresentable {
|
||||
}
|
||||
|
||||
public static Direction getRandom(Random random) {
|
||||
public static Direction getRandom(RandomSource random) {
|
||||
- return Util.getRandom(VALUES, random);
|
||||
+ return VALUES[random.nextInt(VALUES.length)]; // JettPack - lithium: fast_util
|
||||
+ return VALUES[random.nextInt(VALUES.length)]; // JettPack - lithium: fast util
|
||||
}
|
||||
|
||||
public static Direction getNearest(double x, double y, double z) {
|
||||
diff --git a/src/main/java/net/minecraft/world/phys/AABB.java b/src/main/java/net/minecraft/world/phys/AABB.java
|
||||
index 0d24ed60976d862c14cca4af0f6efc15f7c52c7e..9c1e6287b290df11072e1d7b892e77ae10c95af1 100644
|
||||
index 68cc6f2a78a06293a29317fda72ab3ee79b3533a..c5ff387a78693b0d5b18653dae67eb4a03324ff7 100644
|
||||
--- a/src/main/java/net/minecraft/world/phys/AABB.java
|
||||
+++ b/src/main/java/net/minecraft/world/phys/AABB.java
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
+import net.minecraft.core.Direction; // JettPack
|
||||
|
||||
public class AABB {
|
||||
private static final double EPSILON = 1.0E-7D;
|
||||
@@ -16,6 +17,15 @@ public class AABB {
|
||||
@@ -16,6 +16,15 @@ public class AABB {
|
||||
public final double maxY;
|
||||
public final double maxZ;
|
||||
|
||||
@@ -56,7 +48,7 @@ index 0d24ed60976d862c14cca4af0f6efc15f7c52c7e..9c1e6287b290df11072e1d7b892e77ae
|
||||
public AABB(double x1, double y1, double z1, double x2, double y2, double z2) {
|
||||
this.minX = Math.min(x1, x2);
|
||||
this.minY = Math.min(y1, y2);
|
||||
@@ -81,11 +91,33 @@ public class AABB {
|
||||
@@ -81,11 +90,33 @@ public class AABB {
|
||||
}
|
||||
|
||||
public double min(Direction.Axis axis) {
|
||||
@@ -1,37 +1,36 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: JellySquid <jellysquid+atwork@protonmail.com>
|
||||
Date: Fri, 31 Jul 2020 21:46:32 -0500
|
||||
Subject: [PATCH] lithium: HashedList
|
||||
Subject: [PATCH] lithium: HashedReferenceList
|
||||
|
||||
Original code by CaffeineMC, licensed under GNU Lesser General Public License v3.0
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedList.java b/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedList.java
|
||||
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedReferenceList.java b/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedReferenceList.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2d79932dbd1fc386a94b8d6ea3526934c54c2aad
|
||||
index 0000000000000000000000000000000000000000..4128567173d3985257a1bdd4412c7db0ff81535d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedList.java
|
||||
@@ -0,0 +1,280 @@
|
||||
+++ b/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedReferenceList.java
|
||||
@@ -0,0 +1,281 @@
|
||||
+package me.jellysquid.mods.lithium.common.util.collections;
|
||||
+
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
|
||||
+import it.unimi.dsi.fastutil.objects.ReferenceArrayList;
|
||||
+import java.util.Collection;
|
||||
+import java.util.Iterator;
|
||||
+import java.util.List;
|
||||
+import java.util.ListIterator;
|
||||
+import java.util.NoSuchElementException;
|
||||
+import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.*;
|
||||
+
|
||||
+/**
|
||||
+ * Wraps a {@link List} with a hash table which provides O(1) lookups for {@link Collection#contains(Object)}. The type
|
||||
+ * contained by this list must use reference-equality semantics.
|
||||
+ */
|
||||
+@SuppressWarnings("SuspiciousMethodCalls")
|
||||
+public class HashedList<T> implements List<T> {
|
||||
+public class HashedReferenceList<T> implements List<T> {
|
||||
+ private final ReferenceArrayList<T> list;
|
||||
+ private final Reference2IntOpenHashMap<T> counter;
|
||||
+
|
||||
+ public HashedList(List<T> list) {
|
||||
+ public HashedReferenceList(List<T> list) {
|
||||
+ this.list = new ReferenceArrayList<>();
|
||||
+ this.list.addAll(list);
|
||||
+
|
||||
@@ -70,7 +69,7 @@ index 0000000000000000000000000000000000000000..2d79932dbd1fc386a94b8d6ea3526934
|
||||
+
|
||||
+ @SuppressWarnings("SuspiciousToArrayCall")
|
||||
+ @Override
|
||||
+ public <T1> T1[] toArray(T1[] a) {
|
||||
+ public <T1> T1[] toArray(T1 @NotNull [] a) {
|
||||
+ return this.list.toArray(a);
|
||||
+ }
|
||||
+
|
||||
@@ -118,16 +117,18 @@ index 0000000000000000000000000000000000000000..2d79932dbd1fc386a94b8d6ea3526934
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean removeAll(Collection<?> c) {
|
||||
+ for (Object obj : c) {
|
||||
+ this.trackReferenceRemoved(obj);
|
||||
+ public boolean removeAll(@NotNull Collection<?> c) {
|
||||
+ if (this.size() >= 2 && c.size() > 4 && c instanceof List) {
|
||||
+ //HashReferenceList uses reference equality, so using ReferenceOpenHashSet is fine
|
||||
+ c = new ReferenceOpenHashSet<>(c);
|
||||
+ }
|
||||
+
|
||||
+ this.counter.keySet().removeAll(c);
|
||||
+ return this.list.removeAll(c);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean retainAll(Collection<?> c) {
|
||||
+ public boolean retainAll(@NotNull Collection<?> c) {
|
||||
+ this.counter.keySet().retainAll(c);
|
||||
+ return this.list.retainAll(c);
|
||||
+ }
|
||||
+
|
||||
@@ -192,8 +193,8 @@ index 0000000000000000000000000000000000000000..2d79932dbd1fc386a94b8d6ea3526934
|
||||
+
|
||||
+ @Override
|
||||
+ public ListIterator<T> listIterator(int index) {
|
||||
+ return new ListIterator<T>() {
|
||||
+ private final ListIterator<T> inner = HashedList.this.list.listIterator(index);
|
||||
+ return new ListIterator<>() {
|
||||
+ private final ListIterator<T> inner = HashedReferenceList.this.list.listIterator(index);
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean hasNext() {
|
||||
@@ -233,10 +234,10 @@ index 0000000000000000000000000000000000000000..2d79932dbd1fc386a94b8d6ea3526934
|
||||
+ throw new NoSuchElementException();
|
||||
+ }
|
||||
+
|
||||
+ T prev = HashedList.this.get(last);
|
||||
+ T prev = HashedReferenceList.this.get(last);
|
||||
+
|
||||
+ if (prev != null) {
|
||||
+ HashedList.this.trackReferenceRemoved(prev);
|
||||
+ HashedReferenceList.this.trackReferenceRemoved(prev);
|
||||
+ }
|
||||
+
|
||||
+ this.inner.remove();
|
||||
@@ -250,14 +251,14 @@ index 0000000000000000000000000000000000000000..2d79932dbd1fc386a94b8d6ea3526934
|
||||
+ throw new NoSuchElementException();
|
||||
+ }
|
||||
+
|
||||
+ T prev = HashedList.this.get(last);
|
||||
+ T prev = HashedReferenceList.this.get(last);
|
||||
+
|
||||
+ if (prev != t) {
|
||||
+ if (prev != null) {
|
||||
+ HashedList.this.trackReferenceRemoved(prev);
|
||||
+ HashedReferenceList.this.trackReferenceRemoved(prev);
|
||||
+ }
|
||||
+
|
||||
+ HashedList.this.trackReferenceAdded(t);
|
||||
+ HashedReferenceList.this.trackReferenceAdded(t);
|
||||
+ }
|
||||
+
|
||||
+ this.inner.remove();
|
||||
@@ -265,7 +266,7 @@ index 0000000000000000000000000000000000000000..2d79932dbd1fc386a94b8d6ea3526934
|
||||
+
|
||||
+ @Override
|
||||
+ public void add(T t) {
|
||||
+ HashedList.this.trackReferenceAdded(t);
|
||||
+ HashedReferenceList.this.trackReferenceAdded(t);
|
||||
+
|
||||
+ this.inner.add(t);
|
||||
+ }
|
||||
@@ -288,22 +289,24 @@ index 0000000000000000000000000000000000000000..2d79932dbd1fc386a94b8d6ea3526934
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static <T> HashedList<T> wrapper(List<T> list) {
|
||||
+ return new HashedList<>(list);
|
||||
+ public static <T> HashedReferenceList<T> wrapper(List<T> list) {
|
||||
+ return new HashedReferenceList<>(list);
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 5df2601aecb93fd6014b70d0da645085ddec8076..8fb58a59181fdf3a6ca5710d42eac060fc756395 100644
|
||||
index a4e29b171a4f47bafdc9ff278ca00a071b4269c0..c81520efe726efa7d6ac61c37f8eadc3cda5bc97 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -115,8 +115,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -117,9 +117,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public static final int TICKS_PER_DAY = 24000;
|
||||
public static final int MAX_ENTITY_SPAWN_Y = 20000000;
|
||||
public static final int MIN_ENTITY_SPAWN_Y = -20000000;
|
||||
- protected final List<TickingBlockEntity> blockEntityTickers = Lists.newArrayList(); public final int getTotalTileEntityTickers() { return this.blockEntityTickers.size(); } // Paper
|
||||
+ protected final List<TickingBlockEntity> blockEntityTickers = me.jellysquid.mods.lithium.common.util.collections.HashedReferenceList.wrapper(Lists.newArrayList()); public final int getTotalTileEntityTickers() { return this.blockEntityTickers.size(); } // Paper // Jettpack - lithium: HashedReferenceList
|
||||
protected final NeighborUpdater neighborUpdater;
|
||||
- private final List<TickingBlockEntity> pendingBlockEntityTickers = Lists.newArrayList();
|
||||
+ protected final List<TickingBlockEntity> blockEntityTickers = me.jellysquid.mods.lithium.common.util.collections.HashedList.wrapper(Lists.newArrayList()); public final int getTotalTileEntityTickers() { return this.blockEntityTickers.size(); } // Paper // Jettpack - lithium: hashed_list
|
||||
+ private final List<TickingBlockEntity> pendingBlockEntityTickers = me.jellysquid.mods.lithium.common.util.collections.HashedList.wrapper(Lists.newArrayList()); // Jettpack - lithium: hashed_list
|
||||
+ private final List<TickingBlockEntity> pendingBlockEntityTickers = me.jellysquid.mods.lithium.common.util.collections.HashedReferenceList.wrapper(Lists.newArrayList()); // Jettpack - lithium: HashedReferenceList
|
||||
private boolean tickingBlockEntities;
|
||||
public final Thread thread;
|
||||
private final boolean isDebug;
|
||||
@@ -104,40 +104,28 @@ index 0000000000000000000000000000000000000000..d2b00d9a91b60716d5f458048df3d944
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/util/Mth.java b/src/main/java/net/minecraft/util/Mth.java
|
||||
index 42e0c370092eb6c190dbf3b279649d47b81950af..23d4efac14b391a5f654013fc549c3274c160ffa 100644
|
||||
index 81c5cf66e15ca814be2d0a5a4798ac71732601c4..a4a6885bea59210192e8a2ce8834372275e7ceb3 100644
|
||||
--- a/src/main/java/net/minecraft/util/Mth.java
|
||||
+++ b/src/main/java/net/minecraft/util/Mth.java
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
+import me.jellysquid.mods.lithium.common.util.math.CompactSineLUT; // Mirai
|
||||
|
||||
public class Mth {
|
||||
private static final int BIG_ENOUGH_INT = 1024;
|
||||
@@ -30,7 +31,8 @@ public class Mth {
|
||||
}
|
||||
@@ -31,6 +31,7 @@ public class Mth {
|
||||
|
||||
});
|
||||
- private static final Random RANDOM = new Random();
|
||||
+ private static final Random RANDOM = new Random(); // Mirai - too lazy to edit correctly this line
|
||||
+ public static float[] getSinTable() { return SIN; } // Mirai
|
||||
private static final RandomSource RANDOM = RandomSource.createThreadSafe();
|
||||
+ public static float[] getSinTable() { return SIN; } // Mirai - lithium: CompactSineLUT
|
||||
private static final int[] MULTIPLY_DE_BRUIJN_BIT_POSITION = new int[]{0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9};
|
||||
private static final double ONE_SIXTH = 0.16666666666666666D;
|
||||
private static final int FRAC_EXP = 8;
|
||||
@@ -40,11 +42,13 @@ public class Mth {
|
||||
@@ -40,11 +41,11 @@ public class Mth {
|
||||
private static final double[] COS_TAB = new double[257];
|
||||
|
||||
public static float sin(float value) {
|
||||
- return SIN[(int)(value * 10430.378F) & '\uffff'];
|
||||
+ //return SIN[(int)(value * 10430.378F) & '\uffff'];
|
||||
+ return CompactSineLUT.sin(value); // Mirai
|
||||
+ return me.jellysquid.mods.lithium.common.util.math.CompactSineLUT.sin(value); // Mirai - lithium: CompactSineLUT
|
||||
}
|
||||
|
||||
public static float cos(float value) {
|
||||
- return SIN[(int)(value * 10430.378F + 16384.0F) & '\uffff'];
|
||||
+ //return SIN[(int)(value * 10430.378F + 16384.0F) & '\uffff'];
|
||||
+ return CompactSineLUT.cos(value); // Mirai
|
||||
+ return me.jellysquid.mods.lithium.common.util.math.CompactSineLUT.cos(value); // Mirai - lithium: CompactSineLUT
|
||||
}
|
||||
|
||||
public static float sqrt(float value) {
|
||||
102
patches/server/0008-lithium-fast-retrieval.patch
Normal file
102
patches/server/0008-lithium-fast-retrieval.patch
Normal file
@@ -0,0 +1,102 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: 2No2Name <2No2Name@web.de>
|
||||
Date: Wed, 15 Dec 2021 11:20:48 -0500
|
||||
Subject: [PATCH] lithium: fast retrieval
|
||||
|
||||
Original code by CaffeineMC, licensed under GNU Lesser General Public License v3.0
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java
|
||||
index f54ca6383298848b2ee7108c41fcea593f924881..ad12d9660cd57d147859a0e3e123c5b87c8e9748 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java
|
||||
@@ -33,7 +33,7 @@ public class EntitySectionStorage<T extends EntityAccess> {
|
||||
}
|
||||
|
||||
public void forEachAccessibleNonEmptySection(AABB box, Consumer<EntitySection<T>> action) {
|
||||
- int i = 2;
|
||||
+ // Mirai start - lithium: fast retrieval
|
||||
int j = SectionPos.posToSectionCoord(box.minX - 2.0D);
|
||||
int k = SectionPos.posToSectionCoord(box.minY - 4.0D);
|
||||
int l = SectionPos.posToSectionCoord(box.minZ - 2.0D);
|
||||
@@ -41,25 +41,67 @@ public class EntitySectionStorage<T extends EntityAccess> {
|
||||
int n = SectionPos.posToSectionCoord(box.maxY + 0.0D);
|
||||
int o = SectionPos.posToSectionCoord(box.maxZ + 2.0D);
|
||||
|
||||
- for(int p = j; p <= m; ++p) {
|
||||
- long q = SectionPos.asLong(p, 0, 0);
|
||||
- long r = SectionPos.asLong(p, -1, -1);
|
||||
- LongIterator longIterator = this.sectionIds.subSet(q, r + 1L).iterator();
|
||||
-
|
||||
- while(longIterator.hasNext()) {
|
||||
- long s = longIterator.nextLong();
|
||||
- int t = SectionPos.y(s);
|
||||
- int u = SectionPos.z(s);
|
||||
- if (t >= k && t <= n && u >= l && u <= o) {
|
||||
- EntitySection<T> entitySection = this.sections.get(s);
|
||||
- if (entitySection != null && !entitySection.isEmpty() && entitySection.getStatus().isAccessible()) {
|
||||
- action.accept(entitySection);
|
||||
+ if (m >= j + 4 || o >= l + 4) {
|
||||
+ // Vanilla is likely more optimized when shooting entities with TNT cannons over huge distances.
|
||||
+ // Choosing a cutoff of 4 chunk size, as it becomes more likely that these entity sections do not exist when
|
||||
+ // they are far away from the shot entity (player despawn range, position maybe not on the ground, etc)
|
||||
+ for (int p = j; p <= m; p++) {
|
||||
+ long q = SectionPos.asLong(p, 0, 0);
|
||||
+ long r = SectionPos.asLong(p, -1, -1);
|
||||
+ LongIterator longIterator = this.sectionIds.subSet(q, r + 1L).iterator();
|
||||
+
|
||||
+ while (longIterator.hasNext()) {
|
||||
+ long s = longIterator.nextLong();
|
||||
+ int t = SectionPos.y(s);
|
||||
+ int u = SectionPos.z(s);
|
||||
+ if (t >= k && t <= n && u >= l && u <= o) {
|
||||
+ EntitySection<T> entitySection = this.sections.get(s);
|
||||
+ if (entitySection != null && !entitySection.isEmpty() && entitySection.getStatus().isAccessible()) {
|
||||
+ action.accept(entitySection);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
+ } else {
|
||||
+ // Vanilla order of the AVL long set is sorting by ascending long value. The x, y, z positions are packed into
|
||||
+ // a long with the x position's lowest 22 bits placed at the MSB.
|
||||
+ // Therefore the long is negative iff the 22th bit of the x position is set, which happens iff the x position
|
||||
+ // is negative. A positive x position will never have its 22th bit set, as these big coordinates are far outside
|
||||
+ // the world. y and z positions are treated as unsigned when sorting by ascending long value, as their sign bits
|
||||
+ // are placed somewhere inside the packed long
|
||||
+ for (int x = j; x <= m; x++) {
|
||||
+ for (int z = Math.max(l, 0); z <= o; z++) {
|
||||
+ this.forEachInColumn(x, k, n, z, action);
|
||||
+ }
|
||||
+
|
||||
+ int bound = Math.min(-1, o);
|
||||
+ for (int z = l; z <= bound; z++) {
|
||||
+ this.forEachInColumn(x, k, n, z, action);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
+ // Mirai end
|
||||
+ }
|
||||
|
||||
+ // Mirai start - lithium: fast retrieval
|
||||
+ private void forEachInColumn(int x, int k, int n, int z, Consumer<EntitySection<T>> action) {
|
||||
+ //y from negative to positive, but y is treated as unsigned
|
||||
+ for (int y = Math.max(k, 0); y <= n; y++) {
|
||||
+ this.consumeSection(SectionPos.asLong(x, y, z), action);
|
||||
+ }
|
||||
+ int bound = Math.min(-1, n);
|
||||
+ for (int y = k; y <= bound; y++) {
|
||||
+ this.consumeSection(SectionPos.asLong(x, y, z), action);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void consumeSection(long pos, Consumer<EntitySection<T>> action) {
|
||||
+ EntitySection<T> entitySection = this.getSection(pos);
|
||||
+ if (entitySection != null && 0 != entitySection.size() && entitySection.getStatus().isAccessible()) {
|
||||
+ action.accept(entitySection);
|
||||
+ }
|
||||
}
|
||||
+ // Mirai end
|
||||
|
||||
public LongStream getExistingSectionPositionsInChunk(long chunkPos) {
|
||||
int i = ChunkPos.getX(chunkPos);
|
||||
@@ -7,10 +7,10 @@ Original code by YatopiaMC, licensed under MIT
|
||||
You can find the original code on https://github.com/YatopiaMC/Yatopia
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 1ef00b9a0b502fac69ffdd0e233c5222dd9178ff..30156d3c983f83c4d96ce089a27ff9bfed29555e 100644
|
||||
index ed25891919bbd372b042f343d3b3360fb1654ca3..a9bb700ae1496e3c23a19b62fcc4233c18a0209d 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1160,6 +1160,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
@@ -1117,6 +1117,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
// Paper End
|
||||
// Spigot End
|
||||
|
||||
@@ -19,7 +19,7 @@ index 1ef00b9a0b502fac69ffdd0e233c5222dd9178ff..30156d3c983f83c4d96ce089a27ff9bf
|
||||
protected void runServer() {
|
||||
try {
|
||||
long serverStartTime = Util.getNanos(); // Paper
|
||||
@@ -1225,7 +1227,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
@@ -1186,7 +1188,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.nextTickTime += 50L;
|
||||
this.startMetricsRecordingTick();
|
||||
this.profiler.push("tick");
|
||||
@@ -30,15 +30,22 @@ index 1ef00b9a0b502fac69ffdd0e233c5222dd9178ff..30156d3c983f83c4d96ce089a27ff9bf
|
||||
this.mayHaveDelayedTasks = true;
|
||||
this.delayedTasksMaxNextTickTime = Math.max(Util.getMillis() + 50L, this.nextTickTime);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 20437547fd04552d5d52ea1058cd793ed1a8e903..69ddc41119dc621cf0ffa9e8e89bc761dc666b7d 100644
|
||||
index 2e81f3eaec2d04e6bc88f7ce9a2bc861297e0383..ae765bd800b843cf9c69c6895fcc0f701a6cd633 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2885,4 +2885,6 @@ public final class CraftServer implements Server {
|
||||
@@ -2895,6 +2895,12 @@ public final class CraftServer implements Server {
|
||||
public CraftPotionBrewer getPotionBrewer() {
|
||||
return this.potionBrewer;
|
||||
}
|
||||
|
||||
-
|
||||
// Paper end
|
||||
+
|
||||
+ @Override public java.time.Duration getLastTickTime() { return net.minecraft.server.MinecraftServer.lastTickTime; } // Yatopia
|
||||
+ // Yatopia start
|
||||
+ @Override
|
||||
+ public java.time.Duration getLastTickTime() {
|
||||
+ return net.minecraft.server.MinecraftServer.lastTickTime;
|
||||
+ }
|
||||
+ // Yatopia end
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
||||
index 9bede6a26c08ede063c7a38f1149c811df14b258..b735769b7876e54db2950ebb4170484447cfb9a6 100644
|
||||
@@ -1,99 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: 2No2Name <2No2Name@web.de>
|
||||
Date: Wed, 15 Dec 2021 11:20:48 -0500
|
||||
Subject: [PATCH] lithium: fast retrieval
|
||||
|
||||
Original code by CaffeineMC, licensed under GNU Lesser General Public License v3.0
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java
|
||||
index 2ad47b33aea2493b2cdc0431849ecd50a12f9146..ba8aef74c0c23a39b0e4387916a904e14d41a25a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java
|
||||
@@ -32,33 +32,66 @@ public class EntitySectionStorage<T extends EntityAccess> {
|
||||
this.intialSectionVisibility = chunkStatusDiscriminator;
|
||||
}
|
||||
|
||||
+ // JettPack start - lithium: entity.fast_retrieval
|
||||
public void forEachAccessibleNonEmptySection(AABB box, Consumer<EntitySection<T>> action) {
|
||||
- int i = SectionPos.posToSectionCoord(box.minX - 2.0D);
|
||||
- int j = SectionPos.posToSectionCoord(box.minY - 2.0D);
|
||||
- int k = SectionPos.posToSectionCoord(box.minZ - 2.0D);
|
||||
- int l = SectionPos.posToSectionCoord(box.maxX + 2.0D);
|
||||
- int m = SectionPos.posToSectionCoord(box.maxY + 2.0D);
|
||||
- int n = SectionPos.posToSectionCoord(box.maxZ + 2.0D);
|
||||
-
|
||||
- for(int o = i; o <= l; ++o) {
|
||||
- long p = SectionPos.asLong(o, 0, 0);
|
||||
- long q = SectionPos.asLong(o, -1, -1);
|
||||
- LongIterator longIterator = this.sectionIds.subSet(p, q + 1L).iterator();
|
||||
-
|
||||
- while(longIterator.hasNext()) {
|
||||
- long r = longIterator.nextLong();
|
||||
- int s = SectionPos.y(r);
|
||||
- int t = SectionPos.z(r);
|
||||
- if (s >= j && s <= m && t >= k && t <= n) {
|
||||
- EntitySection<T> entitySection = this.sections.get(r);
|
||||
- if (entitySection != null && !entitySection.isEmpty() && entitySection.getStatus().isAccessible()) {
|
||||
- action.accept(entitySection);
|
||||
+ int minX = SectionPos.posToSectionCoord(box.minX - 2.0D);
|
||||
+ int minY = SectionPos.posToSectionCoord(box.minY - 2.0D);
|
||||
+ int minZ = SectionPos.posToSectionCoord(box.minZ - 2.0D);
|
||||
+ int maxX = SectionPos.posToSectionCoord(box.maxX + 2.0D);
|
||||
+ int maxY = SectionPos.posToSectionCoord(box.maxY + 2.0D);
|
||||
+ int maxZ = SectionPos.posToSectionCoord(box.maxZ + 2.0D);
|
||||
+
|
||||
+ if (maxX >= minX + 4 || maxZ >= minZ + 4) {
|
||||
+ // [VanillaCopy]
|
||||
+ for(int o = minX; o <= maxX; ++o) {
|
||||
+ long p = SectionPos.asLong(o, 0, 0);
|
||||
+ long q = SectionPos.asLong(o, -1, -1);
|
||||
+ LongIterator longIterator = this.sectionIds.subSet(p, q + 1L).iterator();
|
||||
+
|
||||
+ while(longIterator.hasNext()) {
|
||||
+ long r = longIterator.nextLong();
|
||||
+ int s = SectionPos.y(r);
|
||||
+ int t = SectionPos.z(r);
|
||||
+ if (s >= minY && s <= maxY && t >= minZ && t <= maxZ) {
|
||||
+ EntitySection<T> entitySection = this.sections.get(r);
|
||||
+ if (entitySection != null && !entitySection.isEmpty() && entitySection.getStatus().isAccessible()) {
|
||||
+ action.accept(entitySection);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
+ } else {
|
||||
+ for (int x = minX; x <= maxX; x++) {
|
||||
+ for (int z = Math.max(minZ, 0); z <= maxZ; z++) {
|
||||
+ this.forEachInColumn(x, minY, maxY, z, action);
|
||||
+ }
|
||||
+
|
||||
+ int bound = Math.min(-1, maxZ);
|
||||
+ for (int z = minZ; z <= bound; z++) {
|
||||
+ this.forEachInColumn(x, minY, maxY, z, action);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
+ }
|
||||
|
||||
+ private void forEachInColumn(int x, int minY, int maxY, int z, Consumer<EntitySection<T>> action) {
|
||||
+ //y from negative to positive, but y is treated as unsigned
|
||||
+ for (int y = Math.max(minY, 0); y <= maxY; y++) {
|
||||
+ this.consumeSection(SectionPos.asLong(x, y, z), action);
|
||||
+ }
|
||||
+ int bound = Math.min(-1, maxY);
|
||||
+ for (int y = minY; y <= bound; y++) {
|
||||
+ this.consumeSection(SectionPos.asLong(x, y, z), action);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void consumeSection(long pos, Consumer<EntitySection<T>> action) {
|
||||
+ EntitySection<T> section = this.getSection(pos);
|
||||
+ if (section != null && 0 != section.size() && section.getStatus().isAccessible()) {
|
||||
+ action.accept(section);
|
||||
+ }
|
||||
}
|
||||
+ // JettPack end
|
||||
|
||||
public LongStream getExistingSectionPositionsInChunk(long chunkPos) {
|
||||
int i = ChunkPos.getX(chunkPos);
|
||||
@@ -7,10 +7,10 @@ Original code by YatopiaMC, licensed under MIT
|
||||
You can find the original code on https://github.com/YatopiaMC/Yatopia
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 49e27efb5fdf26f6a8026c8c17e25d87026ab45d..15b5d142a8261f397ab2ab939d92aeb5701e28fb 100644
|
||||
index 4030818ff51eca95e1c2ec38c7eca5bff79a0a4a..348fadecea776f2aea24664d340ce0955455d8af 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -494,7 +494,13 @@ public abstract class PlayerList {
|
||||
@@ -497,7 +497,13 @@ public abstract class PlayerList {
|
||||
}
|
||||
// Paper end
|
||||
// CraftBukkit - Moved from above, added world
|
||||
@@ -26,10 +26,10 @@ index 49e27efb5fdf26f6a8026c8c17e25d87026ab45d..15b5d142a8261f397ab2ab939d92aeb5
|
||||
|
||||
public void updateEntireScoreboard(ServerScoreboard scoreboard, ServerPlayer player) {
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index 5b30b329959811f99f13f32166574f90e765bcb1..63d750d5858d20304b9608697ae618eb97cb6eb6 100644
|
||||
index 5b30b329959811f99f13f32166574f90e765bcb1..ce82453b1ee3514cfbe10b94184d1c210867bed9 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -184,6 +184,11 @@ public class MiraiConfig {
|
||||
@@ -184,6 +184,9 @@ public class MiraiConfig {
|
||||
|
||||
// Mirai - settings below
|
||||
|
||||
@@ -38,8 +38,6 @@ index 5b30b329959811f99f13f32166574f90e765bcb1..63d750d5858d20304b9608697ae618eb
|
||||
+ private static void logPlayerLoc() {
|
||||
+ logPlayerLoginLoc = getBoolean("log-player-login-location", logPlayerLoginLoc);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
|
||||
}
|
||||
\ No newline at end of file
|
||||
|
||||
@@ -7,62 +7,70 @@ Original code by YatopiaMC, licensed under MIT
|
||||
You can find the original code on https://github.com/YatopiaMC/Yatopia
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 15b5d142a8261f397ab2ab939d92aeb5701e28fb..ba8e58fe70f16dbc0b64a92264d29c91461d2cdf 100644
|
||||
index 348fadecea776f2aea24664d340ce0955455d8af..db4b6d7fe91c1a071a833db842f664ec6ba51932 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -754,13 +754,19 @@ public abstract class PlayerList {
|
||||
@@ -757,13 +757,19 @@ public abstract class PlayerList {
|
||||
if (getBans().isBanned(gameprofile) && (gameprofilebanentry = getBans().get(gameprofile)) != null) {
|
||||
// Paper end
|
||||
|
||||
+ if (!gameprofilebanentry.hasExpired()) { // Yatopia
|
||||
chatmessage = new TranslatableComponent("multiplayer.disconnect.banned.reason", new Object[]{gameprofilebanentry.getReason()});
|
||||
if (gameprofilebanentry.getExpires() != null) {
|
||||
chatmessage.append((Component) (new TranslatableComponent("multiplayer.disconnect.banned.expiration", new Object[]{PlayerList.BAN_DATE_FORMAT.format(gameprofilebanentry.getExpires())})));
|
||||
}
|
||||
|
||||
// return chatmessage;
|
||||
- ichatmutablecomponent = Component.translatable("multiplayer.disconnect.banned.reason", gameprofilebanentry.getReason());
|
||||
- if (gameprofilebanentry.getExpires() != null) {
|
||||
- ichatmutablecomponent.append((Component) Component.translatable("multiplayer.disconnect.banned.expiration", PlayerList.BAN_DATE_FORMAT.format(gameprofilebanentry.getExpires())));
|
||||
- }
|
||||
+ // Yatopia start - Stop wasting resources on JsonList#get
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(chatmessage)); // Paper - Adventure
|
||||
+ if (!gameprofilebanentry.hasExpired()) {
|
||||
+ ichatmutablecomponent = Component.translatable("multiplayer.disconnect.banned.reason", gameprofilebanentry.getReason());
|
||||
+ if (gameprofilebanentry.getExpires() != null) {
|
||||
+ ichatmutablecomponent.append((Component) Component.translatable("multiplayer.disconnect.banned.expiration", PlayerList.BAN_DATE_FORMAT.format(gameprofilebanentry.getExpires())));
|
||||
+ }
|
||||
|
||||
- // return chatmessage;
|
||||
- event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure
|
||||
+ // return chatmessage;
|
||||
+ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure
|
||||
+ } else {
|
||||
+ getBans().remove(gameprofile);
|
||||
+ }
|
||||
+ // Yatopia end
|
||||
} else if (!this.isWhitelisted(gameprofile, event)) { // Paper
|
||||
//chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted"); // Paper
|
||||
//event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot // Paper - moved to isWhitelisted
|
||||
} else if (!this.isWhiteListed(gameprofile, event)) { // Paper
|
||||
//ichatmutablecomponent = Component.translatable("multiplayer.disconnect.not_whitelisted"); // Paper
|
||||
//event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.whitelistMessage)); // Spigot // Paper - Adventure - moved to isWhitelisted
|
||||
diff --git a/src/main/java/net/minecraft/server/players/StoredUserList.java b/src/main/java/net/minecraft/server/players/StoredUserList.java
|
||||
index 63c0fe30ff035b6b5c1b4b35d3ad6c649d94e421..f01621bf34da2ea877e010834511c119664a03b7 100644
|
||||
index 63c0fe30ff035b6b5c1b4b35d3ad6c649d94e421..109e08e098a6c1ca1ba3dc2a9a293eaf9d5d7cb7 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/StoredUserList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/StoredUserList.java
|
||||
@@ -73,9 +73,14 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> {
|
||||
@@ -73,9 +73,12 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> {
|
||||
// Paper start
|
||||
// this.g();
|
||||
// return (V) this.d.get(this.a(k0)); // CraftBukkit - fix decompile error
|
||||
+ // Yatopia start - only remove if it expires and has been requested (Stop wasting resources on JsonList#get)
|
||||
- return (V) this.map.computeIfPresent(this.getKeyForUser(key), (k, v) -> {
|
||||
+ // Yatopia start - Stop wasting resources on JsonList#get
|
||||
+ return this.map.get(this.getKeyForUser(key));
|
||||
+ /*
|
||||
return (V) this.map.computeIfPresent(this.getKeyForUser(key), (k, v) -> {
|
||||
+ /*return (V) this.map.computeIfPresent(this.getKeyForUser(key), (k, v) -> {
|
||||
return v.hasExpired() ? null : v;
|
||||
});
|
||||
+ */
|
||||
+ // Sugarcane end
|
||||
- });
|
||||
+ });*/
|
||||
+ // Yatopia end
|
||||
// Paper end
|
||||
}
|
||||
|
||||
@@ -150,6 +155,8 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> {
|
||||
@@ -150,7 +153,8 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> {
|
||||
public void save() throws IOException {
|
||||
this.removeExpired(); // Paper - remove expired values before saving
|
||||
JsonArray jsonarray = new JsonArray();
|
||||
+ // Yatopia start - we're nuking streams wherever possible (Stop wasting resources on JsonList#get)
|
||||
+ /*
|
||||
Stream<JsonObject> stream = this.map.values().stream().map((jsonlistentry) -> { // CraftBukkit - decompile error
|
||||
- Stream<JsonObject> stream = this.map.values().stream().map((jsonlistentry) -> { // CraftBukkit - decompile error
|
||||
+ // Yatopia start - Stop wasting resources on JsonList#get
|
||||
+ /*Stream<JsonObject> stream = this.map.values().stream().map((jsonlistentry) -> { // CraftBukkit - decompile error
|
||||
JsonObject jsonobject = new JsonObject();
|
||||
|
||||
@@ -159,6 +166,13 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> {
|
||||
Objects.requireNonNull(jsonlistentry);
|
||||
@@ -158,7 +162,13 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> {
|
||||
});
|
||||
|
||||
Objects.requireNonNull(jsonarray);
|
||||
stream.forEach(jsonarray::add);
|
||||
+ */
|
||||
- stream.forEach(jsonarray::add);
|
||||
+ stream.forEach(jsonarray::add);*/
|
||||
+ for (V value : this.map.values()) {
|
||||
+ JsonObject obj = new JsonObject();
|
||||
+ value.serialize(obj);
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Configurable max bees in hive
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
||||
index 483dc52c793d9f90a35b1d091dd8ce71115e4640..0282c11936f817dd86861960cf58b8466e8d27f6 100644
|
||||
index 41c9f074203915c31c1ae7a160ce509c13383f84..ce56e8ca4b4f866eddcf0849c3b53928550a6126 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
||||
@@ -42,7 +42,7 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||
@@ -43,7 +43,7 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||
private final List<BeehiveBlockEntity.BeeData> stored = Lists.newArrayList();
|
||||
@Nullable
|
||||
public BlockPos savedFlowerPos;
|
||||
@@ -18,18 +18,17 @@ index 483dc52c793d9f90a35b1d091dd8ce71115e4640..0282c11936f817dd86861960cf58b846
|
||||
public BeehiveBlockEntity(BlockPos pos, BlockState state) {
|
||||
super(BlockEntityType.BEEHIVE, pos, state);
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index 63d750d5858d20304b9608697ae618eb97cb6eb6..667eaabe95e9b44cad64dd5aba5ac693f4d726ed 100644
|
||||
index ce82453b1ee3514cfbe10b94184d1c210867bed9..667eaabe95e9b44cad64dd5aba5ac693f4d726ed 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -189,6 +189,9 @@ public class MiraiConfig {
|
||||
@@ -189,4 +189,9 @@ public class MiraiConfig {
|
||||
logPlayerLoginLoc = getBoolean("log-player-login-location", logPlayerLoginLoc);
|
||||
}
|
||||
|
||||
-
|
||||
+ public static int maxBees = 3;
|
||||
+ private static void maximumBees() {
|
||||
+ maxBees = getInt("max-bees-in-hive", maxBees);
|
||||
+ }
|
||||
|
||||
+
|
||||
}
|
||||
\ No newline at end of file
|
||||
|
||||
@@ -7,10 +7,10 @@ Original code by PatinaMC, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://github.com/PatinaMC/Patina
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 26841729126b022f75e55e584fe850771dedd4cd..38754510081b130e045900bec6d7e0a9cb47b767 100644
|
||||
index a9bb700ae1496e3c23a19b62fcc4233c18a0209d..513b333a7bf8f68a2528e31d9a5e658b107b6469 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -185,7 +185,7 @@ import org.bukkit.event.server.ServerLoadEvent;
|
||||
@@ -180,7 +180,7 @@ import org.bukkit.event.server.ServerLoadEvent;
|
||||
|
||||
import co.aikar.timings.MinecraftTimings; // Paper
|
||||
|
||||
@@ -19,7 +19,7 @@ index 26841729126b022f75e55e584fe850771dedd4cd..38754510081b130e045900bec6d7e0a9
|
||||
|
||||
private static MinecraftServer SERVER; // Paper
|
||||
public static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -1352,19 +1352,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1315,19 +1315,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,7 +43,7 @@ index 26841729126b022f75e55e584fe850771dedd4cd..38754510081b130e045900bec6d7e0a9
|
||||
|
||||
@Override
|
||||
public boolean pollTask() {
|
||||
@@ -1396,10 +1398,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1359,10 +1361,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,10 +57,10 @@ index 26841729126b022f75e55e584fe850771dedd4cd..38754510081b130e045900bec6d7e0a9
|
||||
private void updateStatusIcon(ServerStatus metadata) {
|
||||
Optional<File> optional = Optional.of(this.getFile("server-icon.png")).filter(File::isFile);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index b42e32bd1a6a669f498b577ec04661c4ba651198..fed79d31c36b9fafbdc71461e27b1f4e1ca0385a 100644
|
||||
index 378cc1f9e19eb9b18037ab8af92f65897e15a405..998a1faa9f7ea2fb0d522c941c5e2cf90cb1c6da 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -1257,10 +1257,12 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -1262,10 +1262,12 @@ public class ServerChunkCache extends ChunkSource {
|
||||
return runnable;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ index b42e32bd1a6a669f498b577ec04661c4ba651198..fed79d31c36b9fafbdc71461e27b1f4e
|
||||
@Override
|
||||
protected boolean scheduleExecutables() {
|
||||
diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
|
||||
index 6158420c629d6acdaafb01a7e00d788023e922d1..9321e3a8b2f6f2eaebfa55679f287429d009e834 100644
|
||||
index 7a4ade1a4190bf4fbb048919ae2be230f7b80fff..8bf10c68c233a445902a143eaeb5252247c74a75 100644
|
||||
--- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
|
||||
+++ b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
|
||||
@@ -29,7 +29,7 @@ public abstract class BlockableEventLoop<R extends Runnable> implements Profiler
|
||||
|
||||
@@ -7,13 +7,13 @@ Original code by PatinaMC, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://github.com/PatinaMC/Patina
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||
index 00bbf33aa44e2d5a4e755a2d7c1a60de9e36674f..ec6a06460469a8bc2e10064d5b78b4b5daa6cc13 100644
|
||||
index 0148cadbeb41a882a05d982f0b34770b2829a04a..e11d9677558727a11208ea6580459c00bdb0af57 100644
|
||||
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||
@@ -56,7 +56,7 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
|
||||
private final ResultConsumer<CommandSourceStack> consumer;
|
||||
@@ -55,7 +55,7 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
|
||||
private final EntityAnchorArgument.Anchor anchor;
|
||||
private final Vec2 rotation;
|
||||
private final CommandSigningContext signingContext;
|
||||
- public java.util.Map<Thread, CommandNode> currentCommand = new java.util.concurrent.ConcurrentHashMap<>(); // CraftBukkit // Paper
|
||||
+ public final java.util.Map<Thread, CommandNode> currentCommand = new java.util.concurrent.ConcurrentHashMap<>(); // CraftBukkit // Paper // Patina - make a field final
|
||||
|
||||
|
||||
@@ -1,61 +1,43 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Wed, 5 Jan 2022 20:49:49 +0100
|
||||
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
|
||||
Date: Thu, 1 Jul 2021 12:17:44 +0000
|
||||
Subject: [PATCH] Don't create new random instance
|
||||
|
||||
Original code by PatinaMC, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://github.com/PatinaMC/Patina
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index a6edf5117d4ae03d8294e7bb74dd2d77048895a5..1a9afa43a953e5634edb23ef617ead4b329ae89f 100644
|
||||
index 353463084d90eb684717e65c56da52cd25a1e375..226a3a698e3863296481753434a716a793cb5d51 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -367,7 +367,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -374,7 +374,7 @@ public class ServerPlayer extends Player {
|
||||
long l = k * k;
|
||||
int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l;
|
||||
int j1 = this.getCoprime(i1);
|
||||
- int k1 = (new Random()).nextInt(i1);
|
||||
- int k1 = RandomSource.create().nextInt(i1);
|
||||
+ int k1 = worldserver.random.nextInt(i1); // Patina - don't create new random instance
|
||||
|
||||
for (int l1 = 0; l1 < i1; ++l1) {
|
||||
int i2 = (k1 + j1 * l1) % i1;
|
||||
@@ -404,7 +404,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -411,7 +411,7 @@ public class ServerPlayer extends Player {
|
||||
long l = k * k;
|
||||
int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l;
|
||||
int j1 = this.getCoprime(i1);
|
||||
- int k1 = (new Random()).nextInt(i1);
|
||||
- int k1 = RandomSource.create().nextInt(i1);
|
||||
+ int k1 = world.random.nextInt(i1); // Patina - don't create new random instance
|
||||
|
||||
for (int l1 = 0; l1 < i1; ++l1) {
|
||||
int i2 = (k1 + j1 * l1) % i1;
|
||||
diff --git a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java
|
||||
index 55c66f59c3946f79d8d0bd4dacd27dafb6090646..4bc858dc779a4553384091d5dd4e96911223302b 100644
|
||||
index 29e2bc3fa3091df3c2fa908a2632c3b592c4a872..55a2f7af4b5a78f616fe9af00783d7452f8ee203 100644
|
||||
--- a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java
|
||||
+++ b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java
|
||||
@@ -348,7 +348,7 @@ public class QueryThreadGs4 extends GenericThread {
|
||||
this.identBytes[2] = bs[5];
|
||||
this.identBytes[3] = bs[6];
|
||||
this.ident = new String(this.identBytes, StandardCharsets.UTF_8);
|
||||
- this.challenge = (new Random()).nextInt(16777216);
|
||||
- this.challenge = RandomSource.create().nextInt(16777216);
|
||||
+ this.challenge = java.util.concurrent.ThreadLocalRandom.current().nextInt(16777216); // Patina - don't create new random instance
|
||||
this.challengeBytes = String.format("\t%s%d\u0000", this.ident, this.challenge).getBytes(StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 8fb58a59181fdf3a6ca5710d42eac060fc756395..af603994275c93842d2c3b6e9a7fcf0b0fbad168 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -121,13 +121,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public final Thread thread;
|
||||
private final boolean isDebug;
|
||||
private int skyDarken;
|
||||
- protected int randValue = (new Random()).nextInt();
|
||||
+ //protected int randValue = (new Random()).nextInt(); // Patina - moved down
|
||||
protected final int addend = 1013904223;
|
||||
protected float oRainLevel;
|
||||
public float rainLevel;
|
||||
protected float oThunderLevel;
|
||||
public float thunderLevel;
|
||||
public final Random random = new Random();
|
||||
+ protected int randValue = random.nextInt(); // Patina - don't create new random instance
|
||||
final DimensionType dimensionType;
|
||||
private final Holder<DimensionType> dimensionTypeRegistration;
|
||||
public final WritableLevelData levelData;
|
||||
|
||||
@@ -7,10 +7,10 @@ Original code by PatinaMC, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://github.com/PatinaMC/Patina
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
|
||||
index fa14cedb8437b1e1713b0023253845a4bc2b11fc..bc6600fe322ef9733233c0273e318f2c16f6d359 100644
|
||||
index c540b695282e2cca97cc4e3320d641befa19c1c6..eee3347a5fd1b1f4eb0bbee29483f0a81868cf16 100644
|
||||
--- a/src/main/java/net/minecraft/Util.java
|
||||
+++ b/src/main/java/net/minecraft/Util.java
|
||||
@@ -67,7 +67,7 @@ public class Util {
|
||||
@@ -77,7 +77,7 @@ public class Util {
|
||||
private static final int DEFAULT_MAX_THREADS = 255;
|
||||
private static final String MAX_THREADS_SYSTEM_PROPERTY = "max.bg.threads";
|
||||
private static final AtomicInteger WORKER_COUNT = new AtomicInteger(1);
|
||||
@@ -19,7 +19,7 @@ index fa14cedb8437b1e1713b0023253845a4bc2b11fc..bc6600fe322ef9733233c0273e318f2c
|
||||
private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main", -1); // Paper - add -1 priority
|
||||
// Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
|
||||
public static final ExecutorService PROFILE_EXECUTOR = Executors.newFixedThreadPool(2, new java.util.concurrent.ThreadFactory() {
|
||||
@@ -190,7 +190,7 @@ public class Util {
|
||||
@@ -200,7 +200,7 @@ public class Util {
|
||||
}
|
||||
|
||||
public static ExecutorService bootstrapExecutor() {
|
||||
@@ -28,26 +28,3 @@ index fa14cedb8437b1e1713b0023253845a4bc2b11fc..bc6600fe322ef9733233c0273e318f2c
|
||||
}
|
||||
|
||||
public static ExecutorService backgroundExecutor() {
|
||||
diff --git a/src/main/java/net/minecraft/util/datafix/DataFixers.java b/src/main/java/net/minecraft/util/datafix/DataFixers.java
|
||||
index e4090fa0f01078277d70b1a88e870a56f6b1cb0f..0c5abb040d156c8a855c3c40718411f2c7e8e43d 100644
|
||||
--- a/src/main/java/net/minecraft/util/datafix/DataFixers.java
|
||||
+++ b/src/main/java/net/minecraft/util/datafix/DataFixers.java
|
||||
@@ -78,15 +78,15 @@ public class DataFixers {
|
||||
|
||||
private static final BiFunction<Integer, Schema, Schema> SAME = Schema::new;
|
||||
private static final BiFunction<Integer, Schema, Schema> SAME_NAMESPACED = NamespacedSchema::new;
|
||||
- private static final DataFixer DATA_FIXER = DataFixers.createFixerUpper();
|
||||
+ private static final DataFixer DATA_FIXER; // Patina
|
||||
|
||||
public DataFixers() {}
|
||||
|
||||
- private static DataFixer createFixerUpper() {
|
||||
+ static { // Patina
|
||||
DataFixerBuilder datafixerbuilder = new DataFixerBuilder(SharedConstants.getCurrentVersion().getWorldVersion());
|
||||
|
||||
DataFixers.addFixers(datafixerbuilder);
|
||||
- return datafixerbuilder.build(Util.bootstrapExecutor());
|
||||
+ DATA_FIXER = datafixerbuilder.build(Util.backgroundExecutor()); // Patina
|
||||
}
|
||||
|
||||
public static DataFixer getDataFixer() {
|
||||
|
||||
@@ -7,23 +7,23 @@ Original code by Titaniumtown, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://gitlab.com/Titaniumtown/JettPack
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
index e8e49e1bdf1ff4ea60a4feb6ec52d999cbced256..b49f53a89d9c096355d6cc20a2a59033f2637432 100644
|
||||
index c0fdc5a79107f8694a514a12d5526bd431fc45e9..eeb20c5b9365a04db45e738793f6c10a4f2b759e 100644
|
||||
--- a/src/main/java/net/minecraft/server/MCUtil.java
|
||||
+++ b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
@@ -53,11 +53,14 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
+import java.util.concurrent.SynchronousQueue; // Jettpack
|
||||
+import java.util.concurrent.ConcurrentLinkedQueue; // Jettpack
|
||||
+import java.util.concurrent.SynchronousQueue; // JettPack
|
||||
+import java.util.concurrent.ConcurrentLinkedQueue; // JettPack
|
||||
|
||||
public final class MCUtil {
|
||||
+ public static final ConcurrentLinkedQueue smallAsyncTasks = new ConcurrentLinkedQueue(); // Jettpack
|
||||
+ public static final ConcurrentLinkedQueue smallAsyncTasks = new ConcurrentLinkedQueue(); // JettPack
|
||||
public static final ThreadPoolExecutor asyncExecutor = new ThreadPoolExecutor(
|
||||
- 0, 2, 60L, TimeUnit.SECONDS,
|
||||
- new LinkedBlockingQueue<>(),
|
||||
+ 4, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, // Jettpack
|
||||
+ new SynchronousQueue<Runnable>(), // Jettpack
|
||||
+ 4, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, // JettPack
|
||||
+ new SynchronousQueue<Runnable>(), // JettPack
|
||||
new ThreadFactoryBuilder()
|
||||
.setNameFormat("Paper Async Task Handler Thread - %1$d")
|
||||
.setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(MinecraftServer.LOGGER))
|
||||
@@ -31,7 +31,7 @@ index e8e49e1bdf1ff4ea60a4feb6ec52d999cbced256..b49f53a89d9c096355d6cc20a2a59033
|
||||
|
||||
public static final long INVALID_CHUNK_KEY = getCoordinateKey(Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
|
||||
+ // Jettpack start
|
||||
+ // JettPack start
|
||||
+ public static void flushAsyncTasks() {
|
||||
+ if (!smallAsyncTasks.isEmpty()) {
|
||||
+ asyncExecutor.submit(() -> {
|
||||
@@ -54,94 +54,98 @@ index e8e49e1bdf1ff4ea60a4feb6ec52d999cbced256..b49f53a89d9c096355d6cc20a2a59033
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+ // Jettpack end
|
||||
+ // JettPack end
|
||||
|
||||
public static Runnable once(Runnable run) {
|
||||
AtomicBoolean ran = new AtomicBoolean(false);
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 38754510081b130e045900bec6d7e0a9cb47b767..1ef00b9a0b502fac69ffdd0e233c5222dd9178ff 100644
|
||||
index 513b333a7bf8f68a2528e31d9a5e658b107b6469..e6e16685aff8266c1edd7d6e3a16e65f4dfb5162 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1059,6 +1059,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
@@ -1017,6 +1017,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
LOGGER.info("Flushing Chunk IO");
|
||||
com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.close(true, true); // Paper
|
||||
LOGGER.info("Closing Thread Pool");
|
||||
+ MCUtil.flushAsyncTasks();
|
||||
+ MCUtil.flushAsyncTasks(); // JettPack
|
||||
Util.shutdownExecutors(); // Paper
|
||||
LOGGER.info("Closing Server");
|
||||
try {
|
||||
@@ -1506,6 +1507,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
@@ -1469,6 +1470,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
io.papermc.paper.util.CachedLists.reset(); // Paper
|
||||
// Paper start - move executeAll() into full server tick timing
|
||||
try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) {
|
||||
+ MCUtil.flushAsyncTasks();
|
||||
+ MCUtil.flushAsyncTasks(); // JettPack
|
||||
this.runAllTasks();
|
||||
}
|
||||
// Paper end
|
||||
@@ -2749,6 +2751,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
@@ -2721,6 +2723,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
return;
|
||||
}
|
||||
|
||||
+ MCUtil.flushAsyncTasksMidTick();
|
||||
+ MCUtil.flushAsyncTasksMidTick(); // JettPack
|
||||
co.aikar.timings.MinecraftTimings.midTickChunkTasks.startTiming();
|
||||
try {
|
||||
for (;;) {
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index 0c4e34c02060c00bdbed6388989660ec023b4d1c..0866b340a11d4650fc00a40cdb949b6e44691f8c 100644
|
||||
index 9903316fe3164a987a7745104c2f1875ca0c0a47..62c4f737022fa226be1e1140cc4bafa009023d2f 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -123,6 +123,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
|
||||
|
||||
@@ -133,6 +133,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
|
||||
}
|
||||
|
||||
+ /*
|
||||
// Paper start - Cache authenticator threads
|
||||
+ /* // JettPack
|
||||
private static final AtomicInteger threadId = new AtomicInteger(0);
|
||||
private static final java.util.concurrent.ExecutorService authenticatorPool = java.util.concurrent.Executors.newCachedThreadPool(
|
||||
@@ -135,6 +136,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
|
||||
r -> {
|
||||
@@ -142,7 +143,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
|
||||
|
||||
return ret;
|
||||
}
|
||||
);
|
||||
- );
|
||||
+ );*/
|
||||
// Paper end
|
||||
+ */
|
||||
// Spigot start
|
||||
public void initUUID()
|
||||
{
|
||||
@@ -274,7 +276,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
|
||||
@@ -329,7 +330,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
|
||||
// Paper end
|
||||
// Spigot start
|
||||
// Paper start - Cache authenticator threads
|
||||
- authenticatorPool.execute(new Runnable() {
|
||||
+ net.minecraft.server.MCUtil.asyncExecutor.execute(new Runnable() { // Jettpack
|
||||
+ //authenticatorPool.execute(new Runnable() { // JettPack
|
||||
+ net.minecraft.server.MCUtil.asyncExecutor.execute(new Runnable() { // JettPack
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
@@ -324,7 +326,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
|
||||
@@ -385,7 +387,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
|
||||
}
|
||||
|
||||
// Paper start - Cache authenticator threads
|
||||
- authenticatorPool.execute(new Runnable() {
|
||||
+ net.minecraft.server.MCUtil.asyncExecutor.execute(new Runnable() { // Jettpack
|
||||
+ //authenticatorPool.execute(new Runnable() { // JettPack
|
||||
+ net.minecraft.server.MCUtil.asyncExecutor.execute(new Runnable() { // JettPack
|
||||
public void run() {
|
||||
GameProfile gameprofile = ServerLoginPacketListenerImpl.this.gameProfile;
|
||||
|
||||
@@ -458,7 +460,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
|
||||
this.gameProfile = com.destroystokyo.paper.proxy.VelocityProxy.createProfile(buf);
|
||||
@@ -533,7 +536,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
|
||||
}
|
||||
|
||||
// Proceed with login
|
||||
- authenticatorPool.execute(() -> {
|
||||
+ net.minecraft.server.MCUtil.asyncExecutor.execute(() -> { // Jettpack
|
||||
+ //authenticatorPool.execute(() -> { // JettPack
|
||||
+ net.minecraft.server.MCUtil.asyncExecutor.execute(() -> { // JettPack
|
||||
try {
|
||||
new LoginHandler().fireEvents();
|
||||
} catch (Exception ex) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java
|
||||
index 9c1aff17aabd062640e3f451a2ef8c50a7c62f10..78073cbb7f36950537dc65633e264c30ee8f8a35 100644
|
||||
index 9c1aff17aabd062640e3f451a2ef8c50a7c62f10..29eda0db104fe13fb268ebe0750e5e3e1600efcc 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java
|
||||
@@ -32,23 +32,29 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
+/*
|
||||
+/* // JettPack
|
||||
import java.util.concurrent.SynchronousQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -149,7 +153,7 @@ index 9c1aff17aabd062640e3f451a2ef8c50a7c62f10..78073cbb7f36950537dc65633e264c30
|
||||
|
||||
public class CraftAsyncScheduler extends CraftScheduler {
|
||||
|
||||
+ /*
|
||||
+ /* // JettPack
|
||||
private final ThreadPoolExecutor executor = new ThreadPoolExecutor(
|
||||
4, Integer.MAX_VALUE,30L, TimeUnit.SECONDS, new SynchronousQueue<>(),
|
||||
new ThreadFactoryBuilder().setNameFormat("Craft Scheduler Thread - %1$d").setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(net.minecraft.server.MinecraftServer.LOGGER)).build()); // Paper
|
||||
@@ -160,31 +164,32 @@ index 9c1aff17aabd062640e3f451a2ef8c50a7c62f10..78073cbb7f36950537dc65633e264c30
|
||||
|
||||
CraftAsyncScheduler() {
|
||||
super(true);
|
||||
+ /*
|
||||
+ /* // JettPack
|
||||
executor.allowCoreThreadTimeOut(true);
|
||||
executor.prestartAllCoreThreads();
|
||||
+ */
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,7 +99,7 @@ public class CraftAsyncScheduler extends CraftScheduler {
|
||||
@@ -93,7 +99,8 @@ public class CraftAsyncScheduler extends CraftScheduler {
|
||||
private boolean executeTask(CraftTask task) {
|
||||
if (isValid(task)) {
|
||||
this.runners.put(task.getTaskId(), task);
|
||||
- this.executor.execute(new ServerSchedulerReportingWrapper(task));
|
||||
+ net.minecraft.server.MCUtil.asyncExecutor.execute(new ServerSchedulerReportingWrapper(task)); // Jettpack
|
||||
+ //this.executor.execute(new ServerSchedulerReportingWrapper(task));
|
||||
+ net.minecraft.server.MCUtil.asyncExecutor.execute(new ServerSchedulerReportingWrapper(task)); // JettPack
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
index 24fefa521093448e608e217af7b88a6397a4b054..f3400bdf23f79098c7e7b68f6b93aa65ca5b09dd 100644
|
||||
index d568fc92d03c313a782796cc720a1ebb1a5ad8be..adfd28b4b34ff0b161076b4b03f7d93fecb09573 100644
|
||||
--- a/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
@@ -141,6 +141,7 @@ public class WatchdogThread extends Thread
|
||||
@@ -140,6 +140,7 @@ public class WatchdogThread extends Thread
|
||||
{
|
||||
while ( !this.stopping )
|
||||
{
|
||||
+ net.minecraft.server.MCUtil.flushAsyncTasks(); // Jettpack
|
||||
+ net.minecraft.server.MCUtil.flushAsyncTasks(); // JettPack
|
||||
//
|
||||
// Paper start
|
||||
Logger log = Bukkit.getServer().getLogger();
|
||||
@@ -1,99 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Simon Gardling <titaniumtown@gmail.com>
|
||||
Date: Thu, 8 Jul 2021 15:03:15 -0400
|
||||
Subject: [PATCH] Use LinkedBlockingDeque in IAsyncTaskHandler
|
||||
|
||||
Original code by Titaniumtown, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://gitlab.com/Titaniumtown/JettPack
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
|
||||
index 9321e3a8b2f6f2eaebfa55679f287429d009e834..a270169efccfdd92b2c18af37477b9020746861c 100644
|
||||
--- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
|
||||
+++ b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
|
||||
@@ -1,13 +1,10 @@
|
||||
package net.minecraft.util.thread;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
-import com.google.common.collect.Queues;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import java.util.List;
|
||||
-import java.util.Queue;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
-import java.util.concurrent.locks.LockSupport;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.function.Supplier;
|
||||
import net.minecraft.util.profiling.metrics.MetricCategory;
|
||||
@@ -15,12 +12,15 @@ import net.minecraft.util.profiling.metrics.MetricSampler;
|
||||
import net.minecraft.util.profiling.metrics.MetricsRegistry;
|
||||
import net.minecraft.util.profiling.metrics.ProfilerMeasured;
|
||||
import org.slf4j.Logger;
|
||||
+import java.util.concurrent.LinkedBlockingDeque; // JettPack
|
||||
+import java.util.concurrent.TimeUnit; // JettPack
|
||||
|
||||
public abstract class BlockableEventLoop<R extends Runnable> implements ProfilerMeasured, ProcessorHandle<R>, Executor {
|
||||
private final String name;
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
- private final Queue<R> pendingRunnables = Queues.newConcurrentLinkedQueue();
|
||||
+ private final LinkedBlockingDeque<R> pendingRunnables = new LinkedBlockingDeque(); // JettPack
|
||||
private int blockingCount;
|
||||
+ private R next = null; // JettPack
|
||||
|
||||
protected BlockableEventLoop(String name) {
|
||||
this.name = name;
|
||||
@@ -89,7 +89,7 @@ public abstract class BlockableEventLoop<R extends Runnable> implements Profiler
|
||||
@Override
|
||||
public void tell(R runnable) {
|
||||
this.pendingRunnables.add(runnable);
|
||||
- LockSupport.unpark(this.getRunningThread());
|
||||
+ //LockSupport.unpark(this.getRunningThread()); // JettPack
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -117,15 +117,20 @@ public abstract class BlockableEventLoop<R extends Runnable> implements Profiler
|
||||
}
|
||||
|
||||
public boolean pollTask() {
|
||||
- R runnable = this.pendingRunnables.peek();
|
||||
- if (runnable == null) {
|
||||
- return false;
|
||||
- } else if (this.blockingCount == 0 && !true/*this.shouldRun(runnable)*/) { // Patina
|
||||
+ // JettPack start
|
||||
+ if (this.next == null && !this.pendingRunnables.isEmpty()) {
|
||||
+ this.waitForTasks();
|
||||
+ }
|
||||
+
|
||||
+ if (this.next == null) {
|
||||
return false;
|
||||
} else {
|
||||
- this.doRunTask(this.pendingRunnables.remove());
|
||||
+ R r2 = this.next;
|
||||
+ this.next = null;
|
||||
+ this.doRunTask(r2);
|
||||
return true;
|
||||
}
|
||||
+ // JettPack end
|
||||
}
|
||||
|
||||
public void managedBlock(BooleanSupplier stopCondition) {
|
||||
@@ -144,8 +149,18 @@ public abstract class BlockableEventLoop<R extends Runnable> implements Profiler
|
||||
}
|
||||
|
||||
protected void waitForTasks() {
|
||||
- Thread.yield();
|
||||
- LockSupport.parkNanos("waiting for tasks", 100000L);
|
||||
+ // JettPack start
|
||||
+ if (this.next != null) {
|
||||
+ throw new IllegalStateException("next != null");
|
||||
+ }
|
||||
+ try {
|
||||
+ this.next = this.pendingRunnables.poll(100L, TimeUnit.MICROSECONDS);
|
||||
+ return;
|
||||
+ }
|
||||
+ catch (InterruptedException interruptedException) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // JettPack end
|
||||
}
|
||||
|
||||
protected void doRunTask(R task) {
|
||||
@@ -7,26 +7,61 @@ Subject: [PATCH] Use MCUtil.asyncExecutor for MAIN_WORKER_EXECUTOR in
|
||||
Original code by Titaniumtown, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://gitlab.com/Titaniumtown/JettPack
|
||||
|
||||
diff --git a/src/main/java/me/titaniumtown/ServerWorkerWrapper.java b/src/main/java/me/titaniumtown/ServerWorkerWrapper.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7bd88761137b2a68c04fbaa920a9ea9ce1f9e873
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/titaniumtown/ServerWorkerWrapper.java
|
||||
@@ -0,0 +1,24 @@
|
||||
+package me.titaniumtown;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import net.minecraft.Util;
|
||||
+
|
||||
+public final class ServerWorkerWrapper implements Runnable {
|
||||
+ private final Runnable internalRunnable;
|
||||
+
|
||||
+ public ServerWorkerWrapper(Runnable runnable) {
|
||||
+ this.internalRunnable = Preconditions.checkNotNull(runnable, "internalRunnable");
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public final void run() {
|
||||
+ try {
|
||||
+ this.internalRunnable.run();
|
||||
+ return;
|
||||
+ }
|
||||
+ catch (Throwable throwable) {
|
||||
+ Util.onThreadException(Thread.currentThread(), throwable);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
|
||||
index bc6600fe322ef9733233c0273e318f2c16f6d359..73693a3a7faaa2be24c367e351f75aeb0d0f2208 100644
|
||||
index eee3347a5fd1b1f4eb0bbee29483f0a81868cf16..e7acf1466bd7640d172f84a7a0e5a7e2eb0a0a37 100644
|
||||
--- a/src/main/java/net/minecraft/Util.java
|
||||
+++ b/src/main/java/net/minecraft/Util.java
|
||||
@@ -61,6 +61,10 @@ import net.minecraft.util.datafix.DataFixers;
|
||||
@@ -71,6 +71,12 @@ import net.minecraft.util.datafix.DataFixers;
|
||||
import net.minecraft.world.level.block.state.properties.Property;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.slf4j.Logger;
|
||||
+// JettPack start
|
||||
+import java.util.concurrent.AbstractExecutorService;
|
||||
+import wtf.etil.mirai.server.util.ServerWorkerWrapper;
|
||||
+import me.titaniumtown.ServerWorkerWrapper;
|
||||
+import net.minecraft.server.MCUtil;
|
||||
+import java.util.Collections;
|
||||
+// JettPack end
|
||||
|
||||
public class Util {
|
||||
static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -148,7 +152,43 @@ public class Util {
|
||||
@@ -158,7 +164,46 @@ public class Util {
|
||||
if (i <= 0) {
|
||||
executorService = MoreExecutors.newDirectExecutorService();
|
||||
} else {
|
||||
- executorService = new java.util.concurrent.ThreadPoolExecutor(i, i,0L, TimeUnit.MILLISECONDS, new java.util.concurrent.LinkedBlockingQueue<Runnable>(), target -> new net.minecraft.server.ServerWorkerThread(target, s, priorityModifier));
|
||||
+ //executorService = new java.util.concurrent.ThreadPoolExecutor(i, i,0L, TimeUnit.MILLISECONDS, new java.util.concurrent.LinkedBlockingQueue<Runnable>(), target -> new net.minecraft.server.ServerWorkerThread(target, s, priorityModifier)); // JettPack
|
||||
+ // JettPack start
|
||||
+ executorService = Integer.getInteger("Paper.WorkerThreadCount", i) <= 0 ? MoreExecutors.newDirectExecutorService() : new AbstractExecutorService(){
|
||||
+ private volatile boolean shutdown = false;
|
||||
+
|
||||
@@ -64,37 +99,7 @@ index bc6600fe322ef9733233c0273e318f2c16f6d359..73693a3a7faaa2be24c367e351f75aeb
|
||||
+ MCUtil.asyncExecutor.execute(new ServerWorkerWrapper(runnable));
|
||||
+ }
|
||||
+ };
|
||||
+ // JettPack end
|
||||
}
|
||||
/*
|
||||
@Override
|
||||
diff --git a/src/main/java/wtf/etil/mirai/server/util/ServerWorkerWrapper.java b/src/main/java/wtf/etil/mirai/server/util/ServerWorkerWrapper.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4633764f3d806c7e29cbda6e85db5a3432ad0c29
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/wtf/etil/mirai/server/util/ServerWorkerWrapper.java
|
||||
@@ -0,0 +1,24 @@
|
||||
+package wtf.etil.mirai.server.util;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import net.minecraft.Util;
|
||||
+
|
||||
+public final class ServerWorkerWrapper implements Runnable {
|
||||
+ private final Runnable internalRunnable;
|
||||
+
|
||||
+ public ServerWorkerWrapper(Runnable runnable) {
|
||||
+ this.internalRunnable = Preconditions.checkNotNull(runnable, "internalRunnable");
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public final void run() {
|
||||
+ try {
|
||||
+ this.internalRunnable.run();
|
||||
+ return;
|
||||
+ }
|
||||
+ catch (Throwable throwable) {
|
||||
+ Util.onThreadException(Thread.currentThread(), throwable);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
@@ -7,10 +7,10 @@ Original code by Titaniumtown, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://gitlab.com/Titaniumtown/JettPack
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index cea07f3898a85bf7949bdc3db3cfff7734d0ce03..760a1756cf210df2d012b7cd771f57695de54ea0 100644
|
||||
index 3e232156774b9df5be318dc6dc5035b326f1f1b3..43ae13cc8c3c1e7ed183d11fccba3ba3af14c8f4 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -439,7 +439,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -402,7 +402,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
BufferedWriter bufferedwriter = Files.newBufferedWriter(file);
|
||||
|
||||
try {
|
||||
@@ -20,10 +20,10 @@ index cea07f3898a85bf7949bdc3db3cfff7734d0ce03..760a1756cf210df2d012b7cd771f5769
|
||||
bufferedwriter.write(String.format("spawn-monsters=%s%n", dedicatedserverproperties.spawnMonsters));
|
||||
bufferedwriter.write(String.format("entity-broadcast-range-percentage=%d%n", dedicatedserverproperties.entityBroadcastRangePercentage));
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
index ebfaa8d5de5b905bd2dd7778728b8c9939d01252..1fd7b37a7da803af0e61d5341b7574d4f4a10da3 100644
|
||||
index 26345494ce190b5cd2ab58dd7d4b046796767b20..80c73f43987a66b941b456951f60c7a27082c36f 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
@@ -111,7 +111,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
||||
@@ -136,7 +136,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
||||
this.maxWorldSize = this.get("max-world-size", (integer) -> {
|
||||
return Mth.clamp(integer, (int) 1, 29999984);
|
||||
}, 29999984);
|
||||
@@ -7,10 +7,10 @@ Original code by Titaniumtown, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://gitlab.com/Titaniumtown/JettPack
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index af603994275c93842d2c3b6e9a7fcf0b0fbad168..f816ae7bf9a372aef8de769d4f6192e6ed9ac776 100644
|
||||
index c81520efe726efa7d6ac61c37f8eadc3cda5bc97..083b68897759640ca041a9d781b7ba7a07e5f8df 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -167,8 +167,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -177,8 +177,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
|
||||
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
|
||||
public static BlockPos lastPhysicsProblem; // Spigot
|
||||
@@ -21,35 +21,35 @@ index af603994275c93842d2c3b6e9a7fcf0b0fbad168..f816ae7bf9a372aef8de769d4f6192e6
|
||||
private int tileTickPosition;
|
||||
public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions
|
||||
public java.util.ArrayDeque<net.minecraft.world.level.block.RedstoneTorchBlock.Toggle> redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here
|
||||
@@ -355,8 +355,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -372,8 +372,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
// CraftBukkit end
|
||||
timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings
|
||||
this.keepSpawnInMemory = this.paperConfig.keepSpawnInMemory; // Paper
|
||||
this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper
|
||||
- this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime);
|
||||
- this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
|
||||
+ //this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); // JettPack - remove tick limiter
|
||||
+ //this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); // JettPack - remove tick limiter
|
||||
this.chunkPacketBlockController = this.paperConfig.antiXray ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray
|
||||
this.chunkPacketBlockController = this.paperConfig().anticheat.antiXray.enabled ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray
|
||||
this.entitySliceManager = new io.papermc.paper.world.EntitySliceManager((ServerLevel)this); // Paper
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 31a447e6e156b7b244b2ac69a9c03c09c7ed388c..c405457a775df902540602dfb4cdcd6872d35e2a 100644
|
||||
index bbf15fbb889670e57bd86377590a1b3abe80b96d..5a16e64d1555a74acca98966f1a6b2269280f366 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -433,6 +433,7 @@ public class SpigotWorldConfig
|
||||
@@ -435,6 +435,7 @@ public class SpigotWorldConfig
|
||||
this.hangingTickFrequency = this.getInt( "hanging-tick-frequency", 100 );
|
||||
}
|
||||
|
||||
+ /* // JettPack start - remove tick limiter
|
||||
+ /* // JettPack - remove tick limiter
|
||||
public int tileMaxTickTime;
|
||||
public int entityMaxTickTime;
|
||||
private void maxTickTimes()
|
||||
@@ -441,6 +442,8 @@ public class SpigotWorldConfig
|
||||
@@ -442,7 +443,7 @@ public class SpigotWorldConfig
|
||||
this.tileMaxTickTime = this.getInt("max-tick-time.tile", 50);
|
||||
this.entityMaxTickTime = this.getInt("max-tick-time.entity", 50);
|
||||
this.log("Tile Max Tick Time: " + this.tileMaxTickTime + "ms Entity max Tick Time: " + this.entityMaxTickTime + "ms");
|
||||
}
|
||||
+ */
|
||||
+ // JettPack end
|
||||
- }
|
||||
+ }*/
|
||||
|
||||
public int thunderChance;
|
||||
private void thunderChance()
|
||||
@@ -7,32 +7,32 @@ Original code by YatopiaMC, licensed under MIT
|
||||
You can find the original code on https://github.com/YatopiaMC/Yatopia
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index f0e7c7c84052f29349b60ad06ec4f9ee1771f4bb..62e348c46b7a48e83a5bed5bc7bfa0878e61bc3c 100644
|
||||
index ab084c7590ff777889dccbbb821bb099cdd7e215..1329314774a15be493703dac0031e8849865295f 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -316,7 +316,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -342,7 +342,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
++this.tickCount;
|
||||
this.knownMovePacketCount = this.receivedMovePacketCount;
|
||||
if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger()) {
|
||||
- if (++this.aboveGroundTickCount > 80) {
|
||||
+ if (wtf.etil.mirai.MiraiConfig.checkFlying && ++this.aboveGroundTickCount > 80) { // Yatopia - Configurable flight checks
|
||||
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString());
|
||||
this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickPlayerMessage, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_PLAYER); // Paper - use configurable kick message & kick event cause
|
||||
this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingPlayer, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_PLAYER); // Paper - use configurable kick message & kick event cause
|
||||
return;
|
||||
@@ -335,7 +335,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -361,7 +361,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
this.vehicleLastGoodY = this.lastVehicle.getY();
|
||||
this.vehicleLastGoodZ = this.lastVehicle.getZ();
|
||||
if (this.clientVehicleIsFloating && this.player.getRootVehicle().getControllingPassenger() == this.player) {
|
||||
- if (++this.aboveGroundVehicleTickCount > 80) {
|
||||
+ if (wtf.etil.mirai.MiraiConfig.checkVehicleFlying && ++this.aboveGroundVehicleTickCount > 80) { // Yatopia - Configurable flight checks
|
||||
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString());
|
||||
this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickVehicleMessage, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_VEHICLE); // Paper - use configurable kick message & kick event cause
|
||||
this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingVehicle, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_VEHICLE); // Paper - use configurable kick message & kick event cause
|
||||
return;
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index 667eaabe95e9b44cad64dd5aba5ac693f4d726ed..a24a35f3ef2812d2951fb13439f856ee9495226b 100644
|
||||
index 667eaabe95e9b44cad64dd5aba5ac693f4d726ed..8740dbbc4068ad329eb53ee13683a77903fe6d02 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -194,4 +194,13 @@ public class MiraiConfig {
|
||||
@@ -194,4 +194,11 @@ public class MiraiConfig {
|
||||
maxBees = getInt("max-bees-in-hive", maxBees);
|
||||
}
|
||||
|
||||
@@ -42,8 +42,6 @@ index 667eaabe95e9b44cad64dd5aba5ac693f4d726ed..a24a35f3ef2812d2951fb13439f856ee
|
||||
+ checkFlying = getBoolean("checks.flight", checkFlying);
|
||||
+ checkVehicleFlying = getBoolean("checks.vehicle-flight", checkVehicleFlying);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+
|
||||
}
|
||||
\ No newline at end of file
|
||||
@@ -7,7 +7,7 @@ Original code by Starlis, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://github.com/starlis/empirecraft
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
|
||||
index 5a062a19bb2fc427c9391bb4731f071719b72c52..76110656d922fc734df5b08cb24eecf4dc97e38c 100644
|
||||
index 5406925cd66f46ab8744123c670d72cea7bfc3a1..ba9b29db6d6b9e73e1b8d305ad1d7e855290e758 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
|
||||
@@ -358,4 +358,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
|
||||
@@ -7,14 +7,14 @@ Original code by Starlis, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://github.com/starlis/empirecraft
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/commands/GiveCommand.java b/src/main/java/net/minecraft/server/commands/GiveCommand.java
|
||||
index a60a84d5df0b05cf35668df8c5f08b811bc42a9f..b76f315355407b3c4b8efb490acc4848a4a67934 100644
|
||||
index 06e3a868e922f1b7a586d0ca28f64a67ae463b68..00c481ebf012efa5424e32521e7aecf4b36f24c0 100644
|
||||
--- a/src/main/java/net/minecraft/server/commands/GiveCommand.java
|
||||
+++ b/src/main/java/net/minecraft/server/commands/GiveCommand.java
|
||||
@@ -56,6 +56,7 @@ public class GiveCommand {
|
||||
ItemStack itemstack = item.createItemStack(i1, false);
|
||||
@@ -58,6 +58,7 @@ public class GiveCommand {
|
||||
boolean flag = entityplayer.getInventory().add(itemstack);
|
||||
ItemEntity entityitem;
|
||||
+ if (true) { continue; } // EMC - never drop items
|
||||
|
||||
+ if (true) { continue; } // EMC - never drop items
|
||||
if (flag && itemstack.isEmpty()) {
|
||||
itemstack.setCount(1);
|
||||
entityitem = entityplayer.drop(itemstack, false, false, false); // SPIGOT-2942: Add boolean to call event
|
||||
@@ -7,14 +7,14 @@ Original code by Starlis, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://github.com/starlis/empirecraft
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 62e348c46b7a48e83a5bed5bc7bfa0878e61bc3c..f31fc4a40d817a4115159bca39b7f907fdc765a9 100644
|
||||
index 1329314774a15be493703dac0031e8849865295f..a3b5b52f7e597dc128281eb8ff9c60e0836bab98 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2107,6 +2107,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
private void handleChat(TextFilter.FilteredText message) {
|
||||
if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales
|
||||
this.send(new ClientboundChatPacket((new TranslatableComponent("chat.disabled.options")).withStyle(ChatFormatting.RED), ChatType.SYSTEM, Util.NIL_UUID));
|
||||
+ } else if (!player.didPlayerJoinEvent) { return; // EMC - do not handle chat messages before they joined
|
||||
@@ -2210,6 +2210,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
|
||||
this.send(new ClientboundSystemChatPacket(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED), i));
|
||||
return false;
|
||||
+ } else if (!player.didPlayerJoinEvent) { return false; // EMC - do not handle chat messages before they joined
|
||||
} else {
|
||||
this.player.resetLastActionTime();
|
||||
String s = message.getRaw();
|
||||
return true;
|
||||
@@ -7,7 +7,7 @@ Original code by PurpurMC, licensed under MIT
|
||||
You can find the original code on https://github.com/PurpurMC/Purpur
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java b/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
index 6d4dc4b09278eca509f86655c6562fb4b05d5069..53a081af5b6a386ebde1765c7cedff372ffbd7b2 100644
|
||||
index e84d4ecc1fd8e196743a37b18306a4769abbcb77..a715465611be53dc94770feee0f13381f7d82e24 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
@@ -180,7 +180,13 @@ public class MushroomCow extends Cow implements Shearable {
|
||||
@@ -1,36 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 16 Mar 2020 03:07:02 -0400
|
||||
Subject: [PATCH] Don't load chunks for physics
|
||||
|
||||
Original code by Starlis, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://github.com/starlis/empirecraft
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index f816ae7bf9a372aef8de769d4f6192e6ed9ac776..14e4f5c376126c264d59266ddeeafff764eabc40 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -855,7 +855,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
|
||||
public void neighborChanged(BlockPos pos, Block sourceBlock, BlockPos neighborPos) {
|
||||
if (!this.isClientSide) {
|
||||
- BlockState iblockdata = this.getBlockState(pos);
|
||||
+ BlockState iblockdata = this.getBlockStateIfLoaded(pos); // EMC
|
||||
+ if (iblockdata == null) return; // EMC
|
||||
|
||||
try {
|
||||
// CraftBukkit start
|
||||
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 7f83c9390823b42fc30d04e1d3222e2825eaad50..a1231d2347de63db9e607519328063dbed62b4c9 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
|
||||
@@ -987,7 +987,8 @@ public abstract class BlockBehaviour {
|
||||
Direction enumdirection = aenumdirection[l];
|
||||
|
||||
blockposition_mutableblockposition.setWithOffset(pos, enumdirection);
|
||||
- BlockState iblockdata = world.getBlockState(blockposition_mutableblockposition);
|
||||
+ BlockState iblockdata = world.getBlockStateIfLoaded(blockposition_mutableblockposition); // EMC
|
||||
+ if (iblockdata == null) { continue; } // EMC
|
||||
BlockState iblockdata1 = iblockdata.updateShape(enumdirection.getOpposite(), this.asState(), world, blockposition_mutableblockposition, pos);
|
||||
|
||||
Block.updateOrDestroy(iblockdata, iblockdata1, world, blockposition_mutableblockposition, flags, maxUpdateDepth);
|
||||
@@ -7,7 +7,7 @@ Original code by PurpurMC, licensed under MIT
|
||||
You can find the original code on https://github.com/PurpurMC/Purpur
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
|
||||
index 4e435a16a16c703a2978f4dc82606b8710742670..a952f19530983ca9a72969ad25f9565a2a03688a 100644
|
||||
index 56d68b87287f0bb2c79ce0bed02fa333b85c4287..5c7e30eb5e8a2a1ab18750a2cd2ec7364e8c52e0 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
|
||||
@@ -177,6 +177,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
|
||||
@@ -3,19 +3,22 @@ From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Wed, 4 Nov 2020 13:12:50 -0600
|
||||
Subject: [PATCH] Arrows should not reset despawn counter
|
||||
|
||||
This prevents keeping arrows alive indefinitely (such as when the block
|
||||
the arrow is stuck in gets removed, like a piston head going up/down)
|
||||
|
||||
Original code by PurpurMC, licensed under MIT
|
||||
You can find the original code on https://github.com/PurpurMC/Purpur
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
index 53d0024daf6963ac4dab575666b0d6a74a39a958..26cf6291d64561a589bc6c357a90bcaffad89ded 100644
|
||||
index bc01e5014e1355a225bdf5c47f2965290b45e2d2..49f093b21aa1268d40aa54ebfce06976bd79ae81 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
@@ -321,7 +321,7 @@ public abstract class AbstractArrow extends Projectile {
|
||||
@@ -322,7 +322,7 @@ public abstract class AbstractArrow extends Projectile {
|
||||
Vec3 vec3d = this.getDeltaMovement();
|
||||
|
||||
this.setDeltaMovement(vec3d.multiply((double) (this.random.nextFloat() * 0.2F), (double) (this.random.nextFloat() * 0.2F), (double) (this.random.nextFloat() * 0.2F)));
|
||||
- this.life = 0;
|
||||
+ //this.life = 0; // Purpur - do not reset despawn counter
|
||||
+ // this.life = 0; // Purpur - do not reset despawn counter
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,100 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 21 Dec 2020 17:24:43 -0500
|
||||
Subject: [PATCH] Always convert Lore/Name of an item to ensure consistency
|
||||
|
||||
Original code by Starlis, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://github.com/starlis/empirecraft
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 586ce0bec1ab2a17a3818690e47be23643cd5a48..ceea5592b2964365b533c1641fdd9ee83f821e34 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -176,9 +176,9 @@ public final class ItemStack {
|
||||
if (display != null) {
|
||||
if (display.contains("Name", 8)) {
|
||||
String json = display.getString("Name");
|
||||
- if (json != null && json.contains("\u00A7")) {
|
||||
+ if (true || json != null && json.contains("\u00A7")) {
|
||||
try {
|
||||
- display.put("Name", convert(json));
|
||||
+ display.put("Name", convert(json)); // Paper
|
||||
} catch (com.google.gson.JsonParseException jsonparseexception) {
|
||||
display.remove("Name");
|
||||
}
|
||||
@@ -188,7 +188,7 @@ public final class ItemStack {
|
||||
ListTag list = display.getList("Lore", 8);
|
||||
for (int index = 0; index < list.size(); index++) {
|
||||
String json = list.getString(index);
|
||||
- if (json != null && json.contains("\u00A7")) { // Only try if it has legacy in the unparsed json
|
||||
+ if (true || json != null && json.contains("\u00A7")) { // Only try if it has legacy in the unparsed json // Paper
|
||||
try {
|
||||
list.set(index, convert(json));
|
||||
} catch (com.google.gson.JsonParseException e) {
|
||||
@@ -205,6 +205,9 @@ public final class ItemStack {
|
||||
if (component instanceof TextComponent && component.getContents().contains("\u00A7") && component.getSiblings().isEmpty()) {
|
||||
// Only convert if the root component is a single comp with legacy in it, don't convert already normal components
|
||||
component = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(component.getContents())[0];
|
||||
+ } else {
|
||||
+ // pass this to legacy format and back to strip invisible components and ensure consistent modifier format
|
||||
+ component = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(org.bukkit.craftbukkit.util.CraftChatMessage.fromComponent(component))[0];
|
||||
}
|
||||
return net.minecraft.nbt.StringTag.valueOf(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(component));
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index 5607dc10dc1c9d2dbf4e3007890e5e89a175605e..c24793eeff34281194292bd83c5361a56ebea301 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -687,7 +687,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@Overridden
|
||||
void applyToItem(CompoundTag itemTag) {
|
||||
if (this.hasDisplayName()) {
|
||||
- this.setDisplayTag(itemTag, NAME.NBT, StringTag.valueOf(displayName));
|
||||
+ this.setDisplayTag(itemTag, NAME.NBT, StringTag.valueOf(CraftChatMessage.reencode(displayName))); // Paper
|
||||
}
|
||||
if (this.hasLocalizedName()) {
|
||||
this.setDisplayTag(itemTag, LOCNAME.NBT, StringTag.valueOf(locName));
|
||||
@@ -779,7 +779,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
ListTag tagList = new ListTag();
|
||||
for (String value : list) {
|
||||
// SPIGOT-5342 - horrible hack as 0 version does not go through the Mojang updater
|
||||
- tagList.add(StringTag.valueOf(this.version <= 0 || this.version >= 1803 ? value : CraftChatMessage.fromJSONComponent(value))); // SPIGOT-4935
|
||||
+ tagList.add(StringTag.valueOf(this.version <= 0 || this.version >= 1803 ? CraftChatMessage.reencode(value) : CraftChatMessage.fromJSONComponent(value))); // SPIGOT-4935 // Paper
|
||||
}
|
||||
|
||||
return tagList;
|
||||
@@ -882,7 +882,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
// Paper end
|
||||
@Override
|
||||
public final void setDisplayName(String name) {
|
||||
- this.displayName = CraftChatMessage.fromStringOrNullToJSON(name);
|
||||
+ this.displayName = CraftChatMessage.fromStringOrNullToJSON(CraftChatMessage.reencode(name)); // Paper
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@@ -1557,7 +1557,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
if (possiblyJsonInput) {
|
||||
addTo.add(CraftChatMessage.fromJSONOrStringToJSON(entry));
|
||||
} else {
|
||||
- addTo.add(CraftChatMessage.fromStringToJSON(entry));
|
||||
+ addTo.add(CraftChatMessage.fromStringToJSON(CraftChatMessage.reencode(entry)));
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||
index 26d43c229caf9f8504af7071c3a61ec6da7e27ec..6e8edc80dd7dfa867901769fda82706746f1bcc5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||
@@ -41,6 +41,12 @@ public final class CraftChatMessage {
|
||||
return ChatColor.getByChar(format.code);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public static String reencode(String string) {
|
||||
+ return CraftChatMessage.fromComponent(CraftChatMessage.fromString(string)[0]);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
private static final class StringMessage {
|
||||
private static final Pattern INCREMENTAL_PATTERN = Pattern.compile("(" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + "[0-9a-fk-orx])|((?:(?:https?):\\/\\/)?(?:[-\\w_\\.]{2,}\\.[a-z]{2,4}.*?(?=[\\.\\?!,;:]?(?:[" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + " \\n]|$))))|(\\n)", Pattern.CASE_INSENSITIVE);
|
||||
// Separate pattern with no group 3, new lines are part of previous string
|
||||
@@ -8,10 +8,10 @@ Original code by PurpurMC, licensed under MIT
|
||||
You can find the original code on https://github.com/PurpurMC/Purpur
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index ba8e58fe70f16dbc0b64a92264d29c91461d2cdf..93b97bb18f13d533d228d5912d08fbcce664ac06 100644
|
||||
index db4b6d7fe91c1a071a833db842f664ec6ba51932..7502f715849fdefc96ad9808cd2070d366bb85da 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1028,22 +1028,21 @@ public abstract class PlayerList {
|
||||
@@ -1031,22 +1031,22 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
@@ -36,21 +36,22 @@ index ba8e58fe70f16dbc0b64a92264d29c91461d2cdf..93b97bb18f13d533d228d5912d08fbcc
|
||||
+ }
|
||||
}
|
||||
- // CraftBukkit end
|
||||
- this.sendAllPlayerInfoIn = 0;
|
||||
+ target.getHandle().connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.UPDATE_LATENCY, list));
|
||||
+ }
|
||||
+ if (++this.sendAllPlayerInfoIn > 600) {
|
||||
this.sendAllPlayerInfoIn = 0;
|
||||
}
|
||||
-
|
||||
|
||||
+ if (++this.sendAllPlayerInfoIn > 600) {
|
||||
+ this.sendAllPlayerInfoIn = 0;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
public void broadcastAll(Packet<?> packet) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index ce78e024244c14530270b8276e5b0fd853f0a110..170c7469ac6ed343a8e4e43f03a972d106bcc640 100644
|
||||
index abcce6bd0b32d0188751393a6f56f2e82530912c..97dab75ac1ec2b22ac00392b6b22f63fab70b17f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1732,7 +1732,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -1729,7 +1729,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@Override
|
||||
public boolean canSee(org.bukkit.entity.Entity entity) {
|
||||
@@ -1,21 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: chickeneer <emcchickeneer@gmail.com>
|
||||
Date: Sat, 6 Jun 2020 21:07:15 -0500
|
||||
Subject: [PATCH] Bound villager trade maxUses by 16
|
||||
|
||||
Original code by Starlis, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://github.com/starlis/empirecraft
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
|
||||
index c9cb0717c2793acd5b5870a6cc4d672d69a40026..40385c7b267ecd1e00e4daa652b94533cc8febea 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
|
||||
@@ -53,7 +53,7 @@ public class MerchantOffer {
|
||||
this.result = ItemStack.of(nbt.getCompound("sell"));
|
||||
this.uses = nbt.getInt("uses");
|
||||
if (nbt.contains("maxUses", 99)) {
|
||||
- this.maxUses = nbt.getInt("maxUses");
|
||||
+ this.maxUses = Math.min(16, nbt.getInt("maxUses")); // EMC
|
||||
} else {
|
||||
this.maxUses = 4;
|
||||
}
|
||||
@@ -19,7 +19,7 @@ index d65defd5fc54086a969c568b93dfb05f40dd5a44..dad5564caa9f0211d8f8321a80dcec7e
|
||||
public void removeCommand(String name) {
|
||||
this.children.remove(name);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
|
||||
index 4525fb3bc9b137bce3b59310a8aecca96d6ad5ba..75aeceb76b15a4c9cc7cffc35d15d76509c5620a 100644
|
||||
index 6035af2cf08353b3d3801220d8116d8611a0cd37..7774ab6a2e553a40def4bb4dceea9e5f58d31c1e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
|
||||
@@ -94,6 +94,7 @@ public final class VanillaCommandWrapper extends BukkitCommand {
|
||||
@@ -7,17 +7,17 @@ Original code by PurpurMC, licensed under MIT
|
||||
You can find the original code on https://github.com/PurpurMC/Purpur
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java b/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java
|
||||
index 0df98efa509518a14d6f76dca9356cee2655a703..a300049a515092b46292c6b05bf057c7b6ce9f62 100644
|
||||
index 8808cb9f5df43d781cbb9c7943ff2f222e3a6969..09877498034dafccd20705670acd2866df7bd3a1 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java
|
||||
@@ -91,8 +91,9 @@ public class CatSpawner implements CustomSpawner {
|
||||
@@ -87,8 +87,9 @@ public class CatSpawner implements CustomSpawner {
|
||||
if (cat == null) {
|
||||
return 0;
|
||||
} else {
|
||||
+ cat.moveTo(pos, 0.0F, 0.0F); // Purpur
|
||||
cat.finalizeSpawn(world, world.getCurrentDifficultyAt(pos), MobSpawnType.NATURAL, (SpawnGroupData)null, (CompoundTag)null);
|
||||
- cat.moveTo(pos, 0.0F, 0.0F);
|
||||
+ //cat.moveTo(pos, 0.0F, 0.0F); // Purpur - move up - fixes non black cat types spawning inside swamp huts
|
||||
+ // cat.moveTo(pos, 0.0F, 0.0F); // Purpur - move up - fixes non black cat types spawning inside swamp huts
|
||||
world.addFreshEntityWithPassengers(cat);
|
||||
return 1;
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: chickeneer <emcchickeneer@gmail.com>
|
||||
Date: Mon, 6 Sep 2021 02:05:16 -0500
|
||||
Subject: [PATCH] Mitigate ConcurrentModificationException by copying
|
||||
entitySection access
|
||||
|
||||
Original code by Starlis, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://github.com/starlis/empirecraft
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
|
||||
index 3d5f38a1ca0206e5bcae4ed49d3df7ce0967f722..649df137ac36a62e53b42b7675c606e9e57795b2 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
|
||||
@@ -264,23 +264,23 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
|
||||
if (flag2 && !flag3) {
|
||||
entitysection.getEntities().filter((entityaccess) -> {
|
||||
return !entityaccess.isAlwaysTicking();
|
||||
- }).forEach(this::stopTicking);
|
||||
+ }).collect(Collectors.toList()).forEach(this::stopTicking); // EMC
|
||||
}
|
||||
|
||||
if (flag && !flag1) {
|
||||
entitysection.getEntities().filter((entityaccess) -> {
|
||||
return !entityaccess.isAlwaysTicking();
|
||||
- }).forEach(this::stopTracking);
|
||||
+ }).collect(Collectors.toList()).forEach(this::stopTracking); // EMC
|
||||
} else if (!flag && flag1) {
|
||||
entitysection.getEntities().filter((entityaccess) -> {
|
||||
return !entityaccess.isAlwaysTicking();
|
||||
- }).forEach(this::startTracking);
|
||||
+ }).collect(Collectors.toList()).forEach(this::startTracking); // EMC
|
||||
}
|
||||
|
||||
if (!flag2 && flag3) {
|
||||
entitysection.getEntities().filter((entityaccess) -> {
|
||||
return !entityaccess.isAlwaysTicking();
|
||||
- }).forEach(this::startTicking);
|
||||
+ }).collect(Collectors.toList()).forEach(this::startTicking); // EMC
|
||||
}
|
||||
|
||||
});
|
||||
@@ -7,10 +7,10 @@ Original code by PurpurMC, licensed under MIT
|
||||
You can find the original code on https://github.com/PurpurMC/Purpur
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java
|
||||
index 4be4d9e6611dc3b7a34dbf2f5d6990bc0980ee63..92789a27aa2978ac323d4cdafa82391998cf0ffa 100644
|
||||
index ee725b972d3d5fb22538aaff9c72e47c6bad0cea..2217968eb5ecac0a2063cf1eae7d754d760e9f28 100644
|
||||
--- a/src/main/java/net/minecraft/core/Direction.java
|
||||
+++ b/src/main/java/net/minecraft/core/Direction.java
|
||||
@@ -247,6 +247,12 @@ public enum Direction implements StringRepresentable {
|
||||
@@ -252,6 +252,12 @@ public enum Direction implements StringRepresentable {
|
||||
case EAST:
|
||||
var10000 = SOUTH;
|
||||
break;
|
||||
@@ -23,7 +23,7 @@ index 4be4d9e6611dc3b7a34dbf2f5d6990bc0980ee63..92789a27aa2978ac323d4cdafa823919
|
||||
default:
|
||||
throw new IllegalStateException("Unable to get Y-rotated facing of " + this);
|
||||
}
|
||||
@@ -359,6 +365,12 @@ public enum Direction implements StringRepresentable {
|
||||
@@ -364,6 +370,12 @@ public enum Direction implements StringRepresentable {
|
||||
case EAST:
|
||||
var10000 = NORTH;
|
||||
break;
|
||||
@@ -7,10 +7,10 @@ Original code by PurpurMC, licensed under MIT
|
||||
You can find the original code on https://github.com/PurpurMC/Purpur
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index 298c20e4abc04a8bdc93719c282d0b4ef4560819..29ac511169182f399c903638b941796dd5d08e7e 100644
|
||||
index dab3d736ae60b255b3151ddcf2b5832c14ecef53..92331bc1893142345a5e70cc6a0c64fdb17f4b74 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -265,7 +265,7 @@ public class Main {
|
||||
@@ -270,7 +270,7 @@ public class Main {
|
||||
System.setProperty(TerminalConsoleAppender.JLINE_OVERRIDE_PROPERTY, "false"); // Paper
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ Original code by PurpurMC, licensed under MIT
|
||||
You can find the original code on https://github.com/PurpurMC/Purpur
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
|
||||
index 4fa79d37ff4e70c61672cce7c55257c46232c026..df43d0a0f3d1e34baabae150cbf01a008eb5a588 100644
|
||||
index 29a22da1b94d51300481c071aa16bfd8cd02178f..f67cbb1badc007987e62872bb0160ad6d05e3d97 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
|
||||
@@ -153,6 +153,7 @@ public class ServerStatusPacketListenerImpl implements ServerStatusPacketListene
|
||||
@@ -7,10 +7,10 @@ Original code by PurpurMC, licensed under MIT
|
||||
You can find the original code on https://github.com/PurpurMC/Purpur
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 44560edcf339c1749b9df78e6e57075499d5813d..2d7e884d25f352e0a05e9aefb0ff6e296e73c361 100644
|
||||
index 9901ffe9de585a73e9ef32c700b1e8702f8786d3..aa1bd3423829900729d413a5f98f4a0b9aaf6135 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -190,6 +190,7 @@ public class ServerEntity {
|
||||
@@ -181,6 +181,7 @@ public class ServerEntity {
|
||||
this.teleportDelay = 0;
|
||||
packet1 = new ClientboundTeleportEntityPacket(this.entity);
|
||||
}
|
||||
@@ -18,7 +18,7 @@ index 44560edcf339c1749b9df78e6e57075499d5813d..2d7e884d25f352e0a05e9aefb0ff6e29
|
||||
}
|
||||
|
||||
if ((this.trackDelta || this.entity.hasImpulse || this.entity instanceof LivingEntity && ((LivingEntity) this.entity).isFallFlying()) && this.tickCount > 0) {
|
||||
@@ -258,6 +259,22 @@ public class ServerEntity {
|
||||
@@ -247,6 +248,22 @@ public class ServerEntity {
|
||||
|
||||
}
|
||||
|
||||
@@ -42,10 +42,10 @@ index 44560edcf339c1749b9df78e6e57075499d5813d..2d7e884d25f352e0a05e9aefb0ff6e29
|
||||
this.entity.stopSeenByPlayer(player);
|
||||
player.connection.send(new ClientboundRemoveEntitiesPacket(new int[]{this.entity.getId()}));
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index a24a35f3ef2812d2951fb13439f856ee9495226b..8be485f3f68f42e09058fc543485137e03056266 100644
|
||||
index 8740dbbc4068ad329eb53ee13683a77903fe6d02..0d5ebaad9c3dcedf6554e41074ecaff7659ff510 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -201,6 +201,11 @@ public class MiraiConfig {
|
||||
@@ -201,4 +201,9 @@ public class MiraiConfig {
|
||||
checkVehicleFlying = getBoolean("checks.vehicle-flight", checkVehicleFlying);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,5 @@ index a24a35f3ef2812d2951fb13439f856ee9495226b..8be485f3f68f42e09058fc543485137e
|
||||
+ dontSendUselessEntityPackets = getBoolean("dont-send-useless-entity-packets", dontSendUselessEntityPackets);
|
||||
+ }
|
||||
+
|
||||
|
||||
|
||||
}
|
||||
\ No newline at end of file
|
||||
@@ -7,10 +7,10 @@ Original code by PurpurMC, licensed under MIT
|
||||
You can find the original code on https://github.com/PurpurMC/Purpur
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index b66afde6851ceaeccb84aea00cdc333dfbf3d4b0..c79c89bab8972a26c7a48f63ad20ac34b0fc8750 100644
|
||||
index ea5f0600d47b0f7c08b96eed91e5de255114637b..02add91d477dfef1bafa39c28b23dfc09418c939 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -391,6 +391,7 @@ public class Commands {
|
||||
@@ -393,6 +393,7 @@ public class Commands {
|
||||
}
|
||||
|
||||
private void runSync(ServerPlayer player, Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootcommandnode) {
|
||||
@@ -18,7 +18,7 @@ index b66afde6851ceaeccb84aea00cdc333dfbf3d4b0..c79c89bab8972a26c7a48f63ad20ac34
|
||||
// Paper end - Async command map building
|
||||
new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent<CommandSourceStack>(player.getBukkitEntity(), (RootCommandNode) rootcommandnode, false).callEvent(); // Paper
|
||||
PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit));
|
||||
@@ -403,6 +404,7 @@ public class Commands {
|
||||
@@ -405,6 +406,7 @@ public class Commands {
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -7,10 +7,10 @@ Original code by PurpurMC, licensed under MIT
|
||||
You can find the original code on https://github.com/PurpurMC/Purpur
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 38cb136d34cbc83dde1c766196f60a30d38005e3..5744b25104d3b73cedda3c88945dfce1db265b1e 100644
|
||||
index e6d25ab2e7e19d9fb993fdad6f650212f560cc1d..a277646003fbec7e4bc8ca301a0934eeeac1151d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1782,6 +1782,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1870,6 +1870,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
this.yRotO = this.getYRot();
|
||||
this.xRotO = this.getXRot();
|
||||
this.setYHeadRot(yaw); // Paper - Update head rotation
|
||||
@@ -19,10 +19,10 @@ index 38cb136d34cbc83dde1c766196f60a30d38005e3..5744b25104d3b73cedda3c88945dfce1
|
||||
|
||||
public void absMoveTo(double x, double y, double z) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index f646545ee7178717c1e3bb48e98fd2af2af745e0..8e5c8d1e59af15a0b28a8e28e60e50d2ec3b23f9 100644
|
||||
index d8f7361960eff24022a15505dec00613310db3b0..b7a9f16fb75d7664b6788d20d9b4a07459866dac 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2935,7 +2935,7 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -2967,7 +2967,7 @@ public abstract class LivingEntity extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@ Original code by PurpurMC, licensed under MIT
|
||||
You can find the original code on https://github.com/PurpurMC/Purpur
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index f31fc4a40d817a4115159bca39b7f907fdc765a9..de99c84622ff69f3f8707d92aacd5e9a1d980ccf 100644
|
||||
index a3b5b52f7e597dc128281eb8ff9c60e0836bab98..531cbee70d491adf5dee3b7c3ee10d0859506245 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -227,6 +227,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -245,6 +245,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
private long keepAliveTime = Util.getMillis();
|
||||
private boolean keepAlivePending;
|
||||
private long keepAliveChallenge;
|
||||
@@ -18,7 +18,7 @@ index f31fc4a40d817a4115159bca39b7f907fdc765a9..de99c84622ff69f3f8707d92aacd5e9a
|
||||
// CraftBukkit start - multithreaded fields
|
||||
private final AtomicInteger chatSpamTickCount = new AtomicInteger();
|
||||
private final java.util.concurrent.atomic.AtomicInteger tabSpamLimiter = new java.util.concurrent.atomic.AtomicInteger(); // Paper - configurable tab spam limits
|
||||
@@ -356,6 +357,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -382,6 +383,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
long currentTime = Util.getMillis();
|
||||
long elapsedTime = currentTime - this.keepAliveTime;
|
||||
|
||||
@@ -27,7 +27,7 @@ index f31fc4a40d817a4115159bca39b7f907fdc765a9..de99c84622ff69f3f8707d92aacd5e9a
|
||||
+ if (elapsedTime >= 1000L) { // 1 second
|
||||
+ if (!processedDisconnect && keepAlives.size() > KEEPALIVE_LIMIT) {
|
||||
+ LOGGER.warn("{} was kicked due to keepalive timeout!", player.getName());
|
||||
+ disconnect(new TranslatableComponent("disconnect.timeout"));
|
||||
+ disconnect(Component.translatable("disconnect.timeout"));
|
||||
+ } else {
|
||||
+ keepAliveTime = currentTime; // hijack this field for 1 second intervals
|
||||
+ keepAlives.add(currentTime); // currentTime is ID
|
||||
@@ -40,7 +40,7 @@ index f31fc4a40d817a4115159bca39b7f907fdc765a9..de99c84622ff69f3f8707d92aacd5e9a
|
||||
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
|
||||
@@ -3137,6 +3153,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -3326,6 +3342,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
|
||||
@Override
|
||||
public void handleKeepAlive(ServerboundKeepAlivePacket packet) {
|
||||
@@ -54,14 +54,14 @@ index f31fc4a40d817a4115159bca39b7f907fdc765a9..de99c84622ff69f3f8707d92aacd5e9a
|
||||
+ }
|
||||
+ } else
|
||||
+ // Purpur end
|
||||
//PlayerConnectionUtils.ensureMainThread(packetplayinkeepalive, this, this.player.getWorldServer()); // CraftBukkit // Paper - This shouldn't be on the main thread
|
||||
//PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // CraftBukkit // Paper - This shouldn't be on the main thread
|
||||
if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) {
|
||||
int i = (int) (Util.getMillis() - this.keepAliveTime);
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index 8be485f3f68f42e09058fc543485137e03056266..ee0b35e703b1930b32a01b5fa532fdbaf60127c4 100644
|
||||
index 0d5ebaad9c3dcedf6554e41074ecaff7659ff510..954bc508fea71af719c3203f0d4c93125976fdb8 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -206,6 +206,11 @@ public class MiraiConfig {
|
||||
@@ -206,4 +206,9 @@ public class MiraiConfig {
|
||||
dontSendUselessEntityPackets = getBoolean("dont-send-useless-entity-packets", dontSendUselessEntityPackets);
|
||||
}
|
||||
|
||||
@@ -70,7 +70,5 @@ index 8be485f3f68f42e09058fc543485137e03056266..ee0b35e703b1930b32a01b5fa532fdba
|
||||
+ useAlternateKeepAlive = getBoolean("use-alternate-keepalive", useAlternateKeepAlive);
|
||||
+ }
|
||||
+
|
||||
|
||||
|
||||
}
|
||||
\ No newline at end of file
|
||||
@@ -7,10 +7,10 @@ Original code by PurpurMC, licensed under MIT
|
||||
You can find the original code on https://github.com/PurpurMC/Purpur
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
index b16287a47870978706734b928b87f2357e91e3a1..5a80d307487fb824e7b59ac188760bafd06871e1 100644
|
||||
index de0513b38e5fa0138f1cee6bb633561be12449fc..ef0625c0f860eeedcdc1e3b8801e15631c76cb7a 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
@@ -186,6 +186,7 @@ public class PlayerAdvancements {
|
||||
@@ -185,6 +185,7 @@ public class PlayerAdvancements {
|
||||
if (advancement == null) {
|
||||
// CraftBukkit start
|
||||
if (entry.getKey().getNamespace().equals("minecraft")) {
|
||||
@@ -18,6 +18,31 @@ index b16287a47870978706734b928b87f2357e91e3a1..5a80d307487fb824e7b59ac188760baf
|
||||
PlayerAdvancements.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.file);
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
index f000c822ed4563b5b840936852bc7d8e030763e3..d37ba3fec0e4011629a5fbc88d377d52267ad395 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
@@ -293,6 +293,7 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
|
||||
return true;
|
||||
} else {
|
||||
+ if (!wtf.etil.mirai.MiraiConfig.loggerSuppressSetBlockFarChunk) // Purpur
|
||||
// Paper start
|
||||
if (!hasSetFarWarned) {
|
||||
Util.logAndPauseIfInIde("Detected setBlock in a far chunk [" + i + ", " + j + "], pos: " + pos + ", status: " + this.generatingStatus + (this.currentlyGenerating == null ? "" : ", currently generating: " + (String) this.currentlyGenerating.get()));
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 531cbee70d491adf5dee3b7c3ee10d0859506245..3c2fc286a481fad43a3c545485ef229760b4cacf 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2182,7 +2182,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
}); // Paper - push to main
|
||||
return false;
|
||||
} else {
|
||||
- if (this.isChatExpired(instant)) {
|
||||
+ if (!wtf.etil.mirai.MiraiConfig.loggerSuppressSentExpiredChat && this.isChatExpired(instant)) { // Purpur
|
||||
ServerGamePacketListenerImpl.LOGGER.warn("{} sent expired chat: '{}'. Is the client/server system time unsynchronized?", this.player.getName().getString(), s);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/stats/ServerRecipeBook.java b/src/main/java/net/minecraft/stats/ServerRecipeBook.java
|
||||
index d13ed3069e944d138442ea440ac3eaf8d44c18d3..c19367bdad3997aa7aac609762f9cf731433adfc 100644
|
||||
--- a/src/main/java/net/minecraft/stats/ServerRecipeBook.java
|
||||
@@ -43,23 +68,25 @@ index b2a15c986c7500a0ce227a54cb61ec3f5378f6f3..d243af83f3159d8a4d56d08dab022b31
|
||||
if (MinecraftServer.getServer() != null && MinecraftServer.getServer().isDebugging()) {
|
||||
new Exception().printStackTrace();
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index ee0b35e703b1930b32a01b5fa532fdbaf60127c4..ede41bc4ab49065cc06e66189610791cab01b39d 100644
|
||||
index 954bc508fea71af719c3203f0d4c93125976fdb8..8d3dcc1ebacd86412858680a9b3f8c018890b02b 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -211,6 +211,15 @@ public class MiraiConfig {
|
||||
@@ -211,4 +211,17 @@ public class MiraiConfig {
|
||||
useAlternateKeepAlive = getBoolean("use-alternate-keepalive", useAlternateKeepAlive);
|
||||
}
|
||||
|
||||
+ public static boolean loggerSuppressInitLegacyMaterialError = true;
|
||||
+ public static boolean loggerSuppressIgnoredAdvancementWarnings = true;
|
||||
+ public static boolean loggerSuppressUnrecognizedRecipeErrors = true;
|
||||
+ public static boolean loggerSuppressSetBlockFarChunk = true;
|
||||
+ public static boolean loggerSuppressSentExpiredChat = true;
|
||||
+ private static void loggerSettings() {
|
||||
+ loggerSuppressInitLegacyMaterialError = getBoolean("logger.suppress-init-legacy-material-errors", loggerSuppressInitLegacyMaterialError);
|
||||
+ loggerSuppressIgnoredAdvancementWarnings = getBoolean("logger.suppress-ignored-advancement-warnings", loggerSuppressIgnoredAdvancementWarnings);
|
||||
+ loggerSuppressUnrecognizedRecipeErrors = getBoolean("logger.suppress-unrecognized-recipe-errors", loggerSuppressUnrecognizedRecipeErrors);
|
||||
+ loggerSuppressSetBlockFarChunk = getBoolean("logger.suppress-setblock-in-far-chunk-errors", loggerSuppressSetBlockFarChunk);
|
||||
+ loggerSuppressSentExpiredChat = getBoolean("logger.suppress-sent-expired-chat", loggerSuppressSentExpiredChat);
|
||||
+ }
|
||||
+
|
||||
|
||||
|
||||
}
|
||||
\ No newline at end of file
|
||||
@@ -29,19 +29,19 @@ 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 30156d3c983f83c4d96ce089a27ff9bfed29555e..282fc59c3280d5d8478cb9897073d9d73996420b 100644
|
||||
index e6e16685aff8266c1edd7d6e3a16e65f4dfb5162..a578b872a357b19236ef1217344d3cdeffc64f9b 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -302,7 +302,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
@@ -287,7 +287,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
public static final int TPS = 20;
|
||||
public static final int TICK_TIME = 1000000000 / MinecraftServer.TPS;
|
||||
private static final int SAMPLE_INTERVAL = 20; // Paper
|
||||
- public final double[] recentTps = new double[ 3 ];
|
||||
+ public final double[] recentTps = new double[ 4 ]; // Purpur
|
||||
// Spigot end
|
||||
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations;
|
||||
public static long currentTickLong = 0L; // Paper
|
||||
|
||||
@@ -1113,6 +1113,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
@@ -1071,6 +1071,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
private static final long MAX_CATCHUP_BUFFER = TICK_TIME * TPS * 60L;
|
||||
private long lastTick = 0;
|
||||
private long catchupTime = 0;
|
||||
@@ -49,7 +49,7 @@ index 30156d3c983f83c4d96ce089a27ff9bfed29555e..282fc59c3280d5d8478cb9897073d9d7
|
||||
public final RollingAverage tps1 = new RollingAverage(60);
|
||||
public final RollingAverage tps5 = new RollingAverage(60 * 5);
|
||||
public final RollingAverage tps15 = new RollingAverage(60 * 15);
|
||||
@@ -1205,13 +1206,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
@@ -1167,13 +1168,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
{
|
||||
final long diff = curTime - tickSection;
|
||||
java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP);
|
||||
@@ -71,10 +71,10 @@ index 30156d3c983f83c4d96ce089a27ff9bfed29555e..282fc59c3280d5d8478cb9897073d9d7
|
||||
tickSection = curTime;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 69ddc41119dc621cf0ffa9e8e89bc761dc666b7d..ca0a5a22271b8f72a8d3f4b8b7890c0a370cec3b 100644
|
||||
index ae765bd800b843cf9c69c6895fcc0f701a6cd633..b0500803c286a7382e83305ea2b20b32da55f854 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2667,6 +2667,7 @@ public final class CraftServer implements Server {
|
||||
@@ -2676,6 +2676,7 @@ public final class CraftServer implements Server {
|
||||
@Override
|
||||
public double[] getTPS() {
|
||||
return new double[] {
|
||||
@@ -7,10 +7,10 @@ Original code by PurpurMC, licensed under MIT
|
||||
You can find the original code on https://github.com/PurpurMC/Purpur
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 1a9afa43a953e5634edb23ef617ead4b329ae89f..bf42644d2053de4e3c7b9e531b18230b07f094c5 100644
|
||||
index 226a3a698e3863296481753434a716a793cb5d51..f5aca2054dcad52301b9b99e44fbd3723aabdad7 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1145,6 +1145,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -1154,6 +1154,7 @@ public class ServerPlayer extends Player {
|
||||
playerlist.sendPlayerPermissionLevel(this);
|
||||
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
this.unsetRemoved();
|
||||
@@ -19,10 +19,10 @@ index 1a9afa43a953e5634edb23ef617ead4b329ae89f..bf42644d2053de4e3c7b9e531b18230b
|
||||
// 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 5744b25104d3b73cedda3c88945dfce1db265b1e..0b28025545bb26aff4a91fe3b78e4fc361ecf4e2 100644
|
||||
index a277646003fbec7e4bc8ca301a0934eeeac1151d..0317d540944f92b3486459f1db4dd3c2b4631a21 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2766,12 +2766,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -2856,12 +2856,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
return Vec3.directionFromRotation(this.getRotationVector());
|
||||
}
|
||||
|
||||
@@ -39,11 +39,11 @@ index 5744b25104d3b73cedda3c88945dfce1db265b1e..0b28025545bb26aff4a91fe3b78e4fc3
|
||||
|
||||
this.isInsidePortal = true;
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index ede41bc4ab49065cc06e66189610791cab01b39d..bee288d0735af17571902203936c7eb7025184f0 100644
|
||||
index 8d3dcc1ebacd86412858680a9b3f8c018890b02b..718f8979bb801edc6310e58376f412a2c66b13a4 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -220,6 +220,11 @@ public class MiraiConfig {
|
||||
loggerSuppressUnrecognizedRecipeErrors = getBoolean("logger.suppress-unrecognized-recipe-errors", loggerSuppressUnrecognizedRecipeErrors);
|
||||
@@ -224,4 +224,9 @@ public class MiraiConfig {
|
||||
loggerSuppressSentExpiredChat = getBoolean("logger.suppress-sent-expired-chat", loggerSuppressSentExpiredChat);
|
||||
}
|
||||
|
||||
+ public static boolean playerFixStuckPortal = false;
|
||||
@@ -51,7 +51,5 @@ index ede41bc4ab49065cc06e66189610791cab01b39d..bee288d0735af17571902203936c7eb7
|
||||
+ playerFixStuckPortal = getBoolean("player-fix-stuck-in-portal", playerFixStuckPortal);
|
||||
+ }
|
||||
+
|
||||
|
||||
|
||||
}
|
||||
\ No newline at end of file
|
||||
@@ -7,10 +7,10 @@ Original code by PurpurMC, licensed under MIT
|
||||
You can find the original code on https://github.com/PurpurMC/Purpur
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 0b28025545bb26aff4a91fe3b78e4fc361ecf4e2..651baec777f02038a775bd70e9f3e550befaa773 100644
|
||||
index 0317d540944f92b3486459f1db4dd3c2b4631a21..c89a3ea4a60180cd76d5b49cc0c8df975ebf4b22 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2771,7 +2771,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -2861,7 +2861,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
if (this.isOnPortalCooldown()) {
|
||||
if (!(wtf.etil.mirai.MiraiConfig.playerFixStuckPortal && this instanceof Player && !pos.equals(portalPos))) // Purpur
|
||||
this.setPortalCooldown();
|
||||
@@ -19,7 +19,7 @@ index 0b28025545bb26aff4a91fe3b78e4fc361ecf4e2..651baec777f02038a775bd70e9f3e550
|
||||
if (!this.level.isClientSide && !pos.equals(this.portalEntrancePos)) {
|
||||
this.portalEntrancePos = pos.immutable();
|
||||
portalPos = BlockPos.ZERO; // Purpur
|
||||
@@ -3438,7 +3438,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -3527,7 +3527,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
|
||||
public boolean canChangeDimensions() {
|
||||
@@ -29,18 +29,17 @@ index 0b28025545bb26aff4a91fe3b78e4fc361ecf4e2..651baec777f02038a775bd70e9f3e550
|
||||
|
||||
public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) {
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index bee288d0735af17571902203936c7eb7025184f0..a1d88b8cadf6c193deb69bb577936ebd69e63b2a 100644
|
||||
index 718f8979bb801edc6310e58376f412a2c66b13a4..ceaa59b1da54daefe36cac93bfa7e8e7285203f0 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -225,6 +225,9 @@ public class MiraiConfig {
|
||||
@@ -229,4 +229,9 @@ public class MiraiConfig {
|
||||
playerFixStuckPortal = getBoolean("player-fix-stuck-in-portal", playerFixStuckPortal);
|
||||
}
|
||||
|
||||
-
|
||||
+ public static boolean entitiesCanUsePortals = true;
|
||||
+ private static void entitiesPortal() {
|
||||
+ entitiesCanUsePortals = getBoolean("entities-can-use-portals", entitiesCanUsePortals);
|
||||
+ }
|
||||
|
||||
+
|
||||
}
|
||||
\ No newline at end of file
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] PaperPR Use DataConverter for itemstack/entity
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 1e74799bb012ca45769a3fd103f0b24eba0a9a99..61ee37d1c81274f58922fde4138536b10847508b 100644
|
||||
index ae2965796f5c0a5c8629159714a245557c17f423..aa9a533f3301395bb15bb74605df2d4b9cd5ac92 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -453,8 +453,8 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -7,7 +7,7 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
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 289b78ca3e587ffd42a920b99cbe5078a0d787a4..2834196fa116bdd629adaac010b30e980719d653 100644
|
||||
index 0cc0d719e95e108263683b7a40f4ce3a8ca9465b..abc27a60986602e84eb556436a65b997617852a1 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
|
||||
@@ -12,6 +12,7 @@ import java.util.function.Supplier;
|
||||
@@ -9,10 +9,10 @@ Original code by RelativityMC, licensed under MIT
|
||||
You can find the original code on https://github.com/RelativityMC/VMP-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 651baec777f02038a775bd70e9f3e550befaa773..adc4a19039b56de81053e746580dbef9c1fe9c93 100644
|
||||
index c89a3ea4a60180cd76d5b49cc0c8df975ebf4b22..fadf8ab93cd9c4a4644e06d3b77dba0aaea1f421 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -238,6 +238,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -299,6 +299,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
public float yRotO;
|
||||
public float xRotO;
|
||||
private AABB bb;
|
||||
@@ -20,7 +20,7 @@ index 651baec777f02038a775bd70e9f3e550befaa773..adc4a19039b56de81053e746580dbef9
|
||||
public boolean onGround;
|
||||
public boolean horizontalCollision;
|
||||
public boolean verticalCollision;
|
||||
@@ -969,6 +970,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1031,6 +1032,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
// Paper end - detailed watchdog information
|
||||
|
||||
public void move(MoverType movementType, Vec3 movement) {
|
||||
@@ -33,7 +33,7 @@ index 651baec777f02038a775bd70e9f3e550befaa773..adc4a19039b56de81053e746580dbef9
|
||||
// Paper start - detailed watchdog information
|
||||
io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main");
|
||||
synchronized (this.posLock) {
|
||||
@@ -3643,6 +3650,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -3732,6 +3739,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
|
||||
public final void setBoundingBox(AABB boundingBox) {
|
||||
@@ -7,15 +7,15 @@ Original code by Cryptite, licensed under MIT
|
||||
You can find the original code on https://github.com/Cryptite/Slice
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 8e5c8d1e59af15a0b28a8e28e60e50d2ec3b23f9..1fdc19830bf4cf677df60c5760e02ae53abc85cc 100644
|
||||
index b7a9f16fb75d7664b6788d20d9b4a07459866dac..f6af6dc1c686d477212cd68031d4983f85234a7f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3052,7 +3052,7 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -3084,7 +3084,7 @@ public abstract class LivingEntity extends Entity {
|
||||
|
||||
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
|
||||
|
||||
- if (!ItemStack.matches(itemstack1, itemstack)) {
|
||||
+ if (!ItemStack.isSameIgnoreDurability(itemstack1, itemstack)) {
|
||||
+ if (!ItemStack.isSameIgnoreDurability(itemstack1, itemstack)) { // Slice
|
||||
// Paper start - PlayerArmorChangeEvent
|
||||
if (this instanceof ServerPlayer && enumitemslot.getType() == EquipmentSlot.Type.ARMOR) {
|
||||
final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack);
|
||||
@@ -1,25 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Thu, 23 Sep 2021 09:29:09 -0500
|
||||
Subject: [PATCH] Don't send fire packets if player has Fire Resistance
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Thu, 23 Sep 2021 08:56:42 -0500
|
||||
Subject: [PATCH] Don't send equipment updates if only durability changed
|
||||
|
||||
Original code by Cryptite, licensed under MIT
|
||||
You can find the original code on https://github.com/Cryptite/Slice
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index adc4a19039b56de81053e746580dbef9c1fe9c93..9b224ca33115aa7e7f100a45fe8bdb68ea7e4b59 100644
|
||||
index fadf8ab93cd9c4a4644e06d3b77dba0aaea1f421..e80ea887fc80b009c1cdced06de21f013689cfa4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -815,7 +815,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -877,7 +877,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
||||
this.checkOutOfWorld();
|
||||
if (!this.level.isClientSide) {
|
||||
- this.setSharedFlagOnFire(this.remainingFireTicks > 0);
|
||||
+ // Slice start
|
||||
+ if (this instanceof net.minecraft.world.entity.LivingEntity livingEntity) {
|
||||
+ this.setSharedFlagOnFire(this.remainingFireTicks > 0 && !livingEntity.hasEffect(net.minecraft.world.effect.MobEffects.FIRE_RESISTANCE));
|
||||
+ } else {
|
||||
+ this.setSharedFlagOnFire(this.remainingFireTicks > 0);
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
|
||||
this.firstTick = false;
|
||||
@@ -7,7 +7,7 @@ Original code by Cryptite, licensed under MIT
|
||||
You can find the original code on https://github.com/Cryptite/Slice
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java
|
||||
index 019ccd50ac87557bd971c0fde3113cc0e2e301ff..bb116272d84908649ef0f80618a66094422ecfca 100644
|
||||
index 3e17f6131bf590d7c4a16b79c1c145cb4f565bc9..e1233fa58d068448d0accef7a7f6725fcb902848 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java
|
||||
@@ -22,6 +22,13 @@ public class ClientboundSetEntityDataPacket implements Packet<ClientGamePacketLi
|
||||
@@ -133,10 +133,10 @@ index 1d88edfd09a909044f6e3175af652914b4d06311..9031fb0e8c589b759549f4197772b6c9
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 2d7e884d25f352e0a05e9aefb0ff6e296e73c361..8b64571c85e8e36d7ed48c42e4dc5957a874ea7c 100644
|
||||
index aa1bd3423829900729d413a5f98f4a0b9aaf6135..d03fd8927eebb8df8697cdf7383f66b0b6576d5b 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -390,7 +390,19 @@ public class ServerEntity {
|
||||
@@ -379,7 +379,19 @@ public class ServerEntity {
|
||||
SynchedEntityData datawatcher = this.entity.getEntityData();
|
||||
|
||||
if (datawatcher.isDirty()) {
|
||||
@@ -158,10 +158,10 @@ index 2d7e884d25f352e0a05e9aefb0ff6e296e73c361..8b64571c85e8e36d7ed48c42e4dc5957
|
||||
|
||||
if (this.entity instanceof LivingEntity) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 9b224ca33115aa7e7f100a45fe8bdb68ea7e4b59..f585b23c4f958184c4388c5c832dac1eaf7ae788 100644
|
||||
index e80ea887fc80b009c1cdced06de21f013689cfa4..139884cead5a6d9d5b5990943e5a4ab4336ad22a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -3029,7 +3029,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -3118,7 +3118,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
this.entityData.markDirty(Entity.DATA_AIR_SUPPLY_ID);
|
||||
return;
|
||||
}
|
||||
@@ -171,10 +171,10 @@ index 9b224ca33115aa7e7f100a45fe8bdb68ea7e4b59..f585b23c4f958184c4388c5c832dac1e
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 2483d7df7f1bf94344afd38b37602c645a4a2dff..5c16235115a9233bce1f5b30bb020d105bdca3d1 100644
|
||||
index cd9cbfa5ef94994b3f7f2ecdde843620e7e6c071..b22e4068407f3012b62683abd060509829e61c62 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -632,7 +632,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -640,7 +640,7 @@ public abstract class Player extends LivingEntity {
|
||||
public void increaseScore(int score) {
|
||||
int j = this.getScore();
|
||||
|
||||
@@ -184,10 +184,10 @@ index 2483d7df7f1bf94344afd38b37602c645a4a2dff..5c16235115a9233bce1f5b30bb020d10
|
||||
|
||||
public void startAutoSpinAttack(int riptideTicks) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 170c7469ac6ed343a8e4e43f03a972d106bcc640..d36a27c06b9b33fe762fcec3afe2bdb90ba0ec2c 100644
|
||||
index 97dab75ac1ec2b22ac00392b6b22f63fab70b17f..78c42ea7bbf790cd14372d423f9999152d90fb12 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2202,7 +2202,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2199,7 +2199,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
this.sendHealthUpdate();
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: astei <andrew@steinborn.me>
|
||||
Date: Tue, 30 Nov 2021 19:39:21 +0100
|
||||
Subject: [PATCH] PaperPR Optimize VarInts
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
index 896a4237f871d46cf39b0721e909c2cc3b5fc728..e2a0a7fd5afd8cd3467dab049695956c381fb3cd 100644
|
||||
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
@@ -65,19 +65,22 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
public java.util.Locale adventure$locale; // Paper
|
||||
public static final short MAX_STRING_LENGTH = 32767;
|
||||
public static final int MAX_COMPONENT_STRING_LENGTH = 262144;
|
||||
+ // Paper start - Optimize VarInts
|
||||
+ private static final int[] VARINT_EXACT_BYTE_LENGTHS = new int[33];
|
||||
+ static {
|
||||
+ for (int i = 0; i <= 32; ++i) {
|
||||
+ VARINT_EXACT_BYTE_LENGTHS[i] = (int) Math.ceil((31d - (i - 1)) / 7d);
|
||||
+ }
|
||||
+ VARINT_EXACT_BYTE_LENGTHS[32] = 1; // Special case for the number 0.
|
||||
+ }
|
||||
+ // Paper end - Optimize VarInts
|
||||
|
||||
public FriendlyByteBuf(ByteBuf parent) {
|
||||
this.source = parent;
|
||||
}
|
||||
|
||||
public static int getVarIntSize(int value) {
|
||||
- for (int j = 1; j < 5; ++j) {
|
||||
- if ((value & -1 << j * 7) == 0) {
|
||||
- return j;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return 5;
|
||||
+ return VARINT_EXACT_BYTE_LENGTHS[Integer.numberOfLeadingZeros(value)]; // Paper - Optimize VarInts
|
||||
}
|
||||
|
||||
public static int getVarLongSize(long value) {
|
||||
@@ -420,7 +423,23 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
return new UUID(this.readLong(), this.readLong());
|
||||
}
|
||||
|
||||
+ // Paper start - Optimize VarInts
|
||||
public FriendlyByteBuf writeVarInt(int value) {
|
||||
+ // Peel the one and two byte count cases explicitly as they are the most common VarInt sizes
|
||||
+ // that the proxy will write, to improve inlining.
|
||||
+ if ((value & (0xFFFFFFFF << 7)) == 0) {
|
||||
+ writeByte(value);
|
||||
+ } else if ((value & (0xFFFFFFFF << 14)) == 0) {
|
||||
+ int w = (value & 0x7F | 0x80) << 8 | (value >>> 7);
|
||||
+ writeShort(w);
|
||||
+ } else {
|
||||
+ writeVarInt_(value);
|
||||
+ }
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ public FriendlyByteBuf writeVarInt_(int value) {
|
||||
+ // Paper end - Optimize VarInts
|
||||
while ((value & -128) != 0) {
|
||||
this.writeByte(value & 127 | 128);
|
||||
value >>>= 7;
|
||||
@@ -7,10 +7,10 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index a80f4dc0a642c744223a155232291ace6e007636..f5f40589f53ac4696507699037df1ae4738e1637 100644
|
||||
index 224ce424b9a22548212ac157ec273c6dd80d6cfb..8986eb0cfb151a05a0450d2d46aca1837d3c1152 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -597,11 +597,18 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
@@ -612,11 +612,18 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
private final BlockState first;
|
||||
private final BlockState second;
|
||||
private final Direction direction;
|
||||
@@ -29,7 +29,7 @@ index a80f4dc0a642c744223a155232291ace6e007636..f5f40589f53ac4696507699037df1ae4
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
@@ -617,11 +624,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
@@ -632,11 +639,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
@@ -7,7 +7,7 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java
|
||||
index fb2626d2a6babe531dd1849333b119ab36200d80..e22de06aab82896a7c245763e7f3563d3d0912a9 100644
|
||||
index 17e869074b8cf29a8c3280499a27e95179896750..97a5aec7da267b8b9f6d191c871316ccb89c448c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/GameRules.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/GameRules.java
|
||||
@@ -27,6 +27,7 @@ import net.minecraft.network.protocol.game.ClientboundGameEventPacket;
|
||||
@@ -18,7 +18,7 @@ index fb2626d2a6babe531dd1849333b119ab36200d80..e22de06aab82896a7c245763e7f3563d
|
||||
|
||||
public class GameRules {
|
||||
|
||||
@@ -110,14 +111,16 @@ public class GameRules {
|
||||
@@ -111,14 +112,16 @@ public class GameRules {
|
||||
|
||||
public GameRules() {
|
||||
// Pufferfish start - use this to ensure gameruleArray is initialized
|
||||
@@ -11,7 +11,7 @@ Original project: https://github.com/fxmorin/carpet-fixes (Yarn mappings)
|
||||
Copyright (c) 2020 Fx Morin
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java
|
||||
index dd3f4c2c564be1e9886b5c3ddd9ca1dfd749c028..57b467bcf1561f6b3b42c5e088f71460704804f7 100644
|
||||
index 5695c5116c8a338b2e41aafcb2dc9f2146856970..e477b2f28121e043f2edfd0918e2a4dd8ba6f091 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java
|
||||
@@ -28,41 +28,72 @@ public class BiomeManager {
|
||||
@@ -0,0 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Arthur Blanchot <blanchot.arthur@protonmail.ch>
|
||||
Date: Fri, 24 Jun 2022 20:10:19 +0200
|
||||
Subject: [PATCH] Configurable enchantment table book animation tick
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java
|
||||
index 2341a5a249d455628165fc6ba508fc6d70c3dbfb..5a144c724eb6045909febf1fe32367179a3e04a3 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java
|
||||
@@ -48,6 +48,7 @@ public class EnchantmentTableBlockEntity extends BlockEntity implements Nameable
|
||||
}
|
||||
|
||||
public static void bookAnimationTick(Level world, BlockPos pos, BlockState state, EnchantmentTableBlockEntity blockEntity) {
|
||||
+ if (!wtf.etil.mirai.MiraiConfig.bookAnimationTick) return; // Mirai - skip enchantment table book tick
|
||||
blockEntity.oOpen = blockEntity.open;
|
||||
blockEntity.oRot = blockEntity.rot;
|
||||
Player player = world.getNearestPlayer((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 3.0D, false);
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index ceaa59b1da54daefe36cac93bfa7e8e7285203f0..d2519c1d1e87dc367b631ac1ea2d5d51af2ebb84 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -234,4 +234,9 @@ public class MiraiConfig {
|
||||
entitiesCanUsePortals = getBoolean("entities-can-use-portals", entitiesCanUsePortals);
|
||||
}
|
||||
|
||||
+ public static boolean bookAnimationTick = false;
|
||||
+ private static void bookTicking() {
|
||||
+ bookAnimationTick = getBoolean("enchantment-table-book-animation-tick", bookAnimationTick);
|
||||
+ }
|
||||
+
|
||||
}
|
||||
\ No newline at end of file
|
||||
@@ -1,65 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Phoenix616 <mail@moep.tv>
|
||||
Date: Sun, 24 Nov 2019 23:00:58 +0100
|
||||
Subject: [PATCH] Optimize inventory API item handling
|
||||
|
||||
Original code by Minebench, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://github.com/Minebench/Origami
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
|
||||
index 30ac442049088200e9ab77a561c59cbc58aaa28f..bdacb0098c93be63693218544b6dc1a2937cdb3b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
|
||||
@@ -273,11 +273,13 @@ public class CraftInventory implements Inventory {
|
||||
}
|
||||
|
||||
private int firstPartial(ItemStack item) {
|
||||
- ItemStack[] inventory = this.getStorageContents();
|
||||
- ItemStack filteredItem = CraftItemStack.asCraftCopy(item);
|
||||
if (item == null) {
|
||||
return -1;
|
||||
}
|
||||
+ // Origami start - Optimize inventory API (moved down from before null check)
|
||||
+ ItemStack[] inventory = this.getStorageContents();
|
||||
+ ItemStack filteredItem = CraftItemStack.asCraftCopy(item);
|
||||
+ // Origami end
|
||||
for (int i = 0; i < inventory.length; i++) {
|
||||
ItemStack cItem = inventory[i];
|
||||
if (cItem != null && cItem.getAmount() < cItem.getMaxStackSize() && cItem.isSimilar(filteredItem)) {
|
||||
@@ -295,9 +297,10 @@ public class CraftInventory implements Inventory {
|
||||
/* TODO: some optimization
|
||||
* - Create a 'firstPartial' with a 'fromIndex'
|
||||
* - Record the lastPartial per Material
|
||||
- * - Cache firstEmpty result
|
||||
+ * - Cache firstEmpty result // Implemented in Origami
|
||||
*/
|
||||
|
||||
+ int firstFree = -2; // Origami - Cache firstEmpty result
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
ItemStack item = items[i];
|
||||
while (true) {
|
||||
@@ -307,7 +310,11 @@ public class CraftInventory implements Inventory {
|
||||
// Drat! no partial stack
|
||||
if (firstPartial == -1) {
|
||||
// Find a free spot!
|
||||
- int firstFree = this.firstEmpty();
|
||||
+ // Origami start - Cache firstEmpty result
|
||||
+ if (firstFree == -2) {
|
||||
+ firstFree = this.firstEmpty();
|
||||
+ }
|
||||
+ // Origami end
|
||||
|
||||
if (firstFree == -1) {
|
||||
// No space at all!
|
||||
@@ -320,9 +327,11 @@ public class CraftInventory implements Inventory {
|
||||
stack.setAmount(this.getMaxItemStack());
|
||||
this.setItem(firstFree, stack);
|
||||
item.setAmount(item.getAmount() - this.getMaxItemStack());
|
||||
+ firstFree = -2; // Origami - Cache firstEmpty result
|
||||
} else {
|
||||
// Just store it
|
||||
this.setItem(firstFree, item);
|
||||
+ firstFree = -2; // Origami - Cache firstEmpty result
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Skip cloning loot parameters
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/advancements/Advancement.java b/src/main/java/net/minecraft/advancements/Advancement.java
|
||||
index c534055f90b98942b9d7d152fd502cf5387c995b..9e46acf66df7a41eb80d7e41871c3b3caa66f55e 100644
|
||||
index 2c01231dcfbb992c9d2f034fcfd4af52fe8ac265..7ed9ca7d220c2af764a2febe2c1d7cb208593074 100644
|
||||
--- a/src/main/java/net/minecraft/advancements/Advancement.java
|
||||
+++ b/src/main/java/net/minecraft/advancements/Advancement.java
|
||||
@@ -46,7 +46,7 @@ public class Advancement {
|
||||
@@ -45,7 +45,7 @@ public class Advancement {
|
||||
public Advancement(ResourceLocation id, @Nullable Advancement parent, @Nullable DisplayInfo display, AdvancementRewards rewards, Map<String, Criterion> criteria, String[][] requirements) {
|
||||
this.id = id;
|
||||
this.display = display;
|
||||
@@ -7,7 +7,7 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java
|
||||
index 92789a27aa2978ac323d4cdafa82391998cf0ffa..842b67327523c512f95ad64ad23d3ee4102175ea 100644
|
||||
index 2217968eb5ecac0a2063cf1eae7d754d760e9f28..445f21c3764d148de937f558e3f087ae2006733d 100644
|
||||
--- a/src/main/java/net/minecraft/core/Direction.java
|
||||
+++ b/src/main/java/net/minecraft/core/Direction.java
|
||||
@@ -41,7 +41,7 @@ public enum Direction implements StringRepresentable {
|
||||
@@ -16,11 +16,11 @@ index 92789a27aa2978ac323d4cdafa82391998cf0ffa..842b67327523c512f95ad64ad23d3ee4
|
||||
private final Vec3i normal;
|
||||
- private static final Direction[] VALUES = values();
|
||||
+ public static final Direction[] VALUES = values(); // JettPack
|
||||
private static final Map<String, Direction> BY_NAME = Arrays.stream(VALUES).collect(Collectors.toMap(Direction::getName, (direction) -> {
|
||||
return direction;
|
||||
}));
|
||||
private static final Direction[] BY_3D_DATA = Arrays.stream(VALUES).sorted(Comparator.comparingInt((direction) -> {
|
||||
return direction.data3d;
|
||||
})).toArray((i) -> {
|
||||
diff --git a/src/main/java/net/minecraft/world/phys/shapes/CubePointRange.java b/src/main/java/net/minecraft/world/phys/shapes/CubePointRange.java
|
||||
index def6c6a91aa229c83adb89a3fd0eb8bfb80e8182..dc700c70b0f8a3f42716060fbb81b3c75e3647ee 100644
|
||||
index a544db042c8d2ecec8d323770552c4f10ca758a6..c04da8da5b40430b61972bce32cec4e8c0370bac 100644
|
||||
--- a/src/main/java/net/minecraft/world/phys/shapes/CubePointRange.java
|
||||
+++ b/src/main/java/net/minecraft/world/phys/shapes/CubePointRange.java
|
||||
@@ -4,6 +4,7 @@ import it.unimi.dsi.fastutil.doubles.AbstractDoubleList;
|
||||
@@ -45,7 +45,7 @@ index def6c6a91aa229c83adb89a3fd0eb8bfb80e8182..dc700c70b0f8a3f42716060fbb81b3c7
|
||||
|
||||
public int size() {
|
||||
diff --git a/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java b/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java
|
||||
index 374da999d4fb544a5571ca888dd4cc60680d0ee0..ba4355ed2b5380ceab95d19908ec6b8fe7d2f12a 100644
|
||||
index 68e89dbd79171627046e89699057964e44c40e7d..959588962acb0196ec9f1cc2502e62117f6ccdc4 100644
|
||||
--- a/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java
|
||||
+++ b/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java
|
||||
@@ -3,15 +3,25 @@ package net.minecraft.world.phys.shapes;
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Fix MC-121706
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java
|
||||
index 048effbc4d25669801b467be61ee4b88dd4ea9b7..5b93358a24dab1dbe66f0a74c22f1977e3c60e50 100644
|
||||
index 6558b0d4bea99948fdc2b51751f3cfdc239d4b67..70a1b1821d4f05e9d2baac85f298eedd425577d2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java
|
||||
@@ -111,10 +111,10 @@ public class RangedBowAttackGoal<T extends Monster & RangedAttackMob> extends Go
|
||||
@@ -1,22 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Gaider10 <>
|
||||
Date: Mon, 30 Aug 2021 16:10:51 +0300
|
||||
Subject: [PATCH] PaperPR Fix mobs spawning outside hard despawn range
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
index 6e24b86ce315510133b6294f5d348e5c4e7f547f..dfc43fbd10ab9ccb84fb97e1db4d2bb107eee04f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
@@ -386,7 +386,10 @@ public final class NaturalSpawner {
|
||||
}
|
||||
|
||||
private static boolean isValidPositionForMob(ServerLevel world, Mob entity, double squaredDistance) {
|
||||
- return squaredDistance > (double) (entity.getType().getCategory().getDespawnDistance() * entity.getType().getCategory().getDespawnDistance()) && entity.removeWhenFarAway(squaredDistance) ? false : entity.checkSpawnRules(world, MobSpawnType.NATURAL) && entity.checkSpawnObstruction(world);
|
||||
+ // Paper start - fix mobs spawning outside hard despawn range
|
||||
+ int despawnDistance = entity.isPersistenceRequired() || entity.requiresCustomPersistence() ? entity.getType().getCategory().getDespawnDistance() : world.paperConfig.hardDespawnDistances.getInt(entity.getType().getCategory());
|
||||
+ return squaredDistance > (double) (despawnDistance * despawnDistance) && entity.removeWhenFarAway(squaredDistance) ? false : entity.checkSpawnRules((LevelAccessor) world, MobSpawnType.NATURAL) && entity.checkSpawnObstruction((LevelReader) world);
|
||||
+ // Paper end - fix mobs spawning outside hard despawn range
|
||||
}
|
||||
|
||||
private static Optional<MobSpawnSettings.SpawnerData> getRandomSpawnMobAt(ServerLevel world, StructureFeatureManager structureAccessor, ChunkGenerator chunkGenerator, MobCategory spawnGroup, Random random, BlockPos pos) {
|
||||
@@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..beaa0a60771b17b93e4074b272b503a2
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/world/level/entity/EntitySection.java b/src/main/java/net/minecraft/world/level/entity/EntitySection.java
|
||||
index 578e07407951688e7e8489919a4a3733028fc568..9b39920baea28fe85a0bb6ada0e00a466b3ddf31 100644
|
||||
index e9aee7d11798c3bd990466f101e9e342686de11c..13ebaf6aede402f5f702aae6c1e44445b00cd9bb 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/entity/EntitySection.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/entity/EntitySection.java
|
||||
@@ -8,6 +8,10 @@ import net.minecraft.util.ClassInstanceMultiMap;
|
||||
@@ -9,7 +9,7 @@ Original code by RelativityMC, licensed under MIT
|
||||
You can find the original code on https://github.com/RelativityMC/VMP-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/LocalMobCapCalculator.java b/src/main/java/net/minecraft/world/level/LocalMobCapCalculator.java
|
||||
index 05a5cd35dc96a7789c89a171526fe96c89b42f52..d9fa1389ae2591a6d7865bb0782e46ed8b36276a 100644
|
||||
index 84c766e09898cfc07d6e07e80f4b9aa318050a62..9cb1acdfe2a514099e9517118c7cd448bd3c2d68 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/LocalMobCapCalculator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/LocalMobCapCalculator.java
|
||||
@@ -47,16 +47,25 @@ public class LocalMobCapCalculator {
|
||||
34
patches/server/0060-Configurable-server-metrics.patch
Normal file
34
patches/server/0060-Configurable-server-metrics.patch
Normal file
@@ -0,0 +1,34 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Mon, 3 Jan 2022 16:03:27 +0100
|
||||
Subject: [PATCH] Configurable server metrics
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 43ae13cc8c3c1e7ed183d11fccba3ba3af14c8f4..95aa98a95cc46c4cf90822bf1a22404ab753c9dc 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -222,7 +222,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash);
|
||||
thread.start(); // Paper - start console thread after MinecraftServer.console & PaperConfig are initialized
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this);
|
||||
- com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics();
|
||||
+ if (wtf.etil.mirai.MiraiConfig.serverMetrics) com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Mirai - configurable server metrics
|
||||
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
|
||||
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
|
||||
// Paper end
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index d2519c1d1e87dc367b631ac1ea2d5d51af2ebb84..4ef25b6203371b9c22275e1015ea75d870acf8da 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -239,4 +239,9 @@ public class MiraiConfig {
|
||||
bookAnimationTick = getBoolean("enchantment-table-book-animation-tick", bookAnimationTick);
|
||||
}
|
||||
|
||||
+ public static boolean serverMetrics = true;
|
||||
+ private static void allowServerMetrics() {
|
||||
+ serverMetrics = getBoolean("enable-server-metrics", serverMetrics);
|
||||
+ }
|
||||
+
|
||||
}
|
||||
\ No newline at end of file
|
||||
@@ -1,147 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: 2No2Name <2No2Name@web.de>
|
||||
Date: Fri, 10 Sep 2021 16:35:53 -0400
|
||||
Subject: [PATCH] lithium: ai task goat jump
|
||||
|
||||
Original code by CaffeineMC, licensed under GNU Lesser General Public License v3.0
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java b/src/main/java/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java
|
||||
index b25d245d0ad892e99663c3d741b2350fb1531d0e..3aafff1b77f137da897bc412edd7d0d57faa1458 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java
|
||||
@@ -25,6 +25,8 @@ import net.minecraft.world.level.pathfinder.Path;
|
||||
import net.minecraft.world.level.pathfinder.WalkNodeEvaluator;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
+import it.unimi.dsi.fastutil.longs.LongArrayList; // JettPack
|
||||
+import it.unimi.dsi.fastutil.shorts.ShortArrayList; // JettPack
|
||||
|
||||
public class LongJumpToRandomPos<E extends Mob> extends Behavior<E> {
|
||||
private static final int FIND_JUMP_TRIES = 20;
|
||||
@@ -41,12 +43,26 @@ public class LongJumpToRandomPos<E extends Mob> extends Behavior<E> {
|
||||
private int findJumpTries;
|
||||
private long prepareJumpStart;
|
||||
private Function<E, SoundEvent> getJumpSound;
|
||||
+ private final LongArrayList potentialTargets = new LongArrayList(); // JettPack
|
||||
+ private final ShortArrayList potentialWeights = new ShortArrayList(); // JettPack
|
||||
|
||||
- public LongJumpToRandomPos(UniformInt cooldownRange, int verticalRange, int horizontalRange, float maxRange, Function<E, SoundEvent> entityToSound) {
|
||||
+ // JettPack start
|
||||
+ private static int findIndex(ShortArrayList weights, int weightedIndex) {
|
||||
+ for (int i = 0; i < weights.size(); i++) {
|
||||
+ weightedIndex -= weights.getShort(i);
|
||||
+ if (weightedIndex < 0) {
|
||||
+ return i;
|
||||
+ }
|
||||
+ }
|
||||
+ return -1;
|
||||
+ }
|
||||
+ // JettPack end
|
||||
+
|
||||
+ public LongJumpToRandomPos(UniformInt cooldownRange, int maxLongJumpHeight, int maxLongJumpWidth, float maxRange, Function<E, SoundEvent> entityToSound) {
|
||||
super(ImmutableMap.of(MemoryModuleType.LOOK_TARGET, MemoryStatus.REGISTERED, MemoryModuleType.LONG_JUMP_COOLDOWN_TICKS, MemoryStatus.VALUE_ABSENT, MemoryModuleType.LONG_JUMP_MID_JUMP, MemoryStatus.VALUE_ABSENT), 200);
|
||||
this.timeBetweenLongJumps = cooldownRange;
|
||||
- this.maxLongJumpHeight = verticalRange;
|
||||
- this.maxLongJumpWidth = horizontalRange;
|
||||
+ this.maxLongJumpHeight = maxLongJumpHeight;
|
||||
+ this.maxLongJumpWidth = maxLongJumpWidth;
|
||||
this.maxJumpVelocity = maxRange;
|
||||
this.getJumpSound = entityToSound;
|
||||
}
|
||||
@@ -66,30 +82,63 @@ public class LongJumpToRandomPos<E extends Mob> extends Behavior<E> {
|
||||
return bl;
|
||||
}
|
||||
|
||||
+ // JettPack start
|
||||
+ /**
|
||||
+ * @author 2No2Name
|
||||
+ * @reason only evaluate 20+ instead of ~100 possible jumps without affecting behavior
|
||||
+ * [VanillaCopy] the whole method, commented changes
|
||||
+ */
|
||||
@Override
|
||||
protected void start(ServerLevel serverLevel, Mob mob, long l) {
|
||||
+ this.potentialTargets.clear();
|
||||
+ this.potentialWeights.clear();
|
||||
+ int potentialTotalWeight = 0;
|
||||
this.chosenJump = Optional.empty();
|
||||
- this.findJumpTries = 20;
|
||||
+ this.findJumpTries = FIND_JUMP_TRIES;
|
||||
this.jumpCandidates.clear();
|
||||
this.initialPosition = Optional.of(mob.position());
|
||||
- BlockPos blockPos = mob.blockPosition();
|
||||
- int i = blockPos.getX();
|
||||
- int j = blockPos.getY();
|
||||
- int k = blockPos.getZ();
|
||||
- Iterable<BlockPos> iterable = BlockPos.betweenClosed(i - this.maxLongJumpWidth, j - this.maxLongJumpHeight, k - this.maxLongJumpWidth, i + this.maxLongJumpWidth, j + this.maxLongJumpHeight, k + this.maxLongJumpWidth);
|
||||
- PathNavigation pathNavigation = mob.getNavigation();
|
||||
-
|
||||
- for(BlockPos blockPos2 : iterable) {
|
||||
- double d = blockPos2.distSqr(blockPos);
|
||||
- if ((i != blockPos2.getX() || k != blockPos2.getZ()) && pathNavigation.isStableDestination(blockPos2) && mob.getPathfindingMalus(WalkNodeEvaluator.getBlockPathTypeStatic(mob.level, blockPos2.mutable())) == 0.0F) {
|
||||
- Optional<Vec3> optional = this.calculateOptimalJumpVector(mob, Vec3.atCenterOf(blockPos2));
|
||||
- optional.ifPresent((vel) -> {
|
||||
- this.jumpCandidates.add(new LongJumpToRandomPos.PossibleJump(new BlockPos(blockPos2), vel, Mth.ceil(d)));
|
||||
- });
|
||||
+ BlockPos goatPos = mob.blockPosition();
|
||||
+ int goatX = goatPos.getX();
|
||||
+ int goatY = goatPos.getY();
|
||||
+ int goatZ = goatPos.getZ();
|
||||
+ Iterable<BlockPos> iterable = BlockPos.betweenClosed(goatX - this.maxLongJumpWidth, goatY - this.maxLongJumpHeight, goatZ - this.maxLongJumpWidth, goatX + this.maxLongJumpWidth, goatY + this.maxLongJumpHeight, goatZ + this.maxLongJumpWidth);
|
||||
+ PathNavigation entityNavigation = mob.getNavigation();
|
||||
+
|
||||
+ BlockPos.MutableBlockPos targetPosCopy = new BlockPos.MutableBlockPos();
|
||||
+ for (BlockPos targetPos : iterable) {
|
||||
+ if (goatX == targetPos.getX() && goatZ == targetPos.getZ()) {
|
||||
+ continue;
|
||||
}
|
||||
- }
|
||||
+ double squaredDistance = targetPos.distSqr(goatPos);
|
||||
|
||||
+ //Optimization: Evaluate the flight path check later (after random selection, but before world can be modified)
|
||||
+ if (entityNavigation.isStableDestination(targetPos) && mob.getPathfindingMalus(WalkNodeEvaluator.getBlockPathTypeStatic(mob.level, targetPosCopy.set(targetPos))) == 0.0F) {
|
||||
+ this.potentialTargets.add(targetPos.asLong());
|
||||
+ int weight = Mth.ceil(squaredDistance);
|
||||
+ this.potentialWeights.add((short) weight);
|
||||
+ potentialTotalWeight += weight;
|
||||
+ }
|
||||
+ }
|
||||
+ // Optimization: Do the random picking of positions before doing the expensive the jump flight path validity check.
|
||||
+ // up to FIND_JUMP_TRIES random jumpCandidates can be selected in keepRunning, so only this number of jumpCandidates needs to be generated
|
||||
+ while (this.jumpCandidates.size() < FIND_JUMP_TRIES) {
|
||||
+ // the number of random calls will be different from vanilla, but this is not reasonably detectable (not affecting world generation)
|
||||
+ if (potentialTotalWeight == 0) {
|
||||
+ return; // collection is empty/fully consumed, no more possible jumpCandidates available
|
||||
+ }
|
||||
+ int chosenIndex = findIndex(this.potentialWeights, serverLevel.random.nextInt(potentialTotalWeight));
|
||||
+ long chosenPos = this.potentialTargets.getLong(chosenIndex);
|
||||
+ short chosenWeight = this.potentialWeights.set(chosenIndex, (short) 0);
|
||||
+ potentialTotalWeight -= chosenWeight;
|
||||
+ // Very expensive method call, it shifts bounding boxes around and checks for collisions with them
|
||||
+ Optional<Vec3> optional = this.calculateOptimalJumpVector(mob, Vec3.atCenterOf(targetPosCopy.set(chosenPos)));
|
||||
+ if (optional.isPresent()) {
|
||||
+ //the weight in Target should be unused, as the random selection already took place
|
||||
+ this.jumpCandidates.add(new LongJumpToRandomPos.PossibleJump(new BlockPos(targetPosCopy), optional.get(), chosenWeight));
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
+ // JettPack end
|
||||
|
||||
@Override
|
||||
protected void tick(ServerLevel serverLevel, E mob, long l) {
|
||||
@@ -106,7 +155,14 @@ public class LongJumpToRandomPos<E extends Mob> extends Behavior<E> {
|
||||
}
|
||||
} else {
|
||||
--this.findJumpTries;
|
||||
- Optional<LongJumpToRandomPos.PossibleJump> optional = WeightedRandom.getRandomItem(serverLevel.random, this.jumpCandidates);
|
||||
+ // JettPack start
|
||||
+ Optional<LongJumpToRandomPos.PossibleJump> optional;
|
||||
+ if (this.jumpCandidates.isEmpty()) {
|
||||
+ optional = Optional.empty();
|
||||
+ } else {
|
||||
+ optional = Optional.of(this.jumpCandidates.get(0));
|
||||
+ }
|
||||
+ // JettPack end
|
||||
if (optional.isPresent()) {
|
||||
this.jumpCandidates.remove(optional.get());
|
||||
mob.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, new BlockPosTracker(optional.get().getJumpTarget()));
|
||||
@@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: FX - PR0CESS <fx.e.morin@gmail.com>
|
||||
Date: Wed, 22 Dec 2021 18:39:21 +0100
|
||||
Subject: [PATCH] Configurable FastMath.round
|
||||
Subject: [PATCH] Faster Math.round implementation
|
||||
|
||||
Original code by fxmorin, licensed under MIT
|
||||
You can find the original code on https://github.com/fxmorin/carpet-fixes
|
||||
@@ -42,24 +42,24 @@ index 0000000000000000000000000000000000000000..da81a142d2b072f846f9905a0d5b8e29
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
index e85175910454fc08704ea01e4b852136a6c6c60f..4ac91d601dd7e37b3455360b3b41b73cd66624df 100644
|
||||
index bb220f27f5d472514d9a1620a40ed50fcb31ae16..a1aa0265ce807e6f40575094fd84b8aedf2be793 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
@@ -725,12 +725,12 @@ public class PaperCommand extends Command {
|
||||
@@ -734,12 +734,12 @@ public class PaperCommand extends Command {
|
||||
++relitChunks[0];
|
||||
sender.getBukkitEntity().sendMessage(
|
||||
ChatColor.BLUE + "Relit chunk " + ChatColor.DARK_AQUA + chunkPos + ChatColor.BLUE +
|
||||
- ", progress: " + ChatColor.DARK_AQUA + (int)(Math.round(100.0 * (double)(relitChunks[0])/(double)pending[0])) + "%"
|
||||
+ ", progress: " + ChatColor.DARK_AQUA + (int)(carpetfixes.helpers.FastMath.round(100.0 * (double)(relitChunks[0])/(double)pending[0])) + "%"
|
||||
);
|
||||
sender.getBukkitEntity().sendMessage(text().color(DARK_AQUA).append(
|
||||
text("Relit chunk ", BLUE), text(chunkPos.toString()),
|
||||
- text(", progress: ", BLUE), text((int)(Math.round(100.0 * (double)(relitChunks[0])/(double)pending[0])) + "%")
|
||||
+ text(", progress: ", BLUE), text((int)(carpetfixes.helpers.FastMath.round(100.0 * (double)(relitChunks[0])/(double)pending[0])) + "%")
|
||||
));
|
||||
},
|
||||
(int totalRelit) -> {
|
||||
final long end = System.nanoTime();
|
||||
- final long diff = Math.round(1.0e-6*(end - start));
|
||||
+ final long diff = carpetfixes.helpers.FastMath.round(1.0e-6*(end - start));
|
||||
sender.getBukkitEntity().sendMessage(
|
||||
ChatColor.BLUE + "Relit " + ChatColor.DARK_AQUA + totalRelit + ChatColor.BLUE + " chunks. Took " +
|
||||
ChatColor.DARK_AQUA + diff + "ms"
|
||||
sender.getBukkitEntity().sendMessage(text().color(DARK_AQUA).append(
|
||||
text("Relit ", BLUE), text(totalRelit),
|
||||
text(" chunks. Took ", BLUE), text(diff + "ms")
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java b/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java
|
||||
index f9251183df72ddc56662fd3f02acf21641a2200c..ea1bad145e529ac36bf335cf4d5339b2d88b282f 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java
|
||||
@@ -99,11 +99,29 @@ index 40447d00aefb5ffedb8a2ee87155a04088f0649f..31cc0a29e89e79f616b3ee329a552896
|
||||
+ this.report(MSPT, (double) carpetfixes.helpers.FastMath.round(mspt * 100d) / 100d);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java b/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java
|
||||
index b53402903eb6845df361daf6b05a668608ad7b63..df60ee5ec4f98e815499dd1dfe94a0b62d1f1fbf 100644
|
||||
--- a/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java
|
||||
+++ b/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java
|
||||
@@ -387,11 +387,11 @@ public final class PlayerChunkLoader {
|
||||
}
|
||||
|
||||
protected long getTargetSendPerPlayerAddend() {
|
||||
- return GlobalConfiguration.get().chunkLoading.targetPlayerChunkSendRate <= 1.0 ? 0L : (long)Math.round(1.0e9 / GlobalConfiguration.get().chunkLoading.targetPlayerChunkSendRate);
|
||||
+ return GlobalConfiguration.get().chunkLoading.targetPlayerChunkSendRate <= 1.0 ? 0L : (long)carpetfixes.helpers.FastMath.round(1.0e9 / GlobalConfiguration.get().chunkLoading.targetPlayerChunkSendRate);
|
||||
}
|
||||
|
||||
protected long getMaxSendAddend() {
|
||||
- return GlobalConfiguration.get().chunkLoading.globalMaxChunkSendRate <= 1.0 ? 0L : (long)Math.round(1.0e9 / GlobalConfiguration.get().chunkLoading.globalMaxChunkSendRate);
|
||||
+ return GlobalConfiguration.get().chunkLoading.globalMaxChunkSendRate <= 1.0 ? 0L : (long)carpetfixes.helpers.FastMath.round(1.0e9 / GlobalConfiguration.get().chunkLoading.globalMaxChunkSendRate);
|
||||
}
|
||||
|
||||
public void onChunkPlayerTickReady(final int chunkX, final int chunkZ) {
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 282fc59c3280d5d8478cb9897073d9d73996420b..a4249262ca98980985d4c36009488e792121f5df 100644
|
||||
index a578b872a357b19236ef1217344d3cdeffc64f9b..d43aac359f49c0c7e83954277d2eb0871491810d 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -2781,7 +2781,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
@@ -2749,7 +2749,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
}
|
||||
|
||||
double overuseCount = (double)overuse/(double)MAX_CHUNK_EXEC_TIME;
|
||||
@@ -113,7 +131,7 @@ index 282fc59c3280d5d8478cb9897073d9d73996420b..a4249262ca98980985d4c36009488e79
|
||||
lastMidTickExecute = currTime + extraSleep;
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/server/gui/StatsComponent.java b/src/main/java/net/minecraft/server/gui/StatsComponent.java
|
||||
index fac8a67dd8ee3894909504df8c0910f8180d6c35..ee0022c78a87ac513837fd74c90e7166caa13c85 100644
|
||||
index 88f10d729aa1e0a01790521821d691a0ecd373a2..df2c8dffd626eab0e03b1b62940a52fa83f6edaf 100644
|
||||
--- a/src/main/java/net/minecraft/server/gui/StatsComponent.java
|
||||
+++ b/src/main/java/net/minecraft/server/gui/StatsComponent.java
|
||||
@@ -88,7 +88,7 @@ public class StatsComponent extends JComponent {
|
||||
@@ -126,10 +144,10 @@ index fac8a67dd8ee3894909504df8c0910f8180d6c35..ee0022c78a87ac513837fd74c90e7166
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 1fdc19830bf4cf677df60c5760e02ae53abc85cc..57ec3ca7677fcc7390503c3002b78fb9b973226c 100644
|
||||
index f6af6dc1c686d477212cd68031d4983f85234a7f..a42f5e16e18586d4a72cdfd517e7796728701d6c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1473,7 +1473,7 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -1496,7 +1496,7 @@ public abstract class LivingEntity extends Entity {
|
||||
if (this instanceof ServerPlayer) {
|
||||
CriteriaTriggers.ENTITY_HURT_PLAYER.trigger((ServerPlayer) this, source, f1, amount, flag);
|
||||
if (f2 > 0.0F && f2 < 3.4028235E37F) {
|
||||
@@ -138,7 +156,7 @@ index 1fdc19830bf4cf677df60c5760e02ae53abc85cc..57ec3ca7677fcc7390503c3002b78fb9
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1995,9 +1995,9 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -2025,9 +2025,9 @@ public abstract class LivingEntity extends Entity {
|
||||
|
||||
if (f3 > 0.0F && f3 < 3.4028235E37F) {
|
||||
if (this instanceof ServerPlayer) {
|
||||
@@ -150,7 +168,7 @@ index 1fdc19830bf4cf677df60c5760e02ae53abc85cc..57ec3ca7677fcc7390503c3002b78fb9
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2107,9 +2107,9 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -2139,9 +2139,9 @@ public abstract class LivingEntity extends Entity {
|
||||
float f3 = (float) -event.getDamage(DamageModifier.RESISTANCE);
|
||||
if (f3 > 0.0F && f3 < 3.4028235E37F) {
|
||||
if (this instanceof ServerPlayer) {
|
||||
@@ -162,7 +180,7 @@ index 1fdc19830bf4cf677df60c5760e02ae53abc85cc..57ec3ca7677fcc7390503c3002b78fb9
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2141,10 +2141,10 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -2173,10 +2173,10 @@ public abstract class LivingEntity extends Entity {
|
||||
float f2 = absorptionModifier;
|
||||
|
||||
if (f2 > 0.0F && f2 < 3.4028235E37F && this instanceof net.minecraft.world.entity.player.Player) {
|
||||
@@ -175,7 +193,7 @@ index 1fdc19830bf4cf677df60c5760e02ae53abc85cc..57ec3ca7677fcc7390503c3002b78fb9
|
||||
}
|
||||
|
||||
if (f > 0 || !human) {
|
||||
@@ -2152,7 +2152,7 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -2184,7 +2184,7 @@ public abstract class LivingEntity extends Entity {
|
||||
// PAIL: Be sure to drag all this code from the EntityHuman subclass each update.
|
||||
((net.minecraft.world.entity.player.Player) this).causeFoodExhaustion(damagesource.getFoodExhaustion(), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.DAMAGED); // CraftBukkit - EntityExhaustionEvent
|
||||
if (f < 3.4028235E37F) {
|
||||
@@ -184,7 +202,7 @@ index 1fdc19830bf4cf677df60c5760e02ae53abc85cc..57ec3ca7677fcc7390503c3002b78fb9
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -2174,7 +2174,7 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -2206,7 +2206,7 @@ public abstract class LivingEntity extends Entity {
|
||||
CriteriaTriggers.ENTITY_HURT_PLAYER.trigger((ServerPlayer) this, damagesource, f, originalDamage, true);
|
||||
f2 = (float) -event.getDamage(DamageModifier.BLOCKING);
|
||||
if (f2 > 0.0F && f2 < 3.4028235E37F) {
|
||||
@@ -194,10 +212,10 @@ index 1fdc19830bf4cf677df60c5760e02ae53abc85cc..57ec3ca7677fcc7390503c3002b78fb9
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 5c16235115a9233bce1f5b30bb020d105bdca3d1..d33b62dab84beb3386a8738dd5dbcb96f0552351 100644
|
||||
index b22e4068407f3012b62683abd060509829e61c62..fc01e48c0e2c7f4e56379cb8b89c78e7a874c053 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1041,7 +1041,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1084,7 +1084,7 @@ public abstract class Player extends LivingEntity {
|
||||
float f2 = f1 - f;
|
||||
|
||||
if (f2 > 0.0F && f2 < 3.4028235E37F) {
|
||||
@@ -206,7 +224,7 @@ index 5c16235115a9233bce1f5b30bb020d105bdca3d1..d33b62dab84beb3386a8738dd5dbcb96
|
||||
}
|
||||
|
||||
if (f != 0.0F) {
|
||||
@@ -1051,7 +1051,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1094,7 +1094,7 @@ public abstract class Player extends LivingEntity {
|
||||
this.setHealth(this.getHealth() - f);
|
||||
this.getCombatTracker().recordDamage(damagesource, f3, f);
|
||||
if (f < 3.4028235E37F) {
|
||||
@@ -215,7 +233,7 @@ index 5c16235115a9233bce1f5b30bb020d105bdca3d1..d33b62dab84beb3386a8738dd5dbcb96
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1377,7 +1377,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1420,7 +1420,7 @@ public abstract class Player extends LivingEntity {
|
||||
if (target instanceof LivingEntity) {
|
||||
float f5 = f3 - ((LivingEntity) target).getHealth();
|
||||
|
||||
@@ -224,7 +242,7 @@ index 5c16235115a9233bce1f5b30bb020d105bdca3d1..d33b62dab84beb3386a8738dd5dbcb96
|
||||
if (j > 0) {
|
||||
// CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
|
||||
EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), target.getBukkitEntity(), j * 4);
|
||||
@@ -1641,29 +1641,29 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1689,29 +1689,29 @@ public abstract class Player extends LivingEntity {
|
||||
int i;
|
||||
|
||||
if (this.isSwimming()) {
|
||||
@@ -259,7 +277,7 @@ index 5c16235115a9233bce1f5b30bb020d105bdca3d1..d33b62dab84beb3386a8738dd5dbcb96
|
||||
if (i > 0) {
|
||||
if (this.isSprinting()) {
|
||||
this.awardStat(Stats.SPRINT_ONE_CM, i);
|
||||
@@ -1677,10 +1677,10 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1725,10 +1725,10 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
}
|
||||
} else if (this.isFallFlying()) {
|
||||
@@ -272,7 +290,7 @@ index 5c16235115a9233bce1f5b30bb020d105bdca3d1..d33b62dab84beb3386a8738dd5dbcb96
|
||||
if (i > 25) {
|
||||
this.awardStat(Stats.FLY_ONE_CM, i);
|
||||
}
|
||||
@@ -1691,7 +1691,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1739,7 +1739,7 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
public void checkRidingStatistics(double dx, double dy, double dz) {
|
||||
if (this.isPassenger()) {
|
||||
@@ -281,7 +299,7 @@ index 5c16235115a9233bce1f5b30bb020d105bdca3d1..d33b62dab84beb3386a8738dd5dbcb96
|
||||
|
||||
if (i > 0) {
|
||||
Entity entity = this.getVehicle();
|
||||
@@ -1718,7 +1718,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1766,7 +1766,7 @@ public abstract class Player extends LivingEntity {
|
||||
return false;
|
||||
} else {
|
||||
if (fallDistance >= 2.0F) {
|
||||
@@ -290,24 +308,11 @@ index 5c16235115a9233bce1f5b30bb020d105bdca3d1..d33b62dab84beb3386a8738dd5dbcb96
|
||||
}
|
||||
|
||||
return super.causeFallDamage(fallDistance, damageMultiplier, damageSource);
|
||||
diff --git a/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java b/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java
|
||||
index df4152f08b553df8895bb9e9dc39d586501ce431..3f3d7921dbea8d9daff3b5c914cb1646a858495a 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java
|
||||
@@ -341,7 +341,7 @@ public class EnchantmentHelper {
|
||||
} else {
|
||||
level += 1 + random.nextInt(i / 4 + 1) + random.nextInt(i / 4 + 1);
|
||||
float f = (random.nextFloat() + random.nextFloat() - 1.0F) * 0.15F;
|
||||
- level = Mth.clamp(Math.round((float)level + (float)level * f), 1, Integer.MAX_VALUE);
|
||||
+ level = Mth.clamp(carpetfixes.helpers.FastMath.round((float)level + (float)level * f), 1, Integer.MAX_VALUE);
|
||||
List<EnchantmentInstance> list2 = getAvailableEnchantmentResults(level, stack, treasureAllowed);
|
||||
if (!list2.isEmpty()) {
|
||||
WeightedRandom.getRandomItem(random, list2).ifPresent(list::add);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/DaylightDetectorBlock.java b/src/main/java/net/minecraft/world/level/block/DaylightDetectorBlock.java
|
||||
index e57c5242866165e589277bd0184098c7806538ba..7d55c56e7372bd80d8f33f76a94dc6c18dd365a7 100644
|
||||
index 16504b8be08064e61b013fa943f692816612cbd0..c5b39234822626b4ff948464409ca415250619e9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/DaylightDetectorBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/DaylightDetectorBlock.java
|
||||
@@ -61,7 +61,7 @@ public class DaylightDetectorBlock extends BaseEntityBlock {
|
||||
@@ -62,7 +62,7 @@ public class DaylightDetectorBlock extends BaseEntityBlock {
|
||||
float f1 = f < 3.1415927F ? 0.0F : 6.2831855F;
|
||||
|
||||
f += (f1 - f) * 0.2F;
|
||||
@@ -316,6 +321,21 @@ index e57c5242866165e589277bd0184098c7806538ba..7d55c56e7372bd80d8f33f76a94dc6c1
|
||||
}
|
||||
|
||||
i = Mth.clamp(i, (int) 0, (int) 15);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
index 264ca51c2f2a5ff69688372b71ad7355366bac1a..01fcbe8445de6d024b17c205d9363faa6b2dfa39 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
@@ -249,8 +249,8 @@ public abstract class ChunkGenerator {
|
||||
|
||||
for (int j1 = 0; j1 < j; ++j1) {
|
||||
double d1 = (double) (4 * i + i * i1 * 6) + (randomsource.nextDouble() - 0.5D) * (double) i * 2.5D;
|
||||
- int k1 = (int) Math.round(Math.cos(d0) * d1);
|
||||
- int l1 = (int) Math.round(Math.sin(d0) * d1);
|
||||
+ int k1 = (int) carpetfixes.helpers.FastMath.round(Math.cos(d0) * d1);
|
||||
+ int l1 = (int) carpetfixes.helpers.FastMath.round(Math.sin(d0) * d1);
|
||||
BiomeSource worldchunkmanager = this.biomeSource;
|
||||
int i2 = SectionPos.sectionToBlockCoord(k1, 8);
|
||||
int j2 = SectionPos.sectionToBlockCoord(l1, 8);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/LootingEnchantFunction.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/LootingEnchantFunction.java
|
||||
index 31918fa2eb38e42a5ea5366e559f25ea9d7d59ae..f512f1e0c46b96f831fdea3073e57c6bfd9c69eb 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/loot/functions/LootingEnchantFunction.java
|
||||
@@ -330,7 +350,7 @@ index 31918fa2eb38e42a5ea5366e559f25ea9d7d59ae..f512f1e0c46b96f831fdea3073e57c6b
|
||||
stack.setCount(this.limit);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
|
||||
index 2e1fba82dc1fceab42628d944e4ef429ce46c0f9..7aeeb180334660c81fecf22fbe62b66d4bce8b93 100644
|
||||
index 731c7dd15f131dc124be6af8f342b122cb89491b..3ca1a2599a211374cb95e73fdc8c8b3069496660 100644
|
||||
--- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
|
||||
+++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
|
||||
@@ -59,8 +59,8 @@ public final class Shapes {
|
||||
@@ -358,14 +378,14 @@ index 0ecac76577eb440a0c3104ef4603acec826c474d..4813bd6de894d0566e8631d8c71915c3
|
||||
|
||||
// Yatopia start - Last tick time API
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index 21c4a287c8fc550be36fc5b60bdc458d71a9d25d..06e44d2fba48a217dc1e63a1901f6d3a45b305b9 100644
|
||||
index 4ef25b6203371b9c22275e1015ea75d870acf8da..2cd6f76c378f3666617e33a0b7dca439316aa325 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -235,4 +235,9 @@ public class MiraiConfig {
|
||||
@@ -244,4 +244,9 @@ public class MiraiConfig {
|
||||
serverMetrics = getBoolean("enable-server-metrics", serverMetrics);
|
||||
}
|
||||
|
||||
+ public static boolean riskyMathRoundOpt = false;
|
||||
+ public static boolean riskyMathRoundOpt = true;
|
||||
+ private static void fastMathRound() {
|
||||
+ riskyMathRoundOpt = getBoolean("use-risky-mathround-opt", riskyMathRoundOpt);
|
||||
+ }
|
||||
@@ -7,10 +7,10 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 57ec3ca7677fcc7390503c3002b78fb9b973226c..add84a30460e80259b452f105f81394696c90120 100644
|
||||
index a42f5e16e18586d4a72cdfd517e7796728701d6c..0968f6b6d32760ceb5717c5f8fc100377f4c2d7d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3390,6 +3390,8 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -3422,6 +3422,8 @@ public abstract class LivingEntity extends Entity {
|
||||
}
|
||||
|
||||
private void updateFallFlying() {
|
||||
@@ -1,29 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Sat, 8 Jan 2022 22:00:46 +0100
|
||||
Subject: [PATCH] Skip enchanting table book tick
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java
|
||||
index f177c88d2a122a34b5c601fb8c0d15fb16925f6b..b3eef862248574ee4b864107e1eb69d2418ada8c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java
|
||||
@@ -49,6 +49,9 @@ public class EnchantmentTableBlockEntity extends BlockEntity implements Nameable
|
||||
}
|
||||
|
||||
public static void bookAnimationTick(Level world, BlockPos pos, BlockState state, EnchantmentTableBlockEntity blockEntity) {
|
||||
+ // Mirai start
|
||||
+ return;
|
||||
+ /*
|
||||
blockEntity.oOpen = blockEntity.open;
|
||||
blockEntity.oRot = blockEntity.rot;
|
||||
Player player = world.getNearestPlayer((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 3.0D, false);
|
||||
@@ -102,6 +105,8 @@ public class EnchantmentTableBlockEntity extends BlockEntity implements Nameable
|
||||
h = Mth.clamp(h, -0.2F, 0.2F);
|
||||
blockEntity.flipA += (h - blockEntity.flipA) * 0.9F;
|
||||
blockEntity.flip += blockEntity.flipA;
|
||||
+ */
|
||||
+ // Mirai end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -7,10 +7,10 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index da6156f1d61ca20fd39f35da36c64afe62b2731b..56b3cd94b6883ff210af96f4995798a46375b70b 100644
|
||||
index 1936cd779223f0ca7f6fa266725560fef40c3653..20d9fe4a88c49a9952eb06ee37dbaa0f2908b0a9 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -217,6 +217,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -222,6 +222,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
return new Throwable(entity + " Added to world at " + new java.util.Date());
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index add84a30460e80259b452f105f81394696c90120..48337a93af6792ce40fded0cb64f2f59c1e7995f 100644
|
||||
index 0968f6b6d32760ceb5717c5f8fc100377f4c2d7d..15fc1ccef371bf8b2b27238193f9d6b57e521b4e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2431,6 +2431,8 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -2463,6 +2463,8 @@ public abstract class LivingEntity extends Entity {
|
||||
}
|
||||
|
||||
protected void updateSwingTime() {
|
||||
@@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: ishland <ishlandmc@yeah.net>
|
||||
Date: Tue, 21 Sep 2021 10:37:34 +0200
|
||||
Subject: [PATCH] c2me: optimization.math
|
||||
Subject: [PATCH] c2me: opts math
|
||||
|
||||
Copyright (c) 2021-2022 ishland
|
||||
|
||||
@@ -9,14 +9,14 @@ Original code by RelativityMC, licensed under MIT
|
||||
You can find the original code on https://github.com/RelativityMC/C2ME-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java b/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java
|
||||
index d5439c68bb7d3b54e085170e294709c067721207..809dae109043f06fb9a2f1257825ef172b7ac21f 100644
|
||||
index fb84d703b4461343d50510d7c9be32fc1f09ed22..3da6b30febc98e5392e42d39c5bd69a82116dc2d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java
|
||||
@@ -11,6 +11,27 @@ public final class ImprovedNoise {
|
||||
public final double yo;
|
||||
public final double zo;
|
||||
|
||||
+ // Mirai start - c2me: optimization.math
|
||||
+ // Mirai start - c2me: opts math
|
||||
+ private static final double[] FLAT_SIMPLEX_GRAD = new double[]{
|
||||
+ 1, 1, 0, 0,
|
||||
+ -1, 1, 0, 0,
|
||||
@@ -44,7 +44,7 @@ index d5439c68bb7d3b54e085170e294709c067721207..809dae109043f06fb9a2f1257825ef17
|
||||
return this.noise(x, y, z, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
+ // Mirai start - c2me: optimization.math
|
||||
+ // Mirai start - c2me: opts math
|
||||
+ /**
|
||||
+ * @author ishland
|
||||
+ * @reason optimize: remove frequent type conversions
|
||||
@@ -93,15 +93,10 @@ index d5439c68bb7d3b54e085170e294709c067721207..809dae109043f06fb9a2f1257825ef17
|
||||
public double noiseWithDerivative(double x, double y, double z, double[] ds) {
|
||||
double d = x + this.xo;
|
||||
@@ -84,26 +109,76 @@ public final class ImprovedNoise {
|
||||
return this.p[hash & 255] & 255;
|
||||
return this.p[input & 255] & 255;
|
||||
}
|
||||
|
||||
+ // Mirai start - c2me: optimization.math
|
||||
+ /**
|
||||
+ * @author ishland
|
||||
+ * @reason inline math & small optimization: remove frequent type conversions and redundant ops
|
||||
+ */
|
||||
private double sampleAndLerp(int sectionX, int sectionY, int sectionZ, double localX, double localY, double localZ, double fadeLocalX) {
|
||||
- private double sampleAndLerp(int sectionX, int sectionY, int sectionZ, double localX, double localY, double localZ, double fadeLocalY) {
|
||||
- int i = this.p(sectionX);
|
||||
- int j = this.p(sectionX + 1);
|
||||
- int k = this.p(i + sectionY);
|
||||
@@ -117,9 +112,15 @@ index d5439c68bb7d3b54e085170e294709c067721207..809dae109043f06fb9a2f1257825ef17
|
||||
- double p = gradDot(this.p(l + sectionZ + 1), localX, localY - 1.0D, localZ - 1.0D);
|
||||
- double q = gradDot(this.p(n + sectionZ + 1), localX - 1.0D, localY - 1.0D, localZ - 1.0D);
|
||||
- double r = Mth.smoothstep(localX);
|
||||
- double s = Mth.smoothstep(fadeLocalX);
|
||||
- double s = Mth.smoothstep(fadeLocalY);
|
||||
- double t = Mth.smoothstep(localZ);
|
||||
- return Mth.lerp3(r, s, t, d, e, f, g, h, o, p, q);
|
||||
+ // Mirai start - c2me: opts math
|
||||
+ /**
|
||||
+ * @author ishland
|
||||
+ * @reason inline math & small optimization: remove frequent type conversions and redundant ops
|
||||
+ */
|
||||
+ private double sampleAndLerp(int sectionX, int sectionY, int sectionZ, double localX, double localY, double localZ, double fadeLocalX) {
|
||||
+ // TODO [VanillaCopy] but optimized
|
||||
+ final int var0 = sectionX & 0xFF;
|
||||
+ final int var1 = (sectionX + 1) & 0xFF;
|
||||
@@ -188,36 +189,36 @@ index d5439c68bb7d3b54e085170e294709c067721207..809dae109043f06fb9a2f1257825ef17
|
||||
private double sampleWithDerivative(int sectionX, int sectionY, int sectionZ, double localX, double localY, double localZ, double[] ds) {
|
||||
int i = this.p(sectionX);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/synth/PerlinNoise.java b/src/main/java/net/minecraft/world/level/levelgen/synth/PerlinNoise.java
|
||||
index ab0d50625c2d603cdf577602f76f6afb41166ed8..6f006d9f4c92b55dc3e0cc87d6c02ab9006b13e4 100644
|
||||
index 02d176dd374b806cb004056964c1c4ee9e73072b..a8eb8a16074dd2f340d91095ba5e4880959fd377 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/synth/PerlinNoise.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/synth/PerlinNoise.java
|
||||
@@ -25,6 +25,10 @@ public class PerlinNoise {
|
||||
private final double lowestFreqValueFactor;
|
||||
private final double lowestFreqInputFactor;
|
||||
private final double maxValue;
|
||||
+ // Mirai start - c2me: optimization.math
|
||||
+ private int noiseLevelsCount = 0;
|
||||
+ // Mirai start - c2me: opts math
|
||||
+ private int octaveSamplersCount = 0;
|
||||
+ private double[] amplitudesArray = null;
|
||||
+ // Mirai end
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
@@ -85,6 +89,10 @@ public class PerlinNoise {
|
||||
int i = this.amplitudes.size();
|
||||
int j = -this.firstOctave;
|
||||
this.noiseLevels = new ImprovedNoise[i];
|
||||
+ // Mirai start - c2me: optimization.math
|
||||
+ this.noiseLevelsCount = this.noiseLevels.length;
|
||||
@@ -130,6 +134,10 @@ public class PerlinNoise {
|
||||
this.lowestFreqInputFactor = Math.pow(2.0D, (double)(-j));
|
||||
this.lowestFreqValueFactor = Math.pow(2.0D, (double)(i - 1)) / (Math.pow(2.0D, (double)i) - 1.0D);
|
||||
this.maxValue = this.edgeValue(2.0D);
|
||||
+ // Mirai start - c2me: opts math
|
||||
+ this.octaveSamplersCount = this.noiseLevels.length;
|
||||
+ this.amplitudesArray = this.amplitudes.toDoubleArray();
|
||||
+ // Mirai end
|
||||
if (xoroshiro) {
|
||||
PositionalRandomFactory positionalRandomFactory = random.forkPositional();
|
||||
}
|
||||
|
||||
protected double maxValue() {
|
||||
@@ -140,9 +148,33 @@ public class PerlinNoise {
|
||||
random.consumeCount(262);
|
||||
}
|
||||
|
||||
+ // Mirai start - c2me: optimization.math
|
||||
+ // Mirai start - c2me: opts math
|
||||
+ /**
|
||||
+ * @author ishland
|
||||
+ * @reason optimize for common cases
|
||||
@@ -228,11 +229,11 @@ index ab0d50625c2d603cdf577602f76f6afb41166ed8..6f006d9f4c92b55dc3e0cc87d6c02ab9
|
||||
+ double e = this.lowestFreqInputFactor;
|
||||
+ double f = this.lowestFreqValueFactor;
|
||||
+
|
||||
+ for(int i = 0; i < this.noiseLevelsCount; ++i) {
|
||||
+ ImprovedNoise improvedNoise = this.noiseLevels[i];
|
||||
+ if (improvedNoise != null) {
|
||||
+ for(int i = 0; i < this.octaveSamplersCount; ++i) {
|
||||
+ ImprovedNoise perlinNoiseSampler = this.noiseLevels[i];
|
||||
+ if (perlinNoiseSampler != null) {
|
||||
+ @SuppressWarnings("deprecation")
|
||||
+ double g = improvedNoise.noise(
|
||||
+ double g = perlinNoiseSampler.noise(
|
||||
+ wrap(x * e), wrap(y * e), wrap(z * e), 0.0, 0.0
|
||||
+ );
|
||||
+ d += this.amplitudesArray[i] * g * f;
|
||||
@@ -252,14 +253,14 @@ index ab0d50625c2d603cdf577602f76f6afb41166ed8..6f006d9f4c92b55dc3e0cc87d6c02ab9
|
||||
return this.noiseLevels[this.noiseLevels.length - 1 - octave];
|
||||
}
|
||||
|
||||
+ // Mirai start - c2me: optimization.math
|
||||
+ // Mirai start - c2me: opts math
|
||||
+ /**
|
||||
+ * @author ishland
|
||||
+ * @reason remove frequent type conversion
|
||||
+ */
|
||||
public static double wrap(double value) {
|
||||
- return value - (double)Mth.lfloor(value / 3.3554432E7D + 0.5D) * 3.3554432E7D;
|
||||
+ return value - Mth.lfloor(value / 3.3554432E7 + 0.5) * 3.3554432E7;
|
||||
+ return value - Mth.floor(value / 3.3554432E7 + 0.5) * 3.3554432E7;
|
||||
}
|
||||
+ // Mirai end
|
||||
|
||||
@@ -7,24 +7,24 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 48337a93af6792ce40fded0cb64f2f59c1e7995f..0298679a3003729e824ca5223aa3dddb88ae7fe8 100644
|
||||
index 15fc1ccef371bf8b2b27238193f9d6b57e521b4e..c096b4e83d82518f0cee143496b648e010b72754 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -567,11 +567,11 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -569,11 +569,11 @@ public abstract class LivingEntity extends Entity {
|
||||
}
|
||||
|
||||
protected void tryAddFrost() {
|
||||
- if (!this.getBlockStateOn().isAir()) {
|
||||
+ //if (!this.getBlockStateOn().isAir()) { // Mirai
|
||||
- if (!this.getBlockStateOnLegacy().isAir()) {
|
||||
+ //if (!this.getBlockStateOnLegacy().isAir()) { // Mirai
|
||||
int i = this.getTicksFrozen();
|
||||
|
||||
if (i > 0) {
|
||||
- AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED);
|
||||
+ AttributeInstance attributemodifiable = this.getBlockStateOn().isAir() ? null : this.getAttribute(Attributes.MOVEMENT_SPEED); // Mirai
|
||||
+ AttributeInstance attributemodifiable = this.getBlockStateOnLegacy().isAir() ? null : this.getAttribute(Attributes.MOVEMENT_SPEED); // Mirai
|
||||
|
||||
if (attributemodifiable == null) {
|
||||
return;
|
||||
@@ -581,7 +581,7 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -583,7 +583,7 @@ public abstract class LivingEntity extends Entity {
|
||||
|
||||
attributemodifiable.addTransientModifier(new AttributeModifier(LivingEntity.SPEED_MODIFIER_POWDER_SNOW_UUID, "Powder snow slow", (double) f, AttributeModifier.Operation.ADDITION));
|
||||
}
|
||||
@@ -7,7 +7,7 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
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 5b8e3aa4414f9e13bb5c05cf6e4fd89cb84fa1a4..adfb766778dcc34a741f4877651e9638b2d832ae 100644
|
||||
index 9bce290eb0c2cfef4896a3f2076c80bf3d76bd56..ac56484b1bf19dabe4bdd5b25eafa4ac38f08cbe 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
|
||||
@@ -16,11 +16,13 @@ import net.minecraft.nbt.CompoundTag;
|
||||
@@ -7,7 +7,7 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java b/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java
|
||||
index faa9965d233e8a0da30a8f9cfd8430623a1b6c57..31837bba990bee50fbb1b9f8ce581d78ff9b3213 100644
|
||||
index 50a9f33aa31e9273c7c52d4bb2b02f0f884f7ba5..9698c093dd8c18a5a5a4b157c3799191841552e2 100644
|
||||
--- a/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java
|
||||
+++ b/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java
|
||||
@@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableList;
|
||||
@@ -7,7 +7,7 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java b/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java
|
||||
index 31837bba990bee50fbb1b9f8ce581d78ff9b3213..6a2fb50eb785e4cd29aac285c360da557f59652a 100644
|
||||
index 9698c093dd8c18a5a5a4b157c3799191841552e2..6f181fc878a96b09f126ea8d3b19ce3ee4588e19 100644
|
||||
--- a/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java
|
||||
+++ b/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java
|
||||
@@ -56,15 +56,32 @@ public class ClassInstanceMultiMap<T> extends AbstractCollection<T> {
|
||||
@@ -1,34 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Mon, 3 Jan 2022 16:03:27 +0100
|
||||
Subject: [PATCH] Configurable server metrics
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 7a7d0566611aafafba30b7b25c2f1f3e78b054fa..7333e60f404f6f85a2bcb1f8f031a180314abd32 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -123,7 +123,7 @@ public class PaperConfig {
|
||||
MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Paper", entry.getValue());
|
||||
}
|
||||
|
||||
- if (!metricsStarted) {
|
||||
+ if (!metricsStarted && wtf.etil.mirai.MiraiConfig.serverMetrics) { // Mirai - configurable server metrics
|
||||
Metrics.PaperMetrics.startMetrics();
|
||||
metricsStarted = true;
|
||||
}
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index a1d88b8cadf6c193deb69bb577936ebd69e63b2a..21c4a287c8fc550be36fc5b60bdc458d71a9d25d 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -230,4 +230,9 @@ public class MiraiConfig {
|
||||
entitiesCanUsePortals = getBoolean("entities-can-use-portals", entitiesCanUsePortals);
|
||||
}
|
||||
|
||||
+ public static boolean serverMetrics = true;
|
||||
+ private static void allowServerMetrics() {
|
||||
+ serverMetrics = getBoolean("enable-server-metrics", serverMetrics);
|
||||
+ }
|
||||
+
|
||||
}
|
||||
\ No newline at end of file
|
||||
@@ -203,7 +203,7 @@ index 0000000000000000000000000000000000000000..16debe176798f316c122e8e7aef2b50e
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/util/BitStorage.java b/src/main/java/net/minecraft/util/BitStorage.java
|
||||
index a8fd497f1b88f4563bfb517e31a8b309ab78ca9a..9864653f0609856672304a6c8123e20d2233e692 100644
|
||||
index 106610ccc74b70b557b01c61262d56c4f1147acf..fc986f02290fbe20246022072944980f35dd200c 100644
|
||||
--- a/src/main/java/net/minecraft/util/BitStorage.java
|
||||
+++ b/src/main/java/net/minecraft/util/BitStorage.java
|
||||
@@ -1,6 +1,7 @@
|
||||
@@ -222,7 +222,7 @@ index a8fd497f1b88f4563bfb517e31a8b309ab78ca9a..9864653f0609856672304a6c8123e20d
|
||||
+ <T> void compact(Palette<T> srcPalette, Palette<T> dstPalette, short[] out); // JettPack - lithium: chunk.serialization
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/util/SimpleBitStorage.java b/src/main/java/net/minecraft/util/SimpleBitStorage.java
|
||||
index 80938f50fe136d954708e109e590dc76ba04067f..85fc9427d57890b3e9422be1a32f2af4885e4dfb 100644
|
||||
index 36e33923bf48e56c743ed043bcbc66bc32f0422f..0272dee738e86e066108f5cc3729136335d8197e 100644
|
||||
--- a/src/main/java/net/minecraft/util/SimpleBitStorage.java
|
||||
+++ b/src/main/java/net/minecraft/util/SimpleBitStorage.java
|
||||
@@ -2,6 +2,7 @@ package net.minecraft.util;
|
||||
@@ -237,7 +237,6 @@ index 80938f50fe136d954708e109e590dc76ba04067f..85fc9427d57890b3e9422be1a32f2af4
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
-}
|
||||
+
|
||||
+ // JettPack start - lithium: chunk.serialization
|
||||
+ @Override
|
||||
@@ -278,10 +277,9 @@ index 80938f50fe136d954708e109e590dc76ba04067f..85fc9427d57890b3e9422be1a32f2af4
|
||||
+ }
|
||||
+ }
|
||||
+ // JettPack end
|
||||
+}
|
||||
\ No newline at end of file
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java
|
||||
index 225324615cc5d20b928714695f62adee91f43c5a..989e5affc9e249d303893bc2f7c4da275ef659e9 100644
|
||||
index 97c744508cc535418eba65fa722859c81c22d647..a2ea0a2864b9c4f847f1a14ffc0900e67c18f9ee 100644
|
||||
--- a/src/main/java/net/minecraft/util/ZeroBitStorage.java
|
||||
+++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java
|
||||
@@ -2,6 +2,7 @@ package net.minecraft.util;
|
||||
@@ -300,7 +298,7 @@ index 225324615cc5d20b928714695f62adee91f43c5a..989e5affc9e249d303893bc2f7c4da27
|
||||
+ @Override public <T> void compact(Palette<T> srcPalette, Palette<T> dstPalette, short[] out) {} // JettPack
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/PaletteResize.java b/src/main/java/net/minecraft/world/level/chunk/PaletteResize.java
|
||||
index 888959febf9fc5f7d4f586a2b952b9759f871e05..538553dc46d2ec0c67c8b204f791ae73e39c58c4 100644
|
||||
index acae3eb30e0689048937f479dc3070f0688abdad..9c2b79655f2c63a208c7087d5d897db0fb23f697 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/PaletteResize.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/PaletteResize.java
|
||||
@@ -1,5 +1,5 @@
|
||||
@@ -311,7 +309,7 @@ index 888959febf9fc5f7d4f586a2b952b9759f871e05..538553dc46d2ec0c67c8b204f791ae73
|
||||
int onResize(int newBits, T object);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
index a79ad93a8a56c5f001f6d71db2338b9062b429f1..456a8c4711ec065d5cf46c11e8b11c0c22738c46 100644
|
||||
index 08e1309e618377d170c446a1568c21b7bf4e5683..0b4f66d0ef963d6f47b20469b7a1e3f6c3da7c83 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
@@ -22,8 +22,23 @@ import net.minecraft.util.Mth;
|
||||
@@ -320,7 +318,7 @@ index a79ad93a8a56c5f001f6d71db2338b9062b429f1..456a8c4711ec065d5cf46c11e8b11c0c
|
||||
import net.minecraft.util.ZeroBitStorage;
|
||||
+import me.jellysquid.mods.lithium.common.world.chunk.LithiumHashPalette; // JettPack
|
||||
|
||||
public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainerRO<T> {
|
||||
+ // JettPack start - lithium: chunk.serialization
|
||||
+ private static final ThreadLocal<short[]> CACHED_ARRAY_4096 = ThreadLocal.withInitial(() -> new short[4096]);
|
||||
+ private static final ThreadLocal<short[]> CACHED_ARRAY_64 = ThreadLocal.withInitial(() -> new short[64]);
|
||||
@@ -338,23 +336,23 @@ index a79ad93a8a56c5f001f6d71db2338b9062b429f1..456a8c4711ec065d5cf46c11e8b11c0c
|
||||
private static final int MIN_PALETTE_BITS = 0;
|
||||
private final PaletteResize<T> dummyPaletteResize = (newSize, added) -> {
|
||||
return 0;
|
||||
@@ -278,30 +293,54 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
private synchronized PalettedContainer.DiscData<T> write(IdMap<T> idList, PalettedContainer.Strategy provider) { // Paper - synchronize
|
||||
@@ -298,30 +313,54 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
public synchronized PalettedContainerRO.PackedData<T> pack(IdMap<T> idMap, PalettedContainer.Strategy strategy) { // Paper - synchronize
|
||||
this.acquire();
|
||||
|
||||
- PalettedContainer.DiscData var12;
|
||||
- PalettedContainerRO.PackedData var12;
|
||||
+ // JettPack start - lithium: chunk.serialization
|
||||
+ Optional<LongStream> data = Optional.empty();
|
||||
+ List<T> elements = null;
|
||||
try {
|
||||
- HashMapPalette<T> hashMapPalette = new HashMapPalette<>(idList, this.data.storage.getBits(), this.dummyPaletteResize);
|
||||
- int i = provider.size();
|
||||
- HashMapPalette<T> hashMapPalette = new HashMapPalette<>(idMap, this.data.storage.getBits(), this.dummyPaletteResize);
|
||||
- int i = strategy.size();
|
||||
- int[] is = new int[i];
|
||||
- this.data.storage.unpack(is);
|
||||
- swapPalette(is, (id) -> {
|
||||
- return hashMapPalette.idFor(this.data.palette.valueFor(id));
|
||||
- swapPalette(is, (ix) -> {
|
||||
- return hashMapPalette.idFor(this.data.palette.valueFor(ix));
|
||||
- });
|
||||
- int j = provider.calculateBitsForSerialization(idList, hashMapPalette.getSize());
|
||||
- int j = strategy.calculateBitsForSerialization(idMap, hashMapPalette.getSize());
|
||||
- Optional<LongStream> optional;
|
||||
- if (j != 0) {
|
||||
- SimpleBitStorage simpleBitStorage = new SimpleBitStorage(j, i, is);
|
||||
@@ -373,19 +371,19 @@ index a79ad93a8a56c5f001f6d71db2338b9062b429f1..456a8c4711ec065d5cf46c11e8b11c0c
|
||||
+ hashPalette = lithiumHashPalette;
|
||||
}
|
||||
|
||||
- var12 = new PalettedContainer.DiscData<>(hashMapPalette.getEntries(), optional);
|
||||
- var12 = new PalettedContainerRO.PackedData<>(hashMapPalette.getEntries(), optional);
|
||||
+ if (elements == null) {
|
||||
+ LithiumHashPalette<T> compactedPalette = new LithiumHashPalette<>(idList, storage.getBits(), this.dummyPaletteResize);
|
||||
+ short[] array = this.getOrCreate(provider.size());
|
||||
+ LithiumHashPalette<T> compactedPalette = new LithiumHashPalette<>(idMap, storage.getBits(), this.dummyPaletteResize);
|
||||
+ short[] array = this.getOrCreate(strategy.size());
|
||||
+
|
||||
+ storage.compact(this.data.palette(), compactedPalette, array);
|
||||
+
|
||||
+ // If the palette didn't change during compaction, do a simple copy of the data array
|
||||
+ if (hashPalette != null && hashPalette.getSize() == compactedPalette.getSize() && storage.getBits() == provider.calculateBitsForSerialization(idList, hashPalette.getSize())) { // paletteSize can de-sync from palette - see https://github.com/CaffeineMC/lithium-fabric/issues/279
|
||||
+ if (hashPalette != null && hashPalette.getSize() == compactedPalette.getSize() && storage.getBits() == strategy.calculateBitsForSerialization(idMap, hashPalette.getSize())) { // paletteSize can de-sync from palette - see https://github.com/CaffeineMC/lithium-fabric/issues/279
|
||||
+ data = this.asOptional(storage.getRaw().clone());
|
||||
+ elements = hashPalette.getElements();
|
||||
+ } else {
|
||||
+ int bits = provider.calculateBitsForSerialization(idList, compactedPalette.getSize());
|
||||
+ int bits = strategy.calculateBitsForSerialization(idMap, compactedPalette.getSize());
|
||||
+ if (bits != 0) {
|
||||
+ // Re-pack the integer array as the palette has changed size
|
||||
+ SimpleBitStorage copy = new SimpleBitStorage(bits, array.length);
|
||||
@@ -405,14 +403,14 @@ index a79ad93a8a56c5f001f6d71db2338b9062b429f1..456a8c4711ec065d5cf46c11e8b11c0c
|
||||
}
|
||||
|
||||
- return var12;
|
||||
+ return new PalettedContainer.DiscData<>(elements, data);
|
||||
+ return new PalettedContainerRO.PackedData<>(elements, data);
|
||||
+ // JettPack end
|
||||
}
|
||||
|
||||
private static <T> void swapPalette(int[] is, IntUnaryOperator intUnaryOperator) {
|
||||
@@ -333,17 +372,37 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
}
|
||||
@@ -361,17 +400,37 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
|
||||
@Override
|
||||
public void count(PalettedContainer.CountConsumer<T> counter) {
|
||||
- if (this.data.palette.getSize() == 1) {
|
||||
- counter.accept(this.data.palette.valueFor(0), this.data.storage.getSize());
|
||||
@@ -7,7 +7,7 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
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 ec727ff5318f90e6241dc423a3156504c6e20c1d..38f2d97c2ffb6911c5020274b0a853ddc7d1589d 100644
|
||||
index ec23064d5a6d70508fad7cffc6126cfd6f7a62cb..055de40d30062bc0e13b288b72809b4e2e175290 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -76,6 +76,54 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -9,10 +9,10 @@ Original code by YatopiaMC, licensed under MIT
|
||||
You can find the original code on https://github.com/YatopiaMC/Yatopia
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index bf42644d2053de4e3c7b9e531b18230b07f094c5..c32cba5dbbfb31ecdf6a8762390f4a6473ebf237 100644
|
||||
index f5aca2054dcad52301b9b99e44fbd3723aabdad7..f120e10679d38f3db22315f16a00622ab7601c2a 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -606,7 +606,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -613,7 +613,7 @@ public class ServerPlayer extends Player {
|
||||
|
||||
@Override
|
||||
protected void onInsideBlock(BlockState state) {
|
||||
@@ -21,7 +21,7 @@ index bf42644d2053de4e3c7b9e531b18230b07f094c5..c32cba5dbbfb31ecdf6a8762390f4a64
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -652,7 +652,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -659,7 +659,7 @@ public class ServerPlayer extends Player {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ index bf42644d2053de4e3c7b9e531b18230b07f094c5..c32cba5dbbfb31ecdf6a8762390f4a64
|
||||
if (this.levitationStartPos != null) {
|
||||
CriteriaTriggers.LEVITATION.trigger(this, this.levitationStartPos, this.tickCount - this.levitationStartTime);
|
||||
}
|
||||
@@ -728,9 +728,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -735,9 +735,7 @@ public class ServerPlayer extends Player {
|
||||
this.connection.send(new ClientboundSetExperiencePacket(this.experienceProgress, this.totalExperience, this.experienceLevel));
|
||||
}
|
||||
|
||||
@@ -42,10 +42,10 @@ index bf42644d2053de4e3c7b9e531b18230b07f094c5..c32cba5dbbfb31ecdf6a8762390f4a64
|
||||
// CraftBukkit start - initialize oldLevel, fire PlayerLevelChangeEvent, and tick client-sided world border
|
||||
if (this.oldLevel == -1) {
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index 06e44d2fba48a217dc1e63a1901f6d3a45b305b9..c289ae5a720204b678b9563b3c54ad672b862107 100644
|
||||
index 2cd6f76c378f3666617e33a0b7dca439316aa325..e86875be3f0e723d3242c9809cd05e767ee49ea4 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -240,4 +240,13 @@ public class MiraiConfig {
|
||||
@@ -249,4 +249,13 @@ public class MiraiConfig {
|
||||
riskyMathRoundOpt = getBoolean("use-risky-mathround-opt", riskyMathRoundOpt);
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@ Original code by YatopiaMC, licensed under MIT
|
||||
You can find the original code on https://github.com/YatopiaMC/Yatopia
|
||||
|
||||
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 dae989bf664b9ab29d13825d5fce32e19852259e..222077807922288973273985bb459264d800bca6 100644
|
||||
index 64c8eefa0302b04b416cd4912c01c50feddf1301..b9abfa591bf535de3805f7bb2b3f3401c8a4c1f6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -128,7 +128,7 @@ public class ItemEntity extends Entity {
|
||||
@@ -138,7 +138,7 @@ public class ItemEntity extends Entity {
|
||||
|
||||
if (this.level.isClientSide) {
|
||||
this.noPhysics = false;
|
||||
@@ -10,13 +10,13 @@ Original code by YatopiaMC, licensed under MIT
|
||||
You can find the original code on https://github.com/YatopiaMC/Yatopia
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index d33b62dab84beb3386a8738dd5dbcb96f0552351..695dd38d775c2e3d053f6779f03c7f260314faf0 100644
|
||||
index fc01e48c0e2c7f4e56379cb8b89c78e7a874c053..8f0bc485597167caef4ed01e787181fff0bd2598 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -275,19 +275,21 @@ public abstract class Player extends LivingEntity {
|
||||
this.moveCloak();
|
||||
@@ -283,19 +283,21 @@ public abstract class Player extends LivingEntity {
|
||||
if (!this.level.isClientSide) {
|
||||
this.foodData.tick(this);
|
||||
this.wardenSpawnTracker.tick();
|
||||
- this.awardStat(Stats.PLAY_TIME);
|
||||
- this.awardStat(Stats.TOTAL_WORLD_TIME);
|
||||
- if (this.isAlive()) {
|
||||
@@ -600,10 +600,10 @@ index 0000000000000000000000000000000000000000..ffc44c333f0dbaf07cc2c68ac390e0a7
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index f585b23c4f958184c4388c5c832dac1eaf7ae788..9358f38b10256e2f37f24edfce1e7699e8307dfe 100644
|
||||
index 139884cead5a6d9d5b5990943e5a4ab4336ad22a..4279b170440faf28a061360d40ed6303d8cc1a97 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -150,9 +150,29 @@ import org.bukkit.event.entity.EntityPoseChangeEvent;
|
||||
@@ -153,9 +153,29 @@ import org.bukkit.event.entity.EntityPoseChangeEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
// CraftBukkit end
|
||||
@@ -634,7 +634,7 @@ index f585b23c4f958184c4388c5c832dac1eaf7ae788..9358f38b10256e2f37f24edfce1e7699
|
||||
private static final int CURRENT_LEVEL = 2;
|
||||
public boolean preserveMotion = true; // Paper - keep initial motion on first setPositionRotation
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/AvoidEntityGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/AvoidEntityGoal.java
|
||||
index ebf19357d7e3a5e4d02ac685fa70d118a8e40eb4..a2ad44bfe3a371a663e41c084f40e9a71f278f1c 100644
|
||||
index 66e5c2716684f54e15e931e33d09463c0df0fda3..4f5a0d57eba877ee90f35e134496a71ebb127b0c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/AvoidEntityGoal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/AvoidEntityGoal.java
|
||||
@@ -11,6 +11,12 @@ import net.minecraft.world.entity.ai.targeting.TargetingConditions;
|
||||
@@ -684,7 +684,7 @@ index ebf19357d7e3a5e4d02ac685fa70d118a8e40eb4..a2ad44bfe3a371a663e41c084f40e9a7
|
||||
return false;
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/LookAtPlayerGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/LookAtPlayerGoal.java
|
||||
index bae3db488371909c82946d6da294cda4e5a19cb5..76a9b7d823c563946e84a3e9c70ababe4476b5f4 100644
|
||||
index 8b189d7587303263efa1790066e5a83edd45f9d7..352662385884e0c818961171b2c7f3ca5df00942 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/LookAtPlayerGoal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/LookAtPlayerGoal.java
|
||||
@@ -8,6 +8,12 @@ import net.minecraft.world.entity.LivingEntity;
|
||||
@@ -738,7 +738,7 @@ index bae3db488371909c82946d6da294cda4e5a19cb5..76a9b7d823c563946e84a3e9c70ababe
|
||||
|
||||
return this.lookAt != null;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/entity/EntitySection.java b/src/main/java/net/minecraft/world/level/entity/EntitySection.java
|
||||
index 9b39920baea28fe85a0bb6ada0e00a466b3ddf31..ee744cf4d5a794565decb46a7b1c7147f447270e 100644
|
||||
index 13ebaf6aede402f5f702aae6c1e44445b00cd9bb..4bca54ab894b71f433d9f5318ed8363bea046983 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/entity/EntitySection.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/entity/EntitySection.java
|
||||
@@ -12,6 +12,13 @@ import com.ishland.vmp.common.general.collections.ITypeFilterableList; // Mirai
|
||||
@@ -755,10 +755,10 @@ index 9b39920baea28fe85a0bb6ada0e00a466b3ddf31..ee744cf4d5a794565decb46a7b1c7147
|
||||
|
||||
public class EntitySection<T extends EntityAccess> {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -22,6 +29,70 @@ public class EntitySection<T extends EntityAccess> {
|
||||
@@ -21,6 +28,69 @@ public class EntitySection<T extends EntityAccess> {
|
||||
public int itemCount;
|
||||
public int inventoryEntityCount;
|
||||
// Paper end
|
||||
|
||||
+ // JettPack start - lithium: ai.nearby_entity_tracking
|
||||
+ private final ReferenceOpenHashSet<NearbyEntityListener> nearbyEntityListeners = new ReferenceOpenHashSet<>(0);
|
||||
+ private final ReferenceOpenHashSet<SectionedEntityMovementTracker<?, ?>> sectionVisibilityListeners = new ReferenceOpenHashSet<>(0);
|
||||
@@ -822,11 +822,10 @@ index 9b39920baea28fe85a0bb6ada0e00a466b3ddf31..ee744cf4d5a794565decb46a7b1c7147
|
||||
+ return this.pos;
|
||||
+ }
|
||||
+ // JettPack end
|
||||
+
|
||||
|
||||
public EntitySection(Class<T> entityClass, Visibility status) {
|
||||
this.chunkStatus = status;
|
||||
this.storage = new ClassInstanceMultiMap<>(entityClass);
|
||||
@@ -36,6 +107,16 @@ public class EntitySection<T extends EntityAccess> {
|
||||
@@ -36,6 +106,16 @@ public class EntitySection<T extends EntityAccess> {
|
||||
}
|
||||
// Paper end
|
||||
this.storage.add(entity);
|
||||
@@ -843,7 +842,7 @@ index 9b39920baea28fe85a0bb6ada0e00a466b3ddf31..ee744cf4d5a794565decb46a7b1c7147
|
||||
}
|
||||
|
||||
public boolean remove(T entity) {
|
||||
@@ -46,6 +127,13 @@ public class EntitySection<T extends EntityAccess> {
|
||||
@@ -46,6 +126,13 @@ public class EntitySection<T extends EntityAccess> {
|
||||
this.inventoryEntityCount--;
|
||||
}
|
||||
// Paper end
|
||||
@@ -857,7 +856,7 @@ index 9b39920baea28fe85a0bb6ada0e00a466b3ddf31..ee744cf4d5a794565decb46a7b1c7147
|
||||
return this.storage.remove(entity);
|
||||
}
|
||||
|
||||
@@ -107,6 +195,7 @@ public class EntitySection<T extends EntityAccess> {
|
||||
@@ -107,6 +194,7 @@ public class EntitySection<T extends EntityAccess> {
|
||||
// Mirai end
|
||||
|
||||
public boolean isEmpty() {
|
||||
@@ -865,7 +864,7 @@ index 9b39920baea28fe85a0bb6ada0e00a466b3ddf31..ee744cf4d5a794565decb46a7b1c7147
|
||||
return this.storage.isEmpty();
|
||||
}
|
||||
|
||||
@@ -119,6 +208,33 @@ public class EntitySection<T extends EntityAccess> {
|
||||
@@ -119,6 +207,33 @@ public class EntitySection<T extends EntityAccess> {
|
||||
}
|
||||
|
||||
public Visibility updateChunkStatus(Visibility status) {
|
||||
@@ -900,7 +899,7 @@ index 9b39920baea28fe85a0bb6ada0e00a466b3ddf31..ee744cf4d5a794565decb46a7b1c7147
|
||||
this.chunkStatus = status;
|
||||
return visibility;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java
|
||||
index ba8aef74c0c23a39b0e4387916a904e14d41a25a..5c2ce7fe796f80d9c4f634e4e14967f5c0765f75 100644
|
||||
index ad12d9660cd57d147859a0e3e123c5b87c8e9748..df076e32d98813f94d68f9fee9afc90e4eeb11fd 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java
|
||||
@@ -20,6 +20,10 @@ import net.minecraft.core.SectionPos;
|
||||
@@ -914,9 +913,9 @@ index ba8aef74c0c23a39b0e4387916a904e14d41a25a..5c2ce7fe796f80d9c4f634e4e14967f5
|
||||
|
||||
public class EntitySectionStorage<T extends EntityAccess> {
|
||||
private final Class<T> entityClass;
|
||||
@@ -93,6 +97,20 @@ public class EntitySectionStorage<T extends EntityAccess> {
|
||||
@@ -103,6 +107,20 @@ public class EntitySectionStorage<T extends EntityAccess> {
|
||||
}
|
||||
// JettPack end
|
||||
// Mirai end
|
||||
|
||||
+ // JettPack start - lithium: ai.nearby_entity_tracking
|
||||
+ private final Object2ReferenceOpenHashMap<SectionedEntityMovementTracker<?, ?>, SectionedEntityMovementTracker<?, ?>> sectionEntityMovementTrackers = new Object2ReferenceOpenHashMap<>();
|
||||
@@ -935,7 +934,7 @@ index ba8aef74c0c23a39b0e4387916a904e14d41a25a..5c2ce7fe796f80d9c4f634e4e14967f5
|
||||
public LongStream getExistingSectionPositionsInChunk(long chunkPos) {
|
||||
int i = ChunkPos.getX(chunkPos);
|
||||
int j = ChunkPos.getZ(chunkPos);
|
||||
@@ -120,7 +138,11 @@ public class EntitySectionStorage<T extends EntityAccess> {
|
||||
@@ -130,7 +148,11 @@ public class EntitySectionStorage<T extends EntityAccess> {
|
||||
}
|
||||
|
||||
public EntitySection<T> getOrCreateSection(long sectionPos) {
|
||||
@@ -949,7 +948,7 @@ index ba8aef74c0c23a39b0e4387916a904e14d41a25a..5c2ce7fe796f80d9c4f634e4e14967f5
|
||||
|
||||
@Nullable
|
||||
diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
|
||||
index 649df137ac36a62e53b42b7675c606e9e57795b2..20e9f1e2910091a5b0ef025ccd5341fa71cb57ea 100644
|
||||
index 30c4974b4019d67cffabd3e686c782659def3ba6..93d71c17c9904b92c81c4f93bc35a493803280ef 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
|
||||
@@ -35,6 +35,10 @@ import net.minecraft.world.level.ChunkPos;
|
||||
@@ -1040,7 +1039,7 @@ index 649df137ac36a62e53b42b7675c606e9e57795b2..20e9f1e2910091a5b0ef025ccd5341fa
|
||||
|
||||
}
|
||||
|
||||
@@ -599,6 +645,18 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
|
||||
@@ -608,6 +654,18 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
|
||||
@Override
|
||||
public void onRemove(Entity.RemovalReason reason) {
|
||||
org.spigotmc.AsyncCatcher.catchOp("Entity remove"); // Paper
|
||||
@@ -7,28 +7,30 @@ Original code by Titaniumtown, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://gitlab.com/Titaniumtown/JettPack
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 9358f38b10256e2f37f24edfce1e7699e8307dfe..5ca352d786b28630040034f6612a2cb6297058a8 100644
|
||||
index 4279b170440faf28a061360d40ed6303d8cc1a97..9fc77dc845fc993ebb9d96f9af107f7e1e8e8a39 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1802,10 +1802,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1890,12 +1890,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
}
|
||||
|
||||
+ // JettPack start - allow passing BlockPos to getBrightness
|
||||
public float getBrightness() {
|
||||
- return this.level.hasChunkAt(this.getBlockX(), this.getBlockZ()) ? this.level.getBrightness(new BlockPos(this.getX(), this.getEyeY(), this.getZ())) : 0.0F;
|
||||
+ return this.getBrightness(new BlockPos(this.getX(), this.getEyeY(), this.getZ()));
|
||||
+ // JettPack start - allow passing BlockPos to getLightLevelDependentMagicValue
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
public float getLightLevelDependentMagicValue() {
|
||||
- return this.level.hasChunkAt(this.getBlockX(), this.getBlockZ()) ? this.level.getLightLevelDependentMagicValue(new BlockPos(this.getX(), this.getEyeY(), this.getZ())) : 0.0F;
|
||||
+ return this.level.getLightLevelDependentMagicValue(new BlockPos(this.getX(), this.getEyeY(), this.getZ()));
|
||||
}
|
||||
|
||||
+ public float getBrightness(BlockPos pos) {
|
||||
+ return this.level.hasChunkAt(this.getBlockX(), this.getBlockZ()) ? this.level.getBrightness(pos) : 0.0F;
|
||||
+ public float getLightLevelDependentMagicValue(BlockPos pos) {
|
||||
+ return this.level.hasChunkAt(this.getBlockX(), this.getBlockZ()) ? this.level.getLightLevelDependentMagicValue(pos) : 0.0F;
|
||||
+ }
|
||||
+ // JettPack end
|
||||
+
|
||||
public void absMoveTo(double x, double y, double z, float yaw, float pitch) {
|
||||
this.absMoveTo(x, y, z);
|
||||
this.setYRot(yaw % 360.0F);
|
||||
@@ -4222,6 +4228,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4317,6 +4323,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
// Paper end - block invalid positions
|
||||
|
||||
@@ -42,10 +44,10 @@ index 9358f38b10256e2f37f24edfce1e7699e8307dfe..5ca352d786b28630040034f6612a2cb6
|
||||
// Paper start
|
||||
this.setPosRaw(x, y, z, false);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 340589e02b316553acefee480f86cf53d5d17560..e3dcb96f1291ad2f9161274499f4e6af6b836ae6 100644
|
||||
index 9980df9128dfc51f2afbca8f4aa2031e3728796a..a60cca663da4200d482c19d0b41a9514825a1e9b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -1621,15 +1621,31 @@ public abstract class Mob extends LivingEntity {
|
||||
@@ -1641,15 +1641,31 @@ public abstract class Mob extends LivingEntity {
|
||||
|
||||
}
|
||||
|
||||
@@ -55,7 +57,7 @@ index 340589e02b316553acefee480f86cf53d5d17560..e3dcb96f1291ad2f9161274499f4e6af
|
||||
+ // JettPack end
|
||||
public boolean isSunBurnTick() {
|
||||
if (this.level.isDay() && !this.level.isClientSide) {
|
||||
- float f = this.getBrightness();
|
||||
- float f = this.getLightLevelDependentMagicValue();
|
||||
- BlockPos blockposition = new BlockPos(this.getX(), this.getEyeY(), this.getZ());
|
||||
+ // JettPack start - optimizations and cache eye blockpos
|
||||
+ int positionHashCode = this.getPositionHashCode();
|
||||
@@ -64,7 +66,7 @@ index 340589e02b316553acefee480f86cf53d5d17560..e3dcb96f1291ad2f9161274499f4e6af
|
||||
+ this.cached_position_hashcode = positionHashCode;
|
||||
+ }
|
||||
+
|
||||
+ float f = this.getBrightness(cached_eye_blockpos); // Pass BlockPos to getBrightness
|
||||
+ float f = this.getLightLevelDependentMagicValue(cached_eye_blockpos); // Pass BlockPos to getBrightness
|
||||
+
|
||||
+ // Check brightness first
|
||||
+ if (f <= 0.5F) return false;
|
||||
@@ -138,7 +138,7 @@ index 0000000000000000000000000000000000000000..493661ff3ac7247b68b7b02784b09b0e
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
|
||||
index 465b15e7ca2a83735bdd6510256636723486b1cb..63f5acd8b5aaf936b08d389c8f871bea8c5373da 100644
|
||||
index 153451ecd5b3c8e8ecb2d5ec91ccd582d4300899..4487752469f9ab95e9d2aeb76a9627dc02095d76 100644
|
||||
--- a/src/main/java/net/minecraft/core/BlockPos.java
|
||||
+++ b/src/main/java/net/minecraft/core/BlockPos.java
|
||||
@@ -18,6 +18,12 @@ import net.minecraft.world.phys.AABB;
|
||||
@@ -7,7 +7,7 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
||||
index f50abfd058e3adf1cf8c0f4468a60bc04e8541e7..a078f637ed005dfad5c2c2f601e4ba5964ba7f8d 100644
|
||||
index 6a0a1731fd6804eb69d3641213712d31bce085b2..5f4bb589474ce7d4f214e32ab0bc4b9cb71638d0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
||||
@@ -269,7 +269,16 @@ public class Raid {
|
||||
@@ -27,7 +27,7 @@ index f50abfd058e3adf1cf8c0f4468a60bc04e8541e7..a078f637ed005dfad5c2c2f601e4ba59
|
||||
if (!this.isStopped()) {
|
||||
if (this.status == Raid.RaidStatus.ONGOING) {
|
||||
boolean flag = this.active;
|
||||
@@ -625,7 +634,7 @@ public class Raid {
|
||||
@@ -626,7 +635,7 @@ public class Raid {
|
||||
}
|
||||
|
||||
public void updateBossbar() {
|
||||
@@ -37,7 +37,7 @@ index f50abfd058e3adf1cf8c0f4468a60bc04e8541e7..a078f637ed005dfad5c2c2f601e4ba59
|
||||
|
||||
public float getHealthOfLivingRaiders() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
||||
index c5611465b1f9228a994c462c093cec94d7d08c2f..dfffbf47b58e16c9b5b750ccdb9717eacf414a64 100644
|
||||
index 4bb9730b6a42702e91467f980b9f045585039db3..7ba9c7f995c2bacc8f9a86a78747ea30f45eb59a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
||||
@@ -46,8 +46,9 @@ import net.minecraft.world.phys.Vec3;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user