diff --git a/patches/server/0001-Yatopia-Server-Fixes.patch b/patches/server/0001-Yatopia-Server-Fixes.patch index b2b5fa73..59bb7d7c 100644 --- a/patches/server/0001-Yatopia-Server-Fixes.patch +++ b/patches/server/0001-Yatopia-Server-Fixes.patch @@ -107,14 +107,15 @@ index c9fa39c5b4b013b56720e339463ffcb5fd3c13f9..00000000000000000000000000000000 - - for (final NextTickListEntry toTick : this.toTickThisTick) { diff --git a/src/main/java/de/minebench/origami/OrigamiConfig.java b/src/main/java/de/minebench/origami/OrigamiConfig.java -index fe7330fabe386966c2d203a190a00a785ea21be0..2cedf4d7aaefc064f5730015c41c1f5102bc747d 100644 +index fe7330fabe386966c2d203a190a00a785ea21be0..e2bbbfeb7e2505479e6a457294aaa550b97319ca 100644 --- a/src/main/java/de/minebench/origami/OrigamiConfig.java +++ b/src/main/java/de/minebench/origami/OrigamiConfig.java -@@ -112,6 +112,19 @@ public final class OrigamiConfig { +@@ -112,6 +112,20 @@ public final class OrigamiConfig { config.addDefault("worlds.default." + path, Double.valueOf(dfl)); return config.getDouble("worlds." + worldName + "." + path, config.getDouble("worlds.default." + path, dfl)); } + ++ // Yatopia start + public boolean tickEmptyHoppers = true; + public int fullHopperCooldown = 128; + private void hopperOptimizations() { @@ -124,9 +125,9 @@ index fe7330fabe386966c2d203a190a00a785ea21be0..2cedf4d7aaefc064f5730015c41c1f51 + + public boolean fastFeatureSearchDontLoad = false; + private void fastFeatureSearchDontLoad() { -+ fastFeatureSearchDontLoad = getBoolean("fast-feature-search-dont-load", fastFeatureSearchDontLoad); ++ fastFeatureSearchDontLoad = getBoolean("fast-feature-search-dont-load", false); + } -+ ++ // Yatopia end } } @@ -585,7 +586,7 @@ index bada470cba41cce9beb9eb04227b42c1d489d731..00000000000000000000000000000000 - private int c; - private TileEntityShulkerBox.AnimationPhase i; diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 9ae62bd4a6742eb77082867da6edb94c29aa2d9b..197726bdfcb887a1daac1352726f33ef08fa32b1 100644 +index 9ae62bd4a6742eb77082867da6edb94c29aa2d9b..29ffa302fa5b3d7d0ece23e2e0eda79d46747c3b 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -97,6 +97,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -606,15 +607,7 @@ index 9ae62bd4a6742eb77082867da6edb94c29aa2d9b..197726bdfcb887a1daac1352726f33ef this.generator = gen; this.world = new CraftWorld((WorldServer) this, gen, env); this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit -@@ -641,6 +645,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - - public void b(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {} - -+ - public void applyPhysics(BlockPosition blockposition, Block block) { - if (captureBlockStates) { return; } // Paper - Cancel all physics during placement - this.a(blockposition.west(), block, blockposition); -@@ -678,6 +683,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -678,6 +682,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } @@ -886,18 +879,10 @@ index f3a3a42c346353d699163317efad0e88f666924f..8fab87414b78c2e9bbe6fe98c70bfa6a + // Purpur end } diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index af1d37720fe8ea68bea8cad94ddf4ed907f98696..5ba71b957001a91c46970b5aab30dadb7a488f0d 100644 +index af1d37720fe8ea68bea8cad94ddf4ed907f98696..73a36683e386d9e8e917b6ac04262aae3e3d3b69 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -138,6 +138,7 @@ public class Main { - .defaultsTo(new File("paper.yml")) - .describedAs("Yml file"); - // Paper end -+ - // Tuinity Start - Server Config - acceptsAll(asList("tuinity", "tuinity-settings"), "File for tuinity settings") - .withRequiredArg() -@@ -154,6 +155,30 @@ public class Main { +@@ -154,6 +154,30 @@ public class Main { .describedAs("Yml file"); // Purpur end diff --git a/patches/server/0003-Brandings.patch b/patches/server/0003-Brandings.patch index a0646c8b..4d7fa484 100644 --- a/patches/server/0003-Brandings.patch +++ b/patches/server/0003-Brandings.patch @@ -18,18 +18,31 @@ index 74ed02fa9296583977bb721014b10ff8b708b43c..a13c7b2b5bc79ecaea404779149ed02c ); diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaVersionFetcher.java b/src/main/java/dev/tr7zw/yatopia/YatopiaVersionFetcher.java new file mode 100644 -index 0000000000000000000000000000000000000000..523e3b50d535e91afe8b14fdb53966da030963dc +index 0000000000000000000000000000000000000000..dfa51d6f170ec4fb010dce909c3fccb6c726deb4 --- /dev/null +++ b/src/main/java/dev/tr7zw/yatopia/YatopiaVersionFetcher.java -@@ -0,0 +1,20 @@ +@@ -0,0 +1,96 @@ +package dev.tr7zw.yatopia; + ++import com.destroystokyo.paper.VersionHistoryManager; ++import com.google.common.base.Charsets; ++import com.google.gson.Gson; ++import com.google.gson.JsonObject; ++import com.google.gson.JsonSyntaxException; ++import java.io.BufferedReader; ++import java.io.IOException; ++import java.io.InputStreamReader; ++import java.net.HttpURLConnection; ++import java.net.URL; +import javax.annotation.Nonnull; + +import com.destroystokyo.paper.util.VersionFetcher; ++import javax.annotation.Nullable; + +public class YatopiaVersionFetcher implements VersionFetcher { + ++ private static final String GITHUB_BRANCH_NAME = "ver/1.16.1"; ++ + @Override + public long getCacheTime() { + return Long.MAX_VALUE; @@ -38,7 +51,70 @@ index 0000000000000000000000000000000000000000..523e3b50d535e91afe8b14fdb53966da + @Nonnull + @Override + public String getVersionMessage(@Nonnull String serverVersion) { -+ return "\u00AF\\_(\u30C4)_/\u00AF"; ++ String[] parts = serverVersion.substring("git-Yatopia-".length()).split("[-\\s]"); ++ String updateMessage = getUpdateStatusMessage("tr7zw/Yatopia", GITHUB_BRANCH_NAME, parts[0]); ++ String history = getHistory(); ++ return history != null ? history + "\n" + updateMessage : updateMessage; ++ } ++ ++ private String getUpdateStatusMessage(String repo, String branch, String versionInfo) { ++ versionInfo = versionInfo.replace("\"", ""); ++ int distance = fetchDistanceFromGitHub(repo, branch, versionInfo); ++ ++ switch (distance) { ++ case -1: ++ return "Error obtaining version information"; ++ case 0: ++ return "You are running the latest version"; ++ case -2: ++ return "\u00AF\\_(\u30C4)_/\u00AF"; ++ default: ++ return "You are " + distance + " version(s) behind"; ++ } ++ } ++ ++ // Contributed by Techcable in GH-65 ++ // from PaperVersionFetcher ++ private static int fetchDistanceFromGitHub(@Nonnull String repo, @Nonnull String branch, @Nonnull String hash) { ++ try { ++ HttpURLConnection connection = (HttpURLConnection) new URL("https://api.github.com/repos/" + repo + "/compare/" + branch + "..." + hash).openConnection(); ++ connection.connect(); ++ if (connection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) return -2; // Unknown commit ++ try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), Charsets.UTF_8))) { ++ JsonObject obj = new Gson().fromJson(reader, JsonObject.class); ++ String status = obj.get("status").getAsString(); ++ switch (status) { ++ case "identical": ++ return 0; ++ case "behind": ++ return obj.get("behind_by").getAsInt(); ++ default: ++ return -1; ++ } ++ } catch (JsonSyntaxException | NumberFormatException e) { ++ e.printStackTrace(); ++ return -1; ++ } ++ } catch (IOException e) { ++ e.printStackTrace(); ++ return -1; ++ } ++ } ++ ++ // from PaperVersionFetcher ++ @Nullable ++ private String getHistory() { ++ final VersionHistoryManager.VersionData data = VersionHistoryManager.INSTANCE.getVersionData(); ++ if (data == null) { ++ return null; ++ } ++ ++ final String oldVersion = data.getOldVersion(); ++ if (oldVersion == null) { ++ return null; ++ } ++ ++ return "Previous version: " + oldVersion; + } + +} @@ -95,3 +171,52 @@ index 001b1e5197eaa51bfff9031aa6c69876c9a47960..2e6cd1780d759a9f94dc4d740fa1b81f Properties properties = new Properties(); if (stream != null) { +diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java +index 4d310908489953d6d061b2358f614142edacb62e..870a3b64aaf933ba22c32b699b576a96ca4dae25 100644 +--- a/src/main/java/org/spigotmc/WatchdogThread.java ++++ b/src/main/java/org/spigotmc/WatchdogThread.java +@@ -26,7 +26,7 @@ public class WatchdogThread extends Thread + + private WatchdogThread(long timeoutTime, boolean restart) + { +- super( "Paper Watchdog Thread" ); ++ super( "Yatopia Watchdog Thread" ); // Yatopia + this.timeoutTime = timeoutTime; + this.restart = restart; + earlyWarningEvery = Math.min(PaperConfig.watchdogPrintEarlyWarningEvery, timeoutTime); // Paper +@@ -158,14 +158,14 @@ public class WatchdogThread extends Thread + if (isLongTimeout) { + // Paper end + log.log( Level.SEVERE, "------------------------------" ); +- log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Paper bug." ); // Paper ++ log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Yatopia bug." ); // Paper // Yatopia + log.log( Level.SEVERE, "If you see a plugin in the Server thread dump below, then please report it to that author" ); + log.log( Level.SEVERE, "\t *Especially* if it looks like HTTP or MySQL operations are occurring" ); + log.log( Level.SEVERE, "If you see a world save or edit, then it means you did far more than your server can handle at once" ); + log.log( Level.SEVERE, "\t If this is the case, consider increasing timeout-time in spigot.yml but note that this will replace the crash with LARGE lag spikes" ); +- log.log( Level.SEVERE, "If you are unsure or still think this is a Paper bug, please report this to https://github.com/PaperMC/Paper/issues" ); ++ log.log( Level.SEVERE, "If you are unsure or still think this is a Yatopia bug, please report this to https://github.com/tr7zw/Yatopia/issues" ); // Yatopia + log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" ); +- log.log( Level.SEVERE, "Paper version: " + Bukkit.getServer().getVersion() ); ++ log.log( Level.SEVERE, "Yatopia version: " + Bukkit.getServer().getVersion() ); // Yatopia + // + if ( net.minecraft.server.World.lastPhysicsProblem != null ) + { +@@ -188,7 +188,7 @@ public class WatchdogThread extends Thread + // Paper end + } else + { +- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---"); ++ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO YATOPIA - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---"); // Yatopia + log.log(Level.SEVERE, "The server has not responded for " + (currentTime - lastTick) / 1000 + " seconds! Creating thread dump"); + } + // Paper end - Different message for short timeout +@@ -209,7 +209,7 @@ public class WatchdogThread extends Thread + dumpThread( thread, log ); + } + } else { +- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH ---"); ++ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO YATOPIA - THIS IS NOT A BUG OR A CRASH ---"); // Yatopia + } + + diff --git a/patches/server/0004-Add-GameProfileLookupEvent.patch b/patches/server/0004-Add-GameProfileLookupEvent.patch index f7ebecf4..7b35f2be 100644 --- a/patches/server/0004-Add-GameProfileLookupEvent.patch +++ b/patches/server/0004-Add-GameProfileLookupEvent.patch @@ -5,89 +5,60 @@ Subject: [PATCH] Add GameProfileLookupEvent diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java -index dd96dd296d042c0625e527b50b3acfc19a2bf43e..0c5f2a010f30eb32bea273d7e65b0741016480e5 100644 +index dd96dd296d042c0625e527b50b3acfc19a2bf43e..2a67013f6d2656a3d89cb042ba401bcaeb731d83 100644 --- a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java +++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java -@@ -5,9 +5,13 @@ import com.google.common.base.Charsets; - import com.mojang.authlib.GameProfile; - import com.mojang.authlib.properties.Property; - import com.mojang.authlib.properties.PropertyMap; -+ -+import dev.tr7zw.yatopia.events.GameProfileLookupEvent; - import net.minecraft.server.MinecraftServer; - import net.minecraft.server.UserCache; - import org.apache.commons.lang3.Validate; -+ -+import org.bukkit.Bukkit; - import org.bukkit.craftbukkit.entity.CraftPlayer; - import org.spigotmc.SpigotConfig; +@@ -185,13 +185,24 @@ public class CraftPlayerProfile implements PlayerProfile { -@@ -182,17 +186,24 @@ public class CraftPlayerProfile implements PlayerProfile { - } - public boolean complete(boolean textures, boolean onlineMode) { - MinecraftServer server = MinecraftServer.getServer(); -- boolean isCompleteFromCache = this.completeFromCache(true, onlineMode); if (onlineMode && (!isCompleteFromCache || textures && !hasTextures())) { - GameProfile result = server.getMinecraftSessionService().fillProfileProperties(profile, true); - if (result != null) { - copyProfileProperties(result, this.profile, true); -+ // Yatopia start -+ GameProfileLookupEvent event = new GameProfileLookupEvent(!Bukkit.isPrimaryThread(), profile.getId(), profile.getName()); -+ Bukkit.getServer().getPluginManager().callEvent(event); -+ if (event.getGameProfile() != null) { -+ this.profile = event.getGameProfile(); -+ } else { -+ GameProfile result = server.getMinecraftSessionService().fillProfileProperties(profile, true); -+ if (result != null) { -+ copyProfileProperties(result, this.profile, true); -+ } -+ if (this.profile.isComplete()) { -+ server.getUserCache().saveProfile(this.profile); -+ } -+ } -+ // Yatopia end - } +- } - if (this.profile.isComplete()) { - server.getUserCache().saveProfile(this.profile); -- } -- } ++ // Yatopia start ++ dev.tr7zw.yatopia.events.GameProfileLookupEvent event = new ++ dev.tr7zw.yatopia.events.GameProfileLookupEvent( ++ !org.bukkit.Bukkit.isPrimaryThread(), profile.getId(), profile.getName()); ++ org.bukkit.Bukkit.getPluginManager().callEvent(event); ++ GameProfile eventProfile = event.getGameProfile(); ++ if (eventProfile != null) { ++ this.profile = eventProfile; ++ } else { ++ GameProfile result = server.getMinecraftSessionService().fillProfileProperties(profile, true); ++ if (result != null) { ++ copyProfileProperties(result, this.profile, true); ++ } ++ if (this.profile.isComplete()) { ++ server.getUserCache().saveProfile(this.profile); ++ } + } ++ // Yatopia end + } return profile.isComplete() && (!onlineMode || !textures || hasTextures()); } - diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java -index 579a81e521fdfabfa0318d06c6760a8ab7a88c1e..ceb1f18a49ebc8fbac270d9f221fa44f9baea216 100644 +index 579a81e521fdfabfa0318d06c6760a8ab7a88c1e..ab553f408b31cb7e2d281cc3d8fe42e19dc717d9 100644 --- a/src/main/java/net/minecraft/server/TileEntitySkull.java +++ b/src/main/java/net/minecraft/server/TileEntitySkull.java -@@ -4,9 +4,14 @@ import com.google.common.collect.Iterables; - import com.mojang.authlib.GameProfile; - import com.mojang.authlib.minecraft.MinecraftSessionService; - import com.mojang.authlib.properties.Property; -+ -+import dev.tr7zw.yatopia.events.GameProfileLookupEvent; -+ - import java.util.UUID; - import javax.annotation.Nullable; - -+import org.bukkit.Bukkit; -+ - // Spigot start - import com.google.common.base.Predicate; - import com.google.common.cache.LoadingCache; -@@ -77,7 +82,15 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa +@@ -77,7 +77,18 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa if ( property == null ) { -- profile = TileEntitySkull.sessionService.fillProfileProperties( profile, true ); -+ // Yatopia start -+ GameProfileLookupEvent event = new GameProfileLookupEvent(!Bukkit.isPrimaryThread(), profile.getId(), profile.getName()); -+ Bukkit.getServer().getPluginManager().callEvent(event); -+ if (event.getGameProfile() != null) { -+ profile = event.getGameProfile(); -+ } else { -+ profile = TileEntitySkull.sessionService.fillProfileProperties( profile, true ); -+ } -+ // Yatopia end ++ // Yatopia start ++ dev.tr7zw.yatopia.events.GameProfileLookupEvent event = ++ new dev.tr7zw.yatopia.events.GameProfileLookupEvent( ++ !org.bukkit.Bukkit.isPrimaryThread(), profile.getId(), profile.getName()); ++ org.bukkit.Bukkit.getPluginManager().callEvent(event); ++ GameProfile eventProfile = event.getGameProfile(); ++ if (eventProfile != null) { ++ profile = eventProfile; ++ } else { + profile = TileEntitySkull.sessionService.fillProfileProperties( profile, true ); ++ } ++ // Yatopia end } } diff --git a/patches/server/0006-Add-config-Yatopia-command-and-basic-settings.patch b/patches/server/0006-Add-config-Yatopia-command-and-basic-settings.patch index 64c0fcdf..138d8e13 100644 --- a/patches/server/0006-Add-config-Yatopia-command-and-basic-settings.patch +++ b/patches/server/0006-Add-config-Yatopia-command-and-basic-settings.patch @@ -18,34 +18,30 @@ index 88513b8830ea666ddf831771680b6e76e7cf95f0..6a110318441a16cc3ff7dfa236476827 new TimingsExport(listeners, parent, history).start(); diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaCommand.java b/src/main/java/dev/tr7zw/yatopia/YatopiaCommand.java new file mode 100644 -index 0000000000000000000000000000000000000000..eca581513324401e1c6b3e818ba9ea6e9925490f +index 0000000000000000000000000000000000000000..119c3b693370ab8753791a0396789c8971a05c9b --- /dev/null +++ b/src/main/java/dev/tr7zw/yatopia/YatopiaCommand.java -@@ -0,0 +1,129 @@ +@@ -0,0 +1,126 @@ +package dev.tr7zw.yatopia; + ++import com.google.common.base.Preconditions; +import java.io.File; -+import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; -+import java.util.Iterator; +import java.util.List; +import java.util.Locale; + ++import java.util.function.Function; ++import com.google.common.collect.Lists; ++import net.minecraft.server.MinecraftKey; ++import net.minecraft.server.MinecraftServer; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; + -+import com.google.common.base.Functions; -+import com.google.common.collect.Iterables; -+import com.google.common.collect.Lists; -+ -+import net.minecraft.server.MinecraftKey; -+import net.minecraft.server.MinecraftServer; -+ +public class YatopiaCommand extends Command { + + public YatopiaCommand(String name) { @@ -57,14 +53,15 @@ index 0000000000000000000000000000000000000000..eca581513324401e1c6b3e818ba9ea6e + + @Override + public List tabComplete(CommandSender sender, String alias, String[] args, Location location) throws IllegalArgumentException { -+ if (args.length <= 1) ++ if (args.length <= 1) { + return getListMatchingLast(args, "help", "info", "reload", "version"); ++ } + return Collections.emptyList(); + } + + // Code from Mojang - copyright them + public static List getListMatchingLast(String[] args, String... matches) { -+ return getListMatchingLast(args, (Collection) Arrays.asList(matches)); ++ return getListMatchingLast(args, Arrays.asList(matches)); + } + + public static boolean matches(String s, String s1) { @@ -73,27 +70,27 @@ index 0000000000000000000000000000000000000000..eca581513324401e1c6b3e818ba9ea6e + + public static List getListMatchingLast(String[] strings, Collection collection) { + String last = strings[strings.length - 1]; -+ ArrayList results = Lists.newArrayList(); ++ List results = Lists.newArrayList(); + + if (!collection.isEmpty()) { -+ Iterator iterator = Iterables.transform(collection, Functions.toStringFunction()).iterator(); -+ -+ while (iterator.hasNext()) { -+ String s1 = (String) iterator.next(); -+ -+ if (matches(last, s1)) { -+ results.add(s1); ++ Function toStringFunction = (o) -> { ++ Preconditions.checkNotNull(o); ++ return o.toString(); ++ }; ++ for (Object c : collection) { ++ String value = toStringFunction.apply(c); ++ if (matches(last, value)) { ++ results.add(value); + } + } + + if (results.isEmpty()) { -+ iterator = collection.iterator(); -+ -+ while (iterator.hasNext()) { -+ Object object = iterator.next(); -+ -+ if (object instanceof MinecraftKey && matches(last, ((MinecraftKey) object).getKey())) { -+ results.add(String.valueOf(object)); ++ for (Object c : collection) { ++ if (c instanceof MinecraftKey) { ++ MinecraftKey key = (MinecraftKey) c; ++ if (matches(last, key.getKey())) { ++ results.add(key.toString()); ++ } + } + } + } @@ -114,7 +111,7 @@ index 0000000000000000000000000000000000000000..eca581513324401e1c6b3e818ba9ea6e + + switch (args[0].toLowerCase(Locale.ENGLISH)) { + case "info": -+ doInfo(sender); ++ doInfo(sender); + break; + case "reload": + doReload(sender); @@ -154,7 +151,7 @@ index 0000000000000000000000000000000000000000..eca581513324401e1c6b3e818ba9ea6e \ No newline at end of file diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java new file mode 100644 -index 0000000000000000000000000000000000000000..556cf9f17501f13a19a05bf804edcb9c9bf7fe4e +index 0000000000000000000000000000000000000000..5cffd84ed9842bb7d7e56df8ac841b467f6293cc --- /dev/null +++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java @@ -0,0 +1,210 @@ @@ -184,7 +181,7 @@ index 0000000000000000000000000000000000000000..556cf9f17501f13a19a05bf804edcb9c + +public class YatopiaConfig { + -+ private static File CONFIG_FILE; ++ public static File CONFIG_FILE; + private static final String HEADER = "This is the main configuration file for Yatopia.\n" + + "Yatopia contains many breaking changes and settings, so know what you are doing!\n" + + "You have been warned!\n"; @@ -298,7 +295,7 @@ index 0000000000000000000000000000000000000000..556cf9f17501f13a19a05bf804edcb9c + switch (unit) { + case 'd': num *= (double) 60*60*24; break; + case 'h': num *= (double) 60*60; break; -+ case 'm': num *= (double) 60; break; ++ case 'm': num *= 60; break; + default: case 's': break; + } + return (int) num; @@ -347,9 +344,9 @@ index 0000000000000000000000000000000000000000..556cf9f17501f13a19a05bf804edcb9c + return config.getInt(path, config.getInt(path)); + } + -+ private static List getList(String path, T def) { ++ private static List getList(String path, List def) { + config.addDefault(path, def); -+ return config.getList(path, config.getList(path)); ++ return (List) config.getList(path, config.getList(path)); + } + + private static String getString(String path, String def) { @@ -359,12 +356,12 @@ index 0000000000000000000000000000000000000000..556cf9f17501f13a19a05bf804edcb9c + + public static boolean disableEntityStuckChecks = false; + private static void disableEntityStuckChecks() { -+ disableEntityStuckChecks = getBoolean("settings.disableEntityStuckChecks", false); ++ disableEntityStuckChecks = getBoolean("settings.disableEntityStuckChecks", false); + } + + public static boolean disableEntityCollisionboxes = false; + private static void disableEntityCollisionboxes() { -+ disableEntityCollisionboxes = getBoolean("settings.disableEntityCollisionboxes", false); ++ disableEntityCollisionboxes = getBoolean("settings.disableEntityCollisionboxes", false); + } + +} @@ -390,7 +387,7 @@ index 21dc3b9a638c7ca5e2da56c954088f2f367f05e4..c3becefce8143f34ed2b1093dd22227b this.setAllowFlight(dedicatedserverproperties.allowFlight); this.setResourcePack(dedicatedserverproperties.resourcePack, this.aY()); diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index dd093e3e624158ff87bad59785ed2496f161f64c..ec84bc4dceff76fd2f823a6a9548fdf180291584 100644 +index dd093e3e624158ff87bad59785ed2496f161f64c..fe0689f6be466d1a2a1ed2b76331272199a0aa0c 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -1035,7 +1035,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -398,7 +395,7 @@ index dd093e3e624158ff87bad59785ed2496f161f64c..ec84bc4dceff76fd2f823a6a9548fdf1 VoxelShape voxelshape = this.world.getWorldBorder().c(); Stream stream = !this.world.getWorldBorder().isInBounds(axisalignedbb) ? Stream.empty() : Stream.of(voxelshape); // Paper - Stream stream1 = this.world.c(this, axisalignedbb.b(vec3d), (entity) -> { -+ Stream stream1 = dev.tr7zw.yatopia.YatopiaConfig.disableEntityCollisionboxes ? Stream.empty() : this.world.c(this, axisalignedbb.b(vec3d), (entity) -> { ++ Stream stream1 = dev.tr7zw.yatopia.YatopiaConfig.disableEntityCollisionboxes ? Stream.empty() : this.world.c(this, axisalignedbb.b(vec3d), (entity) -> { // Yatopia return true; }); StreamAccumulator streamaccumulator = new StreamAccumulator<>(Stream.concat(stream1, stream)); @@ -435,10 +432,10 @@ index 856e0ba3cfe6225d9928cb99b2d7a00a8fcd6a03..6f4c1bbf39af205ad15318eac667117d world.worldDataServer.setDifficulty(config.difficulty); world.setSpawnFlags(config.spawnMonsters, config.spawnAnimals); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 5ba71b957001a91c46970b5aab30dadb7a488f0d..c4495f89898861c385b32e70d3b6a3f12b91bdd3 100644 +index 73a36683e386d9e8e917b6ac04262aae3e3d3b69..60b4c2337e6fdeddfb785e90fa501149af45756c 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -179,6 +179,14 @@ public class Main { +@@ -178,6 +178,14 @@ public class Main { .describedAs("Yml file"); // Rainforest end diff --git a/patches/server/0007-Per-entity-type-collision-settings.patch b/patches/server/0007-Per-entity-type-collision-settings.patch index 6a0cea17..622a3f1c 100644 --- a/patches/server/0007-Per-entity-type-collision-settings.patch +++ b/patches/server/0007-Per-entity-type-collision-settings.patch @@ -14,14 +14,14 @@ The whole code is based around 1 class, the EntityFilter class. Whole filtering Co-authored-by: tr7zw diff --git a/src/main/java/de/minebench/origami/OrigamiConfig.java b/src/main/java/de/minebench/origami/OrigamiConfig.java -index 2cedf4d7aaefc064f5730015c41c1f5102bc747d..bdeb72c04831209466742b9fb6747ebefbe7ca48 100644 +index e2bbbfeb7e2505479e6a457294aaa550b97319ca..a89209347418b3006745c50043d0abdf2b91babc 100644 --- a/src/main/java/de/minebench/origami/OrigamiConfig.java +++ b/src/main/java/de/minebench/origami/OrigamiConfig.java -@@ -125,6 +125,39 @@ public final class OrigamiConfig { - fastFeatureSearchDontLoad = getBoolean("fast-feature-search-dont-load", fastFeatureSearchDontLoad); +@@ -125,6 +125,37 @@ public final class OrigamiConfig { + private void fastFeatureSearchDontLoad() { + fastFeatureSearchDontLoad = getBoolean("fast-feature-search-dont-load", false); } - -+ // Yatopia start ++ + public boolean playerCollisions = true; + public boolean animalCollisions = true; + public boolean ambientCollisions = true; @@ -52,12 +52,9 @@ index 2cedf4d7aaefc064f5730015c41c1f5102bc747d..bdeb72c04831209466742b9fb6747ebe + && pillagerCollisions && ironGolemCollisions && miscCollisions && itemCollisions + && waterCreatureCollisions && waterAmbientCollisions; + } -+ // Yatopia end -+ + // Yatopia end } - } -\ No newline at end of file diff --git a/src/main/java/dev/tr7zw/yatopia/EntityFilter.java b/src/main/java/dev/tr7zw/yatopia/EntityFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..e6617833a7aea4803b78bc55b633fac9698688bd diff --git a/patches/server/0008-Allow-to-change-the-piston-push-limit.patch b/patches/server/0008-Allow-to-change-the-piston-push-limit.patch index 9cbb8c2b..0c6b5240 100644 --- a/patches/server/0008-Allow-to-change-the-piston-push-limit.patch +++ b/patches/server/0008-Allow-to-change-the-piston-push-limit.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Allow to change the piston push limit diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java -index 556cf9f17501f13a19a05bf804edcb9c9bf7fe4e..0eac1342ceba67ca51bed32e4b7c60afbce684d1 100644 +index 5cffd84ed9842bb7d7e56df8ac841b467f6293cc..57820ad632a253c93436a77c5811c1bc44e3f06a 100644 --- a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java +++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java @@ -207,4 +207,8 @@ public class YatopiaConfig { - disableEntityCollisionboxes = getBoolean("settings.disableEntityCollisionboxes", false); + disableEntityCollisionboxes = getBoolean("settings.disableEntityCollisionboxes", false); } + public static int pistonPushLimit = 12; diff --git a/patches/server/0010-Player-saving-async-FileIO.patch b/patches/server/0010-Player-saving-async-FileIO.patch index 665825d6..e8bcd220 100644 --- a/patches/server/0010-Player-saving-async-FileIO.patch +++ b/patches/server/0010-Player-saving-async-FileIO.patch @@ -5,156 +5,57 @@ Subject: [PATCH] Player-saving-async-FileIO diff --git a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java -index cf539c98073b475eb5b769c8cc11d48a7e6d58f1..5442c28c56f933c63bd611f579d0392876ecc2ef 100644 +index cf539c98073b475eb5b769c8cc11d48a7e6d58f1..93b14f01fd7094175968918f0dcd7c3c921f156a 100644 --- a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java +++ b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java -@@ -27,6 +27,8 @@ import java.util.List; - import java.util.Map; - import java.util.Map.Entry; - import java.util.Set; -+import java.util.concurrent.ExecutorService; -+import java.util.concurrent.Executors; - import java.util.stream.Collectors; - import java.util.stream.Stream; - import javax.annotation.Nullable; -@@ -50,6 +52,7 @@ public class AdvancementDataPlayer { +@@ -50,6 +50,7 @@ public class AdvancementDataPlayer { @Nullable private Advancement l; private boolean m = true; -+ public static ExecutorService saveThread = Executors.newSingleThreadExecutor(); // Yatopia ++ public static java.util.concurrent.ExecutorService saveThread = java.util.concurrent.Executors.newSingleThreadExecutor(); // Yatopia // Paper start - fix advancement data player leakage final Map> criterionData = Maps.newIdentityHashMap(); -@@ -228,53 +231,66 @@ public class AdvancementDataPlayer { +@@ -228,6 +229,15 @@ public class AdvancementDataPlayer { jsonelement.getAsJsonObject().addProperty("DataVersion", SharedConstants.getGameVersion().getWorldVersion()); -+ // Yatopia start -+ String gson = null; ++ // Yatopia start - replace whole logic ++ saveThread.submit(() -> { ++ try (OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(f), Charsets.UTF_8.newEncoder())) { ++ AdvancementDataPlayer.b.toJson(jsonelement, writer); ++ } catch (Throwable e) { ++ AdvancementDataPlayer.LOGGER.error("Couldn't save player advancements to {}", this.f, e); ++ } ++ }); ++ /* try { -- FileOutputStream fileoutputstream = new FileOutputStream(this.f); -- Throwable throwable = null; -- -- try { -- OutputStreamWriter outputstreamwriter = new OutputStreamWriter(fileoutputstream, Charsets.UTF_8.newEncoder()); -- Throwable throwable1 = null; -- -- try { -- AdvancementDataPlayer.b.toJson(jsonelement, outputstreamwriter); -- } catch (Throwable throwable2) { -- throwable1 = throwable2; -- throw throwable2; -- } finally { -- if (outputstreamwriter != null) { -- if (throwable1 != null) { -- try { -- outputstreamwriter.close(); -- } catch (Throwable throwable3) { -- throwable1.addSuppressed(throwable3); -- } -- } else { -- outputstreamwriter.close(); -- } -- } -- -- } -- } catch (Throwable throwable4) { -- throwable = throwable4; -- throw throwable4; -- } finally { -- if (fileoutputstream != null) { -- if (throwable != null) { -- try { -- fileoutputstream.close(); -- } catch (Throwable throwable5) { -- throwable.addSuppressed(throwable5); -- } -- } else { -- fileoutputstream.close(); -- } -- } -- -- } -- } catch (IOException ioexception) { -- AdvancementDataPlayer.LOGGER.error("Couldn't save player advancements to {}", this.f, ioexception); -+ gson = AdvancementDataPlayer.b.toJson(jsonelement); -+ } catch (Throwable throwable) { -+ throw throwable; -+ } -+ if(gson != null) { -+ final String fGson = gson; -+ saveThread.submit(() -> { -+ try { -+ FileOutputStream fileoutputstream = new FileOutputStream(this.f); -+ Throwable throwable = null; -+ -+ try { -+ OutputStreamWriter outputstreamwriter = new OutputStreamWriter(fileoutputstream, Charsets.UTF_8.newEncoder()); -+ Throwable throwable1 = null; -+ -+ try { -+ outputstreamwriter.write(fGson); -+ } catch (Throwable throwable2) { -+ throwable1 = throwable2; -+ throw throwable2; -+ } finally { -+ if (outputstreamwriter != null) { -+ if (throwable1 != null) { -+ try { -+ outputstreamwriter.close(); -+ } catch (Throwable throwable3) { -+ throwable1.addSuppressed(throwable3); -+ } -+ } else { -+ outputstreamwriter.close(); -+ } -+ } -+ -+ } -+ } catch (Throwable throwable4) { -+ throwable = throwable4; -+ throw throwable4; -+ } finally { -+ if (fileoutputstream != null) { -+ if (throwable != null) { -+ try { -+ fileoutputstream.close(); -+ } catch (Throwable throwable5) { -+ throwable.addSuppressed(throwable5); -+ } -+ } else { -+ fileoutputstream.close(); -+ } -+ } -+ -+ } -+ } catch (IOException ioexception) { -+ AdvancementDataPlayer.LOGGER.error("Couldn't save player advancements to {}", this.f, ioexception); -+ } -+ }); + FileOutputStream fileoutputstream = new FileOutputStream(this.f); + Throwable throwable = null; +@@ -275,6 +285,8 @@ public class AdvancementDataPlayer { + } catch (IOException ioexception) { + AdvancementDataPlayer.LOGGER.error("Couldn't save player advancements to {}", this.f, ioexception); } ++ */ + // Yatopia end } diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index e411f6280d07e3f6a953e1fcaffaaa49f85dc7cc..3966bf7160ef5a7ec6944397ffbf51f583875860 100644 +index e411f6280d07e3f6a953e1fcaffaaa49f85dc7cc..68c033e2b8542c5656d5b9534a4953a370999097 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -700,11 +700,23 @@ public abstract class EntityHuman extends EntityLiving { +@@ -700,11 +700,20 @@ public abstract class EntityHuman extends EntityLiving { } + // Yatopia start + private NBTTagList inventorySnapshot = null; + private NBTTagList enderchestSnapshot = null; -+ -+ + public void takeInventorySnapshot() { -+ inventorySnapshot = this.inventory.a(new NBTTagList()); -+ enderchestSnapshot = this.enderChest.g(); ++ inventorySnapshot = this.inventory.a(new NBTTagList()); ++ enderchestSnapshot = this.enderChest.g(); + } -+ + // Yatopia end + @Override @@ -166,7 +67,7 @@ index e411f6280d07e3f6a953e1fcaffaaa49f85dc7cc..3966bf7160ef5a7ec6944397ffbf51f5 nbttagcompound.setInt("SelectedItemSlot", this.inventory.itemInHandIndex); nbttagcompound.setShort("SleepTimer", (short) this.sleepTicks); nbttagcompound.setFloat("XpP", this.exp); -@@ -714,7 +726,7 @@ public abstract class EntityHuman extends EntityLiving { +@@ -714,7 +723,7 @@ public abstract class EntityHuman extends EntityLiving { nbttagcompound.setInt("Score", this.getScore()); this.foodData.b(nbttagcompound); this.abilities.a(nbttagcompound); @@ -176,37 +77,29 @@ index e411f6280d07e3f6a953e1fcaffaaa49f85dc7cc..3966bf7160ef5a7ec6944397ffbf51f5 nbttagcompound.set("ShoulderEntityLeft", this.getShoulderEntityLeft()); } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 33c40bf94e74d1ee268fb8ffb809f45b31621df9..c10a1d15bcfe0cb1c2ff6ee7f2881bc2040bcd1d 100644 +index 33c40bf94e74d1ee268fb8ffb809f45b31621df9..0b6c62ff0ac75c7ec11de9f8e9745b07ee12664e 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -19,6 +19,7 @@ import java.util.Optional; - import java.util.Set; - import java.util.UUID; - import java.util.concurrent.CompletableFuture; -+import java.util.concurrent.TimeUnit; - import javax.annotation.Nullable; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -@@ -1260,6 +1261,28 @@ public abstract class PlayerList { +@@ -1260,6 +1260,28 @@ public abstract class PlayerList { if (team != null) scoreboard.removeTeam(team); } // Paper end + + // Yatopia start - make sure all saves are done + try { -+ ((WorldNBTStorage)playerFileData).saveThread.shutdown(); -+ boolean done = ((WorldNBTStorage)playerFileData).saveThread.awaitTermination(60, TimeUnit.SECONDS); -+ if(!done) { ++ playerFileData.saveThread.shutdown(); ++ boolean done = playerFileData.saveThread.awaitTermination(60, java.util.concurrent.TimeUnit.SECONDS); ++ if (!done) { + LOGGER.error("Players did not save completly!"); + } + ServerStatisticManager.saveThread.shutdown(); -+ done = ServerStatisticManager.saveThread.awaitTermination(60, TimeUnit.SECONDS); -+ if(!done) { ++ done = ServerStatisticManager.saveThread.awaitTermination(60, java.util.concurrent.TimeUnit.SECONDS); ++ if (!done) { + LOGGER.error("Stats did not save completly!"); + } + AdvancementDataPlayer.saveThread.shutdown(); -+ done = AdvancementDataPlayer.saveThread.awaitTermination(60, TimeUnit.SECONDS); -+ if(!done) { ++ done = AdvancementDataPlayer.saveThread.awaitTermination(60, java.util.concurrent.TimeUnit.SECONDS); ++ if (!done) { + LOGGER.error("Advancements did not save completly!"); + } + } catch (InterruptedException e) { @@ -216,7 +109,7 @@ index 33c40bf94e74d1ee268fb8ffb809f45b31621df9..c10a1d15bcfe0cb1c2ff6ee7f2881bc2 } // Paper end -@@ -1297,13 +1320,13 @@ public abstract class PlayerList { +@@ -1297,13 +1319,13 @@ public abstract class PlayerList { File file = this.server.a(SavedFile.STATS).toFile(); File file1 = new File(file, uuid + ".json"); @@ -233,45 +126,39 @@ index 33c40bf94e74d1ee268fb8ffb809f45b31621df9..c10a1d15bcfe0cb1c2ff6ee7f2881bc2 serverstatisticmanager = new ServerStatisticManager(this.server, file1); // this.o.put(uuid, serverstatisticmanager); // CraftBukkit diff --git a/src/main/java/net/minecraft/server/ServerStatisticManager.java b/src/main/java/net/minecraft/server/ServerStatisticManager.java -index 18725272f920eafb655de8b923a8a85dbdc704cf..5f222d8b90951c61e77ab7032f8728772ba8ab9d 100644 +index 18725272f920eafb655de8b923a8a85dbdc704cf..a734cb47df9cffaee52a5c798bb3324212a004ba 100644 --- a/src/main/java/net/minecraft/server/ServerStatisticManager.java +++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java -@@ -20,6 +20,10 @@ import java.util.Map; +@@ -20,6 +20,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Optional; import java.util.Set; -+import java.util.Map.Entry; -+import java.util.concurrent.ExecutorService; -+import java.util.concurrent.Executors; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -@@ -30,6 +34,7 @@ public class ServerStatisticManager extends StatisticManager { +@@ -30,6 +31,7 @@ public class ServerStatisticManager extends StatisticManager { private final File d; private final Set> e = Sets.newHashSet(); private int f = -300; -+ public static ExecutorService saveThread = Executors.newSingleThreadExecutor(); // Yatopia ++ public static java.util.concurrent.ExecutorService saveThread = java.util.concurrent.Executors.newSingleThreadExecutor(); // Yatopia public ServerStatisticManager(MinecraftServer minecraftserver, File file) { this.c = minecraftserver; -@@ -40,7 +45,9 @@ public class ServerStatisticManager extends StatisticManager { - Statistic wrapper = StatisticList.CUSTOM.b( entry.getKey() ); +@@ -41,6 +43,7 @@ public class ServerStatisticManager extends StatisticManager { this.a.put( wrapper, entry.getValue().intValue() ); } -- // Spigot end -+ // Spigot ends -+ // Yatopia start -+ saveThread.submit(() -> { + // Spigot end ++ saveThread.submit(() -> { // Yatopia if (file.isFile()) { try { this.a(minecraftserver.getDataFixer(), org.apache.commons.io.FileUtils.readFileToString(file)); -@@ -50,17 +57,21 @@ public class ServerStatisticManager extends StatisticManager { +@@ -50,17 +53,21 @@ public class ServerStatisticManager extends StatisticManager { ServerStatisticManager.LOGGER.error("Couldn't parse statistics file {}", file, jsonparseexception); } } - -+ }); ++ }); // Yatopia } public void save() { @@ -291,7 +178,7 @@ index 18725272f920eafb655de8b923a8a85dbdc704cf..5f222d8b90951c61e77ab7032f872877 } @Override -@@ -111,7 +122,7 @@ public class ServerStatisticManager extends StatisticManager { +@@ -111,7 +118,7 @@ public class ServerStatisticManager extends StatisticManager { if (nbttagcompound2.hasKeyOfType(s2, 99)) { SystemUtils.a(this.a(statisticwrapper, s2), (statistic) -> { @@ -301,56 +188,46 @@ index 18725272f920eafb655de8b923a8a85dbdc704cf..5f222d8b90951c61e77ab7032f872877 ServerStatisticManager.LOGGER.warn("Invalid statistic in {}: Don't know what {} is", this.d, s2); }); diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java -index be060f602f53344cf51c22eafacb4dc9219c8856..b14f3d44a76ccac791b7be353bb2899fc59f70ec 100644 +index be060f602f53344cf51c22eafacb4dc9219c8856..12ffee96cfbd135f107b1dff7a058177e2649964 100644 --- a/src/main/java/net/minecraft/server/WorldNBTStorage.java +++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java -@@ -11,6 +11,10 @@ import org.apache.logging.log4j.LogManager; +@@ -9,8 +9,6 @@ import java.io.OutputStream; + import javax.annotation.Nullable; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; - - // CraftBukkit start -+import java.util.UUID; -+import java.util.concurrent.ExecutorService; -+import java.util.concurrent.Executors; -+ +- +-// CraftBukkit start import org.bukkit.craftbukkit.entity.CraftPlayer; // CraftBukkit end -@@ -19,6 +23,7 @@ public class WorldNBTStorage { +@@ -19,6 +17,7 @@ public class WorldNBTStorage { private static final Logger LOGGER = LogManager.getLogger(); private final File playerDir; protected final DataFixer a; -+ public ExecutorService saveThread = Executors.newSingleThreadExecutor(); // Yatopia ++ public java.util.concurrent.ExecutorService saveThread = java.util.concurrent.Executors.newSingleThreadExecutor(); // Yatopia public WorldNBTStorage(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer) { this.a = datafixer; -@@ -29,14 +34,22 @@ public class WorldNBTStorage { +@@ -28,11 +27,13 @@ public class WorldNBTStorage { + public void save(EntityHuman entityhuman) { if(!com.destroystokyo.paper.PaperConfig.savePlayerData) return; // Paper - Make player data saving configurable ++ entityhuman.takeInventorySnapshot(); // Yatopia ++ saveThread.submit(() -> { // Yatopia try { -- NBTTagCompound nbttagcompound = entityhuman.save(new NBTTagCompound()); -- File file = File.createTempFile(entityhuman.getUniqueIDString() + "-", ".dat", this.playerDir); -- + NBTTagCompound nbttagcompound = entityhuman.save(new NBTTagCompound()); + File file = File.createTempFile(entityhuman.getUniqueIDString() + "-", ".dat", this.playerDir); + - NBTCompressedStreamTools.a(nbttagcompound, (OutputStream) (new FileOutputStream(file))); -- File file1 = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat"); -- File file2 = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat_old"); -- -- SystemUtils.a(file1, file, file2); -+ // Yatopia start -+ entityhuman.takeInventorySnapshot(); // Take a sync inventory/enderchest snapshot to prevent duping -+ saveThread.submit(() -> { // Save the tag async -+ try { -+ NBTTagCompound nbttagcompound = entityhuman.save(new NBTTagCompound()); -+ File file = File.createTempFile(entityhuman.getUniqueIDString() + "-", ".dat", this.playerDir); -+ File file1 = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat"); -+ File file2 = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat_old"); -+ -+ NBTCompressedStreamTools.a(nbttagcompound, (OutputStream) (new FileOutputStream(file))); -+ SystemUtils.a(file1, file, file2); -+ } catch (Exception exception) { -+ WorldNBTStorage.LOGGER.error("Failed to save player data for {}", entityhuman.getName(), exception); // Paper -+ } -+ }); -+ // Yatopia end ++ NBTCompressedStreamTools.a(nbttagcompound, new FileOutputStream(file)); + File file1 = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat"); + File file2 = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat_old"); + +@@ -40,6 +41,7 @@ public class WorldNBTStorage { } catch (Exception exception) { WorldNBTStorage.LOGGER.error("Failed to save player data for {}", entityhuman.getName(), exception); // Paper } ++ }); // Yatopia + + } + diff --git a/patches/server/0015-lithium-MixinGoalSelector.patch b/patches/server/0015-lithium-MixinGoalSelector.patch index 40e13f5a..3f21bdcd 100644 --- a/patches/server/0015-lithium-MixinGoalSelector.patch +++ b/patches/server/0015-lithium-MixinGoalSelector.patch @@ -9,25 +9,15 @@ Original code by JellySquid, licensed under GNU Lesser General Public License v3 you can find the original code on https://github.com/jellysquid3/lithium-fabric/tree/1.16.x/fabric (Yarn mappings) diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -index b783028e5526df722d98e4760ffb214d5d2f83dd..2378a833cd31d703db462dd6f55a5cb858796b8d 100644 +index b783028e5526df722d98e4760ffb214d5d2f83dd..0ad38a7b426b8b1e0ae8a98a2cb5b28878ae1249 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -@@ -1,7 +1,8 @@ - package net.minecraft.server; - - import com.destroystokyo.paper.util.set.OptimizedSmallEnumSet; // Paper - remove streams from pathfindergoalselector --import com.google.common.collect.Sets; -+import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; -+ - import java.util.EnumMap; - import java.util.EnumSet; - import java.util.Iterator; // Paper - remove streams from pathfindergoalselector -@@ -27,7 +28,7 @@ public class PathfinderGoalSelector { +@@ -27,7 +27,7 @@ public class PathfinderGoalSelector { } }; private final Map c = new EnumMap(PathfinderGoal.Type.class); - private final Set d = Sets.newLinkedHashSet(); public final Set getTasks() { return d; }// Paper - OBFHELPER // Paper - private -> public -+ private final Set d = new ObjectLinkedOpenHashSet();/* Yatopia better set */ public final Set getTasks() { return d; }// Paper - OBFHELPER // Paper - private -> public ++ private final Set d = new it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet<>();/* Yatopia better set */ public final Set getTasks() { return d; }// Paper - OBFHELPER // Paper - private -> public private final Supplier e; private final EnumSet f = EnumSet.noneOf(PathfinderGoal.Type.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be. private final OptimizedSmallEnumSet goalTypes = new OptimizedSmallEnumSet<>(PathfinderGoal.Type.class); // Paper - remove streams from pathfindergoalselector diff --git a/patches/server/0016-lithium-MixinLandPathNodeMaker.patch b/patches/server/0016-lithium-MixinLandPathNodeMaker.patch index 4215bc8a..f44cf71d 100644 --- a/patches/server/0016-lithium-MixinLandPathNodeMaker.patch +++ b/patches/server/0016-lithium-MixinLandPathNodeMaker.patch @@ -7,34 +7,22 @@ Original code by JellySquid, licensed under GNU Lesser General Public License v3 you can find the original code on https://github.com/jellysquid3/lithium-fabric/tree/1.16.x/fabric (Yarn mappings) diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java -index ec55785af2b432b692d3a3bf4298ffb32489bf3b..279ca87d8826ea2696ffc08d4b52c55a5e7bd392 100644 +index ec55785af2b432b692d3a3bf4298ffb32489bf3b..4f59e4b31300009f5e7ef8767be6c89d7b449af0 100644 --- a/src/main/java/net/minecraft/server/PathfinderNormal.java +++ b/src/main/java/net/minecraft/server/PathfinderNormal.java -@@ -4,12 +4,23 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectMap; - import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; - import it.unimi.dsi.fastutil.objects.Object2BooleanMap; - import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; -+import com.google.common.collect.Sets; -+ -+import it.unimi.dsi.fastutil.objects.Reference2ReferenceMap; -+import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; -+ - import java.util.EnumSet; - import java.util.Iterator; - import javax.annotation.Nullable; +@@ -10,6 +10,11 @@ import javax.annotation.Nullable; public class PathfinderNormal extends PathfinderAbstract { -+ // Yatopia start -+ -+ // This is not thread-safe! -+ private static final Reference2ReferenceMap commonTypes = new Reference2ReferenceOpenHashMap<>(); ++ // Yatopia start - this is not thread safe! ++ private static final it.unimi.dsi.fastutil.objects.Reference2ReferenceMap commonTypes = ++ new it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap<>(); + // Yatopia end + protected float j; private final Long2ObjectMap k = new Long2ObjectOpenHashMap(); private final Object2BooleanMap l = new Object2BooleanOpenHashMap(); -@@ -508,13 +519,44 @@ public class PathfinderNormal extends PathfinderAbstract { +@@ -508,13 +513,44 @@ public class PathfinderNormal extends PathfinderAbstract { protected static PathType b(IBlockAccess iblockaccess, BlockPosition blockposition) { IBlockData iblockdata = iblockaccess.getTypeIfLoaded(blockposition); // Paper if (iblockdata == null) return PathType.BLOCKED; // Paper @@ -84,7 +72,7 @@ index ec55785af2b432b692d3a3bf4298ffb32489bf3b..279ca87d8826ea2696ffc08d4b52c55a return PathType.DAMAGE_CACTUS; } else if (iblockdata.a(Blocks.SWEET_BERRY_BUSH)) { return PathType.DAMAGE_OTHER; -@@ -540,7 +582,10 @@ public class PathfinderNormal extends PathfinderAbstract { +@@ -540,7 +576,10 @@ public class PathfinderNormal extends PathfinderAbstract { } else { Fluid fluid = iblockdata.getFluid(); // Tuinity - remove another getType call diff --git a/patches/server/0017-lithium-MixinBiome.patch b/patches/server/0017-lithium-MixinBiome.patch index b76267a7..2bd78c7a 100644 --- a/patches/server/0017-lithium-MixinBiome.patch +++ b/patches/server/0017-lithium-MixinBiome.patch @@ -8,20 +8,23 @@ you can find the original code on https://github.com/jellysquid3/lithium-fabric/ 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 new file mode 100644 -index 0000000000000000000000000000000000000000..c2c19a6fbfa2a4aba21aa71789071c69a6246556 +index 0000000000000000000000000000000000000000..3079549f466a350223c3ee11466432bf3dc4c5b6 --- /dev/null +++ b/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedList.java -@@ -0,0 +1,168 @@ +@@ -0,0 +1,171 @@ +package me.jellysquid.mods.lithium.common.util.collections; + -+import it.unimi.dsi.fastutil.objects.ObjectArraySet; -+ -+import java.util.*; ++import java.util.Collection; ++import java.util.HashSet; ++import java.util.Iterator; ++import java.util.List; ++import java.util.ListIterator; ++import java.util.Set; + +/** + * Wraps a {@link List} with a hash table which provides O(1) lookups for {@link Collection#contains(Object)}. + * -+ * @see https://github.com/jellysquid3/lithium-fabric/blob/1.16.x/fabric/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedList.java ++ * @see HashedList + */ +public class HashedList implements List { + private final List list; @@ -177,28 +180,20 @@ index 0000000000000000000000000000000000000000..c2c19a6fbfa2a4aba21aa71789071c69 + } + + public static HashedList wrapper(List list) { -+ return new HashedList<>(list, new ObjectArraySet<>(list)); ++ return new HashedList<>(list, new HashSet<>(list)); // Yatopia - use hashset + } +} \ No newline at end of file diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java -index b2b654218382cc2cf1649067cd140b539235e3d2..bfaba96eb56dd98a67d2c2179335ae48dcbe3849 100644 +index b2b654218382cc2cf1649067cd140b539235e3d2..f7f082c80442cd352e14daa4b199b2f3ad75c22f 100644 --- a/src/main/java/net/minecraft/server/BiomeBase.java +++ b/src/main/java/net/minecraft/server/BiomeBase.java -@@ -7,6 +7,7 @@ import com.google.common.collect.Sets; - import com.mojang.serialization.Codec; - import com.mojang.serialization.codecs.RecordCodecBuilder; - import it.unimi.dsi.fastutil.longs.Long2FloatLinkedOpenHashMap; -+import me.jellysquid.mods.lithium.common.util.collections.HashedList; - - import java.util.*; - import java.util.function.Function; -@@ -139,7 +140,7 @@ public class BiomeBase { +@@ -139,7 +139,7 @@ public class BiomeBase { for (j = 0; j < i; ++j) { EnumCreatureType enumcreaturetype = aenumcreaturetype[j]; - this.v.put(enumcreaturetype, new MobList()); // Paper -+ this.v.put(enumcreaturetype, HashedList.wrapper(new MobList())); // Paper // Yatopia lithium change ++ this.v.put(enumcreaturetype, me.jellysquid.mods.lithium.common.util.collections.HashedList.wrapper(new MobList())); // Paper // Yatopia - lithium change } } else { diff --git a/patches/server/0018-Item-stuck-sleep-config.patch b/patches/server/0018-Item-stuck-sleep-config.patch index ea586fb2..a7619150 100644 --- a/patches/server/0018-Item-stuck-sleep-config.patch +++ b/patches/server/0018-Item-stuck-sleep-config.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Item stuck sleep config diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java -index 0eac1342ceba67ca51bed32e4b7c60afbce684d1..dd9206a70e85507fb538d2b59d97478db57df7b8 100644 +index 57820ad632a253c93436a77c5811c1bc44e3f06a..c7ef8b2cd84d66b955bdbabdecfc18c1d4cc4444 100644 --- a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java +++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java @@ -211,4 +211,9 @@ public class YatopiaConfig { diff --git a/patches/server/0019-Option-for-simpler-Villagers.patch b/patches/server/0019-Option-for-simpler-Villagers.patch index f0b0cf5e..6ba67b61 100644 --- a/patches/server/0019-Option-for-simpler-Villagers.patch +++ b/patches/server/0019-Option-for-simpler-Villagers.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Option for simpler Villagers diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java -index dd9206a70e85507fb538d2b59d97478db57df7b8..02ef2cbc0599461a1c693ef71d2310bb3e6d1fc0 100644 +index c7ef8b2cd84d66b955bdbabdecfc18c1d4cc4444..d8e3bbb2ffbf20a111af3fd7a019daf1d5a7dead 100644 --- a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java +++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java @@ -216,4 +216,13 @@ public class YatopiaConfig { @@ -24,7 +24,7 @@ index dd9206a70e85507fb538d2b59d97478db57df7b8..02ef2cbc0599461a1c693ef71d2310bb } \ No newline at end of file diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index d906c5e530c2e7f779df079223aee619a73b5d51..2fb7f23275acad54d2f5e2ecd57d5bbb333facbe 100644 +index d906c5e530c2e7f779df079223aee619a73b5d51..1ecb19c1c81456148af4a9edd59059356c3c0b94 100644 --- a/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java @@ -7,6 +7,8 @@ import com.mojang.datafixers.util.Pair; @@ -36,23 +36,22 @@ index d906c5e530c2e7f779df079223aee619a73b5d51..2fb7f23275acad54d2f5e2ecd57d5bbb import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import java.util.*; -@@ -27,6 +29,8 @@ import org.bukkit.event.entity.VillagerReplenishTradeEvent; +@@ -27,6 +29,7 @@ import org.bukkit.event.entity.VillagerReplenishTradeEvent; public class EntityVillager extends EntityVillagerAbstract implements ReputationHandler, VillagerDataHolder { -+ //Yatopia -+ private boolean simplerVillagerBehavior = YatopiaConfig.simplerVillagerBehavior; //get this during villager creation so a reloaded config doesn't get them into an invalid state ++ private boolean simplerVillagerBehavior = dev.tr7zw.yatopia.YatopiaConfig.simplerVillagerBehavior; // Yatopia - get this during villager creation so a reloaded config doesn't get them into an invalid state private static final DataWatcherObject by = DataWatcher.a(EntityVillager.class, DataWatcherRegistry.q); public static final Map bw = ImmutableMap.of(Items.BREAD, 4, Items.POTATO, 1, Items.CARROT, 1, Items.BEETROOT, 1); private static final Set bz = ImmutableSet.of(Items.BREAD, Items.POTATO, Items.CARROT, Items.WHEAT, Items.WHEAT_SEEDS, Items.BEETROOT, new Item[]{Items.BEETROOT_SEEDS}); -@@ -63,12 +67,49 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +@@ -63,12 +66,49 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation public EntityVillager(EntityTypes entitytypes, World world, VillagerType villagertype) { super(entitytypes, world); this.bF = new Reputation(); -+ if(!simplerVillagerBehavior) { ++ if (!simplerVillagerBehavior) { ((Navigation) this.getNavigation()).a(true); this.getNavigation().d(true); -+ }else { ++ } else { + initPathfinder(); + } this.setCanPickupLoot(true); @@ -63,9 +62,9 @@ index d906c5e530c2e7f779df079223aee619a73b5d51..2fb7f23275acad54d2f5e2ecd57d5bbb + + @Override + protected void initPathfinder() { -+ if(!simplerVillagerBehavior)return; ++ if (!simplerVillagerBehavior) return; + this.goalSelector.a(0, new PathfinderGoalFloat(this)); -+ if(YatopiaConfig.villagersHideAtNight) { ++ if(dev.tr7zw.yatopia.YatopiaConfig.villagersHideAtNight) { + this.goalSelector.a(0, new PathfinderGoalUseItem<>(this, PotionUtil.a(new ItemStack(Items.POTION), Potions.INVISIBILITY), SoundEffects.ENTITY_WANDERING_TRADER_DISAPPEARED, (entityvillagertrader) -> { + return !this.world.isDay() && !entityvillagertrader.isInvisible(); + })); @@ -95,7 +94,7 @@ index d906c5e530c2e7f779df079223aee619a73b5d51..2fb7f23275acad54d2f5e2ecd57d5bbb @Override public BehaviorController getBehaviorController() { -@@ -82,6 +123,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +@@ -82,6 +122,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @Override protected BehaviorController a(Dynamic dynamic) { @@ -103,7 +102,7 @@ index d906c5e530c2e7f779df079223aee619a73b5d51..2fb7f23275acad54d2f5e2ecd57d5bbb BehaviorController behaviorcontroller = this.cJ().a(dynamic); this.a(behaviorcontroller); -@@ -159,15 +201,47 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +@@ -159,15 +200,47 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation super.inactiveTick(); } // Spigot End @@ -127,16 +126,16 @@ index d906c5e530c2e7f779df079223aee619a73b5d51..2fb7f23275acad54d2f5e2ecd57d5bbb + default: return VillagerProfession.FARMER; + } + } -+ -+// Yatopia end ++ // Yatopia end @Override protected void mobTick() { mobTick(false); } protected void mobTick(boolean inactive) { + // Yatopia start -+ if(simplerVillagerBehavior && this.getVillagerData().getProfession() == VillagerProfession.NONE) ++ if (simplerVillagerBehavior && this.getVillagerData().getProfession() == VillagerProfession.NONE) { + this.setVillagerData(this.getVillagerData().withProfession(getRandomProfession())); -+ if(simplerVillagerBehavior) { ++ } ++ if (simplerVillagerBehavior) { + if (canRefresh()) { + restUses(); + } @@ -151,7 +150,7 @@ index d906c5e530c2e7f779df079223aee619a73b5d51..2fb7f23275acad54d2f5e2ecd57d5bbb if (!inactive) this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error // Paper if (this.bM) { this.bM = false; -@@ -298,6 +372,8 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +@@ -298,6 +371,8 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation return true; } @@ -160,7 +159,7 @@ index d906c5e530c2e7f779df079223aee619a73b5d51..2fb7f23275acad54d2f5e2ecd57d5bbb public void fb() { this.fp(); Iterator iterator = this.getOffers().iterator(); -@@ -332,6 +408,8 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +@@ -332,6 +407,8 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation return this.bK == 0 || this.bK < 2 && this.world.getTime() > this.bJ + 2400L; } @@ -169,19 +168,19 @@ index d906c5e530c2e7f779df079223aee619a73b5d51..2fb7f23275acad54d2f5e2ecd57d5bbb public boolean fc() { long i = this.bJ + 12000L; long j = this.world.getTime(); -@@ -579,6 +657,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +@@ -579,6 +656,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation } private void a(Entity entity) { -+ if(simplerVillagerBehavior)return; // Yatopia ++ if (simplerVillagerBehavior)return; // Yatopia if (this.world instanceof WorldServer) { Optional> optional = this.bn.getMemory(MemoryModuleType.VISIBLE_MOBS); -@@ -604,6 +683,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +@@ -604,6 +682,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation } public void a(MemoryModuleType memorymoduletype) { -+ if(simplerVillagerBehavior)return; // Yatopia ++ if (simplerVillagerBehavior)return; // Yatopia if (this.world instanceof WorldServer) { MinecraftServer minecraftserver = ((WorldServer) this.world).getMinecraftServer(); diff --git a/patches/server/0020-Heavily-optimize-furnance-fuel-and-recipe-lookups.patch b/patches/server/0020-Heavily-optimize-furnance-fuel-and-recipe-lookups.patch index 97e71748..a5e4d579 100644 --- a/patches/server/0020-Heavily-optimize-furnance-fuel-and-recipe-lookups.patch +++ b/patches/server/0020-Heavily-optimize-furnance-fuel-and-recipe-lookups.patch @@ -5,28 +5,26 @@ Subject: [PATCH] Heavily optimize furnance fuel and recipe lookups diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java -index c2af174e639396ac70eb7b520fdd641b1d2c67e6..7de6e116a7e301754c637b68be39c30f610a04d7 100644 +index c2af174e639396ac70eb7b520fdd641b1d2c67e6..da718601eb77330ff3e5eb25924d2820e3f8acaa 100644 --- a/src/main/java/net/minecraft/server/CraftingManager.java +++ b/src/main/java/net/minecraft/server/CraftingManager.java -@@ -83,7 +83,24 @@ public class CraftingManager extends ResourceDataJson { +@@ -83,7 +83,22 @@ public class CraftingManager extends ResourceDataJson { }).findFirst(); c0.setCurrentRecipe(recipe.orElse(null)); // CraftBukkit - Clear recipe when no recipe is found // CraftBukkit end - return recipe; + // Yatopia start -+ if(c0.getCurrentRecipe() != null) { -+ Optional optional = recipes.a(c0.getCurrentRecipe(), world, c0); -+ if(optional.isPresent()) { -+ c0.setCurrentRecipe(optional.get()); ++ if (c0.getCurrentRecipe() != null) { ++ Optional optional = recipes.a(c0.getCurrentRecipe(), world, c0); ++ optional.ifPresent(c0::setCurrentRecipe); + return optional; -+ } -+ } -+ for(IRecipe rep : this.a(recipes)) { -+ Optional optional = recipes.a(rep, world, c0); -+ if(optional.isPresent()) { ++ } ++ for (IRecipe rep : this.a(recipes)) { ++ Optional optional = recipes.a(rep, world, c0); ++ if(optional.isPresent()) { + c0.setCurrentRecipe(optional.get()); -+ return optional; -+ } ++ return optional; ++ } + } + c0.setCurrentRecipe(null); // CraftBukkit - Clear recipe when no recipe is found + return Optional.empty(); @@ -35,24 +33,25 @@ index c2af174e639396ac70eb7b520fdd641b1d2c67e6..7de6e116a7e301754c637b68be39c30f public > List a(Recipes recipes) { diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java -index acc533ca8ad612cc439208f4adf6e3d3289c92c7..eded99b59beb7d6fe759b21fa7d3082057c741d4 100644 +index acc533ca8ad612cc439208f4adf6e3d3289c92c7..7637d86ccafbf323f4edaab758fa9fc3cf657841 100644 --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java +++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java -@@ -99,7 +99,13 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I +@@ -99,7 +99,14 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I this.c = recipes; } -+ //Yatopia -+ private static Map cachedFuelMap = null; ++ private static Map cachedFuelMap = null; // Yatopia + public static Map f() { -+ if(cachedFuelMap != null) { -+ return cachedFuelMap; // Yatopia -+ } ++ // Yatopia start ++ if(cachedFuelMap != null) { ++ return cachedFuelMap; ++ } ++ // Yatopia end Map map = Maps.newLinkedHashMap(); a(map, (IMaterial) Items.LAVA_BUCKET, 20000); -@@ -162,6 +168,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I +@@ -162,6 +169,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I a(map, (IMaterial) Blocks.FLETCHING_TABLE, 300); a(map, (IMaterial) Blocks.SMITHING_TABLE, 300); a(map, (IMaterial) Blocks.COMPOSTER, 300); @@ -60,12 +59,12 @@ index acc533ca8ad612cc439208f4adf6e3d3289c92c7..eded99b59beb7d6fe759b21fa7d30820 return map; } -@@ -615,4 +622,19 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I +@@ -615,4 +623,17 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I } } + -+ // Yatopia start ++ // Yatopia start + private IRecipe cachedRecipe = null; + @Override + public IRecipe getCurrentRecipe() { @@ -73,10 +72,8 @@ index acc533ca8ad612cc439208f4adf6e3d3289c92c7..eded99b59beb7d6fe759b21fa7d30820 + } + @Override + public void setCurrentRecipe(IRecipe recipe) { -+ cachedRecipe = recipe; ++ cachedRecipe = recipe; + } -+ -+ + // Yatopia end + } diff --git a/patches/server/0021-Optimize-Hopper-logic.patch b/patches/server/0021-Optimize-Hopper-logic.patch index 44fd26df..22aaae80 100644 --- a/patches/server/0021-Optimize-Hopper-logic.patch +++ b/patches/server/0021-Optimize-Hopper-logic.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize Hopper logic diff --git a/src/main/java/net/minecraft/server/BlockDropper.java b/src/main/java/net/minecraft/server/BlockDropper.java -index 1ce89c28c2b54278dc8f1c17f2d0ccb743a27b34..1b360140b6161e9cae96752943d574200b5ced4e 100644 +index 1ce89c28c2b54278dc8f1c17f2d0ccb743a27b34..9c0817d03f88af4c267cd91cd750e861febac4b9 100644 --- a/src/main/java/net/minecraft/server/BlockDropper.java +++ b/src/main/java/net/minecraft/server/BlockDropper.java @@ -36,7 +36,7 @@ public class BlockDropper extends BlockDispenser { @@ -13,19 +13,19 @@ index 1ce89c28c2b54278dc8f1c17f2d0ccb743a27b34..1b360140b6161e9cae96752943d57420 if (!itemstack.isEmpty()) { EnumDirection enumdirection = (EnumDirection) world.getType(blockposition).get(BlockDropper.FACING); - IInventory iinventory = TileEntityHopper.b(world, blockposition.shift(enumdirection)); -+ IInventory iinventory = TileEntityHopper.b(world, blockposition.shift(enumdirection), false); ++ IInventory iinventory = TileEntityHopper.b(world, blockposition.shift(enumdirection), false); // Yatopia ItemStack itemstack1; if (iinventory == null) { diff --git a/src/main/java/net/minecraft/server/BlockHopper.java b/src/main/java/net/minecraft/server/BlockHopper.java -index a29294fbc7cd6fcfff0df9eadd11de3bd7f1405e..7918382f26807f945dc7966b81c3c1e2f0fc3c41 100644 +index a29294fbc7cd6fcfff0df9eadd11de3bd7f1405e..77f279fc29955ba6d78271f71df2ac12b7186d60 100644 --- a/src/main/java/net/minecraft/server/BlockHopper.java +++ b/src/main/java/net/minecraft/server/BlockHopper.java @@ -110,6 +110,12 @@ public class BlockHopper extends BlockTileEntity { @Override public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) { this.a(world, blockposition, iblockdata); -+ //Yatopia start ++ // Yatopia start + TileEntity tileEntity = world.getTileEntity(blockposition); + if (tileEntity instanceof TileEntityHopper) { + ((TileEntityHopper)tileEntity).flushCaches(); @@ -35,7 +35,7 @@ index a29294fbc7cd6fcfff0df9eadd11de3bd7f1405e..7918382f26807f945dc7966b81c3c1e2 private void a(World world, BlockPosition blockposition, IBlockData iblockdata) { diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java -index 3ff61141aede4b5a09bf83153222de0d14db5ad0..a5a8528db91c15afcf8c77d5e4727c8e0212bb63 100644 +index 3ff61141aede4b5a09bf83153222de0d14db5ad0..e386ffda975b8a0adc218fd47a02e5b38d12e79d 100644 --- a/src/main/java/net/minecraft/server/TileEntityHopper.java +++ b/src/main/java/net/minecraft/server/TileEntityHopper.java @@ -2,6 +2,7 @@ package net.minecraft.server; @@ -46,54 +46,58 @@ index 3ff61141aede4b5a09bf83153222de0d14db5ad0..a5a8528db91c15afcf8c77d5e4727c8e import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.IntStream; -@@ -661,14 +662,44 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi +@@ -661,14 +662,48 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi @Nullable private IInventory l() { -+ if(this.cachedPush != null) { -+ return this.cachedPush; -+ } ++ // Yatopia start ++ if(this.cachedPush != null) { ++ return this.cachedPush; ++ } ++ // Yatopia end EnumDirection enumdirection = (EnumDirection) this.getBlock().get(BlockHopper.FACING); - return b(this.getWorld(), this.position.shift(enumdirection)); + IInventory tmp = b(this.getWorld(), this.position.shift(enumdirection), this.cachedPushAir); -+ if(tmp != null && !(tmp instanceof IWorldInventory) && !(tmp instanceof Entity)) { -+ this.cachedPush = tmp; -+ }else { -+ if(tmp == null) { -+ this.cachedPushAir = true; -+ } -+ return tmp; ++ // Yatopia start ++ if (tmp != null && !(tmp instanceof IWorldInventory) && !(tmp instanceof Entity)) { ++ this.cachedPush = tmp; ++ } else { ++ if(tmp == null) { ++ this.cachedPushAir = true; ++ } ++ return tmp; + } -+ if(this.cachedPush == null) { -+ this.cachedPushAir = true; ++ if (this.cachedPush == null) { ++ this.cachedPushAir = true; + } ++ // Yatopia end + return this.cachedPush; } @Nullable public static IInventory b(IHopper ihopper) { - return a(ihopper.getWorld(), ihopper.x(), ihopper.z() + 1.0D, ihopper.A()); -+ //Yatopia start -+ if(ihopper instanceof TileEntityHopper) { -+ TileEntityHopper hopper = (TileEntityHopper) ihopper; -+ if(hopper.cachedAbove != null) { -+ return hopper.cachedAbove; -+ } -+ IInventory inv = a(ihopper.getWorld(), ihopper.x(), ihopper.z() + 1.0D, ihopper.A(), hopper.cachedPullAir); -+ hopper.cachedAbove = inv; -+ if(hopper.cachedAbove == null) { -+ hopper.cachedPullAir = true; -+ } ++ // Yatopia start ++ if (ihopper instanceof TileEntityHopper) { ++ TileEntityHopper hopper = (TileEntityHopper) ihopper; ++ if (hopper.cachedAbove != null) { ++ return hopper.cachedAbove; ++ } ++ IInventory inv = a(ihopper.getWorld(), ihopper.x(), ihopper.z() + 1.0D, ihopper.A(), hopper.cachedPullAir); ++ hopper.cachedAbove = inv; ++ if (hopper.cachedAbove == null) { ++ hopper.cachedPullAir = true; ++ } + return inv; -+ } else { -+ return a(ihopper.getWorld(), ihopper.x(), ihopper.z() + 1.0D, ihopper.A(), false); -+ } -+ //Yatopia end ++ } else { ++ return a(ihopper.getWorld(), ihopper.x(), ihopper.z() + 1.0D, ihopper.A(), false); ++ } ++ // Yatopia end } public static List c(IHopper ihopper) { -@@ -683,14 +714,15 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi +@@ -683,14 +718,15 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi } @Nullable @@ -109,41 +113,39 @@ index 3ff61141aede4b5a09bf83153222de0d14db5ad0..a5a8528db91c15afcf8c77d5e4727c8e - Object object = null; + public static IInventory a(World world, double d0, double d1, double d2, boolean skipBlockCheck) { return a(world, d0, d1, d2, false, skipBlockCheck); } // Yatopia // Paper - overload to default false + public static IInventory a(World world, double d0, double d1, double d2, boolean optimizeEntities, boolean skipBlockCheck) { // Yatopia // Paper -+ Object object = null; -+ if(!skipBlockCheck) { // Yatopia ++ Object object = null; // Yatopia ++ if(!skipBlockCheck) { // Yatopia BlockPosition blockposition = new BlockPosition(d0, d1, d2); if ( !world.isLoaded( blockposition ) ) return null; // Spigot IBlockData iblockdata = world.getType(blockposition); -@@ -708,8 +740,9 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi +@@ -708,8 +744,9 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi } } } -+ } ++ } // Yatopia - if (object == null && (!optimizeEntities || !org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(block).isOccluding())) { // Paper + if (object == null && (!optimizeEntities || true/*!org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(block).isOccluding()*/)) { // Yatopia // Paper List list = world.getEntities((Entity) null, new AxisAlignedBB(d0 - 0.5D, d1 - 0.5D, d2 - 0.5D, d0 + 0.5D, d1 + 0.5D, d2 + 0.5D), IEntitySelector.d); if (!list.isEmpty()) { -@@ -779,4 +812,21 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi +@@ -779,4 +816,19 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi protected Container createContainer(int i, PlayerInventory playerinventory) { return new ContainerHopper(i, playerinventory, this); } + + // Yatopia start -+ + private IInventory cachedAbove = null; + private IInventory cachedPush = null; + private boolean cachedPushAir = false; + private boolean cachedPullAir = false; + + public void flushCaches() { -+ cachedAbove = null; -+ cachedPush = null; -+ cachedPushAir = false; -+ cachedPullAir = false; ++ cachedAbove = null; ++ cachedPush = null; ++ cachedPushAir = false; ++ cachedPullAir = false; + } -+ + // Yatopia end + } diff --git a/patches/server/0022-Optimize-TileEntity-loading.patch b/patches/server/0022-Optimize-TileEntity-loading.patch index 896826f1..76a545a8 100644 --- a/patches/server/0022-Optimize-TileEntity-loading.patch +++ b/patches/server/0022-Optimize-TileEntity-loading.patch @@ -4,21 +4,8 @@ Date: Wed, 5 Aug 2020 08:08:44 -0500 Subject: [PATCH] Optimize TileEntity loading -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 -index c2c19a6fbfa2a4aba21aa71789071c69a6246556..8ee0c5982c3ec957ba043c0d7819ecbe586ac3f5 100644 ---- 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 -@@ -163,6 +163,6 @@ public class HashedList implements List { - } - - public static HashedList wrapper(List list) { -- return new HashedList<>(list, new ObjectArraySet<>(list)); -+ return new HashedList<>(list, new java.util.HashSet<>(list)); // Yatopia - } - } -\ No newline at end of file diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 197726bdfcb887a1daac1352726f33ef08fa32b1..cc40e3ef589cd636225941ac755b5849520f7b70 100644 +index 29ffa302fa5b3d7d0ece23e2e0eda79d46747c3b..8beda792cc67e5c789574076f5a06214614a6031 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -43,8 +43,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { diff --git a/patches/server/0023-Global-Eula-file.patch b/patches/server/0023-Global-Eula-file.patch index 9717f1c2..f9a740e2 100644 --- a/patches/server/0023-Global-Eula-file.patch +++ b/patches/server/0023-Global-Eula-file.patch @@ -5,43 +5,29 @@ Subject: [PATCH] Global Eula file diff --git a/src/main/java/net/minecraft/server/EULA.java b/src/main/java/net/minecraft/server/EULA.java -index 229c3b0f0c650b501f31147adaa17194af57fedd..e70da06948abf2aa2223a037aeb5f58fb0a466e3 100644 +index 229c3b0f0c650b501f31147adaa17194af57fedd..345f8b811946fd11695dd718d060c5a86cd64703 100644 --- a/src/main/java/net/minecraft/server/EULA.java +++ b/src/main/java/net/minecraft/server/EULA.java -@@ -1,9 +1,11 @@ - package net.minecraft.server; - -+import java.io.File; - import java.io.InputStream; - import java.io.OutputStream; - import java.nio.file.Files; - import java.util.Properties; -+ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - -@@ -15,12 +17,27 @@ public class EULA { +@@ -15,12 +15,25 @@ public class EULA { public EULA(java.nio.file.Path java_nio_file_path) { this.b = java_nio_file_path; - this.c = SharedConstants.d || this.b(); + this.c = SharedConstants.d || globalEula() || this.b(this.b); // Yatopia -+ } -+ -+ // Yatopia start -+ -+ private boolean globalEula() { -+ File globalEula = new File(System.getProperty("user.home"), "eula.txt"); -+ -+ if(globalEula.exists()) { -+ return b(globalEula.toPath()); -+ } else { -+ System.out.println("No global eula found at " + globalEula.getAbsolutePath()); -+ } -+ return false; } - private boolean b() { ++ // Yatopia start ++ private boolean globalEula() { ++ java.io.File globalEula = new java.io.File(System.getProperty("user.home"), "eula.txt"); ++ ++ if (globalEula.exists()) { ++ return b(globalEula.toPath()); ++ } else { ++ System.out.println("No global eula found at " + globalEula.getAbsolutePath()); ++ } ++ return false; ++ } + // Yatopia end + + private boolean b(java.nio.file.Path path) { // Yatopia diff --git a/patches/server/0024-Redirect-Configs.patch b/patches/server/0024-Redirect-Configs.patch index 252e0c39..ac86ad42 100644 --- a/patches/server/0024-Redirect-Configs.patch +++ b/patches/server/0024-Redirect-Configs.patch @@ -46,7 +46,7 @@ index 22d920686418e86aec8be37f125123682af023a3..081a5344b86e300ae7aa722b9b0ca84c private void set(String path, Object val) { diff --git a/src/main/java/de/minebench/origami/OrigamiConfig.java b/src/main/java/de/minebench/origami/OrigamiConfig.java -index bdeb72c04831209466742b9fb6747ebefbe7ca48..0f9f9554b00e7bda2e1ec34bcca325d4fcf983b9 100644 +index a89209347418b3006745c50043d0abdf2b91babc..e0bd3efb0a856774600b8b5487ec7e2b5b81f41d 100644 --- a/src/main/java/de/minebench/origami/OrigamiConfig.java +++ b/src/main/java/de/minebench/origami/OrigamiConfig.java @@ -20,6 +20,8 @@ public final class OrigamiConfig { @@ -79,19 +79,6 @@ index bdeb72c04831209466742b9fb6747ebefbe7ca48..0f9f9554b00e7bda2e1ec34bcca325d4 for (final Method method : clazz.getDeclaredMethods()) { if (method.getReturnType() != void.class || method.getParameterCount() != 0 || -diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java -index 02ef2cbc0599461a1c693ef71d2310bb3e6d1fc0..16de5a03d7c182766052e118c2912c013e06c54c 100644 ---- a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java -+++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java -@@ -24,7 +24,7 @@ import org.bukkit.configuration.file.YamlConfiguration; - - public class YatopiaConfig { - -- private static File CONFIG_FILE; -+ public static File CONFIG_FILE; - private static final String HEADER = "This is the main configuration file for Yatopia.\n" - + "Yatopia contains many breaking changes and settings, so know what you are doing!\n" - + "You have been warned!\n"; diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java index c3becefce8143f34ed2b1093dd22227b7309629c..b045cfc0e8ade9632cfde5cffe8fe93b5ee08b27 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java @@ -106,15 +93,15 @@ index c3becefce8143f34ed2b1093dd22227b7309629c..b045cfc0e8ade9632cfde5cffe8fe93b this.setPVP(dedicatedserverproperties.pvp); this.setAllowFlight(dedicatedserverproperties.allowFlight); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index c4495f89898861c385b32e70d3b6a3f12b91bdd3..4fce6ed06fccc65ab022cff3623f06f40b49372b 100644 +index 60b4c2337e6fdeddfb785e90fa501149af45756c..f27214eba0aedfceb770a39e444c46f9df19dcf6 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -320,7 +320,7 @@ public class Main { +@@ -319,7 +319,7 @@ public class Main { } // Paper end System.setProperty( "library.jansi.version", "Paper" ); // Paper - set meaningless jansi version to prevent git builds from crashing on Windows - de.minebench.origami.OrigamiConfig.init((java.io.File) options.valueOf("origami-settings")); // Origami - Server Config -+ //de.minebench.origami.OrigamiConfig.init((java.io.File) options.valueOf("origami-settings")); // Origami - Server Config ++ //de.minebench.origami.OrigamiConfig.init((java.io.File) options.valueOf("origami-settings")); // Origami - Server Config // Yatopia - no load here for u System.out.println("Loading libraries, please wait..."); net.minecraft.server.Main.main(options); } catch (Throwable t) { diff --git a/patches/server/0025-Akarin-Updated-Save-json-list-async.patch b/patches/server/0025-Akarin-Updated-Save-json-list-async.patch index ea446bdf..6c6f29ae 100644 --- a/patches/server/0025-Akarin-Updated-Save-json-list-async.patch +++ b/patches/server/0025-Akarin-Updated-Save-json-list-async.patch @@ -5,19 +5,10 @@ Subject: [PATCH] Akarin Updated Save json list async diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java -index 9213bfb78e92b838189161045e3945588251b486..6d7452d05c648cdee50b2077aec6f100449b8229 100644 +index 9213bfb78e92b838189161045e3945588251b486..3fb72d6ee587d66a9b7e1dec27fc4f64b82ab4df 100644 --- a/src/main/java/net/minecraft/server/JsonList.java +++ b/src/main/java/net/minecraft/server/JsonList.java -@@ -20,6 +20,8 @@ import java.util.Iterator; - import java.util.List; - import java.util.Map; - import javax.annotation.Nullable; -+ -+import org.apache.commons.io.IOUtils; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - -@@ -146,6 +148,7 @@ public abstract class JsonList> { +@@ -146,6 +146,7 @@ public abstract class JsonList> { } public void save() throws IOException { @@ -25,7 +16,7 @@ index 9213bfb78e92b838189161045e3945588251b486..6d7452d05c648cdee50b2077aec6f100 this.removeStaleEntries(); // Paper - remove expired values before saving JsonArray jsonarray = new JsonArray(); -@@ -155,29 +158,20 @@ public abstract class JsonList> { +@@ -155,29 +156,20 @@ public abstract class JsonList> { jsonlistentry.getClass(); return (JsonObject) SystemUtils.a(jsonobject, jsonlistentry::a); // CraftBukkit - decompile error }).forEach(jsonarray::add); @@ -53,7 +44,7 @@ index 9213bfb78e92b838189161045e3945588251b486..6d7452d05c648cdee50b2077aec6f100 - } - } - -+ IOUtils.closeQuietly(bufferedwriter); ++ org.apache.commons.io.IOUtils.closeQuietly(bufferedwriter); } + }; // Akarin - Save json list async diff --git a/patches/server/0026-lithium-MixinChunkGeneratorAbstract.patch b/patches/server/0026-lithium-MixinChunkGeneratorAbstract.patch index 2b25d4e5..36c5d219 100644 --- a/patches/server/0026-lithium-MixinChunkGeneratorAbstract.patch +++ b/patches/server/0026-lithium-MixinChunkGeneratorAbstract.patch @@ -149,19 +149,10 @@ index 0000000000000000000000000000000000000000..167498cfab7aed0deb32232082ae06a1 +} \ No newline at end of file diff --git a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -index 45b771e4121f2ef27c67d5a5ba2dadcfc0f944e0..448745b9e499b86f3ce6938c0f0fb0fbb222a781 100644 +index 45b771e4121f2ef27c67d5a5ba2dadcfc0f944e0..b15ed711d8236e9835ffa013f8252aec03e9bb57 100644 --- a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java +++ b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -@@ -5,6 +5,8 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; - import it.unimi.dsi.fastutil.objects.ObjectArrayList; - import it.unimi.dsi.fastutil.objects.ObjectList; - import it.unimi.dsi.fastutil.objects.ObjectListIterator; -+import me.jellysquid.mods.lithium.common.world.noise.SimplexNoiseCache; -+ - import java.util.Iterator; - import java.util.List; - import java.util.Random; -@@ -56,12 +58,13 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { +@@ -56,12 +56,13 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { private final NoiseGenerator t; private final NoiseGeneratorOctaves u; @Nullable @@ -172,20 +163,20 @@ index 45b771e4121f2ef27c67d5a5ba2dadcfc0f944e0..448745b9e499b86f3ce6938c0f0fb0fb private final long w; protected final GeneratorSettingBase h; private final int x; -+ private ThreadLocal tlCache; // Yatopia: lithium ++ private ThreadLocal tlCache; // Yatopia: lithium public ChunkGeneratorAbstract(WorldChunkManager worldchunkmanager, long i, GeneratorSettingBase generatorsettingbase) { this(worldchunkmanager, worldchunkmanager, i, generatorsettingbase); -@@ -96,7 +99,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { +@@ -96,7 +97,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { } else { this.v = null; } - -+ this.tlCache = ThreadLocal.withInitial(() -> new SimplexNoiseCache(v)); // Yapfa: lithium ++ this.tlCache = ThreadLocal.withInitial(() -> new me.jellysquid.mods.lithium.common.world.noise.SimplexNoiseCache(v)); // Yatopia: lithium } @Override -@@ -161,7 +164,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { +@@ -161,7 +162,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { double d3; if (this.v != null) { diff --git a/patches/server/0027-lithium-MixinDataWatcher.patch b/patches/server/0027-lithium-MixinDataWatcher.patch index 4be4aa67..9d52dc7d 100644 --- a/patches/server/0027-lithium-MixinDataWatcher.patch +++ b/patches/server/0027-lithium-MixinDataWatcher.patch @@ -9,18 +9,10 @@ you can find the original code on https://github.com/jellysquid3/lithium-fabric/ Co-authored-by: tr7zw diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java -index be8e705fc3f2c31e4f84f59c977488d8ecd9cae1..d8147567b4dfdc48b86f6349fca084fdb4381c42 100644 +index be8e705fc3f2c31e4f84f59c977488d8ecd9cae1..23fdd7c7d0368cc88e467a890cea8aa9b495fa11 100644 --- a/src/main/java/net/minecraft/server/DataWatcher.java +++ b/src/main/java/net/minecraft/server/DataWatcher.java -@@ -6,6 +6,7 @@ import io.netty.handler.codec.DecoderException; - import io.netty.handler.codec.EncoderException; - import java.io.IOException; - import java.util.ArrayList; -+import java.util.Arrays; - import java.util.Iterator; - import java.util.List; - import java.util.Map; -@@ -26,6 +27,77 @@ public class DataWatcher { +@@ -26,6 +26,77 @@ public class DataWatcher { private boolean f = true; private boolean g; @@ -46,7 +38,7 @@ index be8e705fc3f2c31e4f84f59c977488d8ecd9cae1..d8147567b4dfdc48b86f6349fca084fd + // than 256 entries as per the vanilla limit + int newSize = Math.min(k + GROW_FACTOR, 256); + -+ this.entriesArray = storage = Arrays.copyOf(storage, newSize); ++ this.entriesArray = storage = java.util.Arrays.copyOf(storage, newSize); + } + + // Update the storage @@ -98,7 +90,7 @@ index be8e705fc3f2c31e4f84f59c977488d8ecd9cae1..d8147567b4dfdc48b86f6349fca084fd public DataWatcher(Entity entity) { this.entity = entity; } -@@ -90,7 +162,8 @@ public class DataWatcher { +@@ -90,7 +161,8 @@ public class DataWatcher { DataWatcher.Item datawatcher_item = new DataWatcher.Item<>(datawatcherobject, t0); // this.lock.writeLock().lock(); // Spigot - not required @@ -108,12 +100,12 @@ index be8e705fc3f2c31e4f84f59c977488d8ecd9cae1..d8147567b4dfdc48b86f6349fca084fd this.f = false; // this.lock.writeLock().unlock(); // Spigot - not required } -@@ -121,7 +194,8 @@ public class DataWatcher { +@@ -121,7 +193,8 @@ public class DataWatcher { } public T get(DataWatcherObject datawatcherobject) { - return this.b(datawatcherobject).b(); -+ return getEntry(datawatcherobject).b(); // Yatopia ++ return getEntry(datawatcherobject).b(); // Yatopia + //return this.b(datawatcherobject).b(); } diff --git a/patches/server/0028-Fix-lead-fall-dmg-config.patch b/patches/server/0028-Fix-lead-fall-dmg-config.patch index c23d62f8..bde87ac9 100644 --- a/patches/server/0028-Fix-lead-fall-dmg-config.patch +++ b/patches/server/0028-Fix-lead-fall-dmg-config.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix lead fall dmg config diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java -index 16de5a03d7c182766052e118c2912c013e06c54c..c4ab51e3eb22917159e0803f54c1654975c98485 100644 +index d8e3bbb2ffbf20a111af3fd7a019daf1d5a7dead..325d1fe8f91bdfa82a53a5f1f86804d04f973090 100644 --- a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java +++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java @@ -225,4 +225,10 @@ public class YatopiaConfig { @@ -15,30 +15,21 @@ index 16de5a03d7c182766052e118c2912c013e06c54c..c4ab51e3eb22917159e0803f54c16549 + + public static boolean fixFallDistance = false; + private static void fixFallDistance() { -+ fixFallDistance = getBoolean("settings.fixFallDistance", false); ++ fixFallDistance = getBoolean("settings.fixFallDistance", false); + } + } \ No newline at end of file diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index ec84bc4dceff76fd2f823a6a9548fdf180291584..de745c8678f5dca0a939afcd45f2cab5fae3c4f1 100644 +index fe0689f6be466d1a2a1ed2b76331272199a0aa0c..eef7128a81b58089a2ea2495264a7e94104668a8 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2,6 +2,8 @@ package net.minecraft.server; - - import co.aikar.timings.MinecraftTimings; - import co.aikar.timings.Timing; -+import dev.tr7zw.yatopia.YatopiaConfig; -+ - import com.google.common.collect.Iterables; - import com.google.common.collect.Lists; - import com.google.common.collect.Sets; -@@ -1266,6 +1268,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1266,6 +1266,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke this.fallDistance = 0.0F; } else if (d0 < 0.0D) { this.fallDistance = (float) ((double) this.fallDistance - d0); -+ }else if (d0 > 0.0D && YatopiaConfig.fixFallDistance) { // Yatopia -+ this.fallDistance = 0.0F; ++ } else if (d0 > 0.0D && dev.tr7zw.yatopia.YatopiaConfig.fixFallDistance) { // Yatopia ++ this.fallDistance = 0.0F; // Yatopia } } diff --git a/patches/server/0029-Akarin-updated-Async-Path-Finding.patch b/patches/server/0029-Akarin-updated-Async-Path-Finding.patch index 11a505d1..1b64096b 100644 --- a/patches/server/0029-Akarin-updated-Async-Path-Finding.patch +++ b/patches/server/0029-Akarin-updated-Async-Path-Finding.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Akarin updated Async Path Finding Co-authored-by: Bud Gidiere diff --git a/src/main/java/net/minecraft/server/EntityBee.java b/src/main/java/net/minecraft/server/EntityBee.java -index e6868e2b65e3c2bde7696272b242a47e7394e27f..c4c3ef500b9b8465644a0b7712f43ba35ad3acc1 100644 +index e6868e2b65e3c2bde7696272b242a47e7394e27f..dcd99ae6cb244c819c68dfafa681adf63a34622a 100644 --- a/src/main/java/net/minecraft/server/EntityBee.java +++ b/src/main/java/net/minecraft/server/EntityBee.java @@ -445,9 +445,9 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB @@ -14,10 +14,10 @@ index e6868e2b65e3c2bde7696272b242a47e7394e27f..c4c3ef500b9b8465644a0b7712f43ba3 @Override - public void c() { -+ public void tickAsync() { ++ public void tickAsync() { // Akarin - async pathfinding if (!EntityBee.this.bJ.k()) { - super.c(); -+ super.tickAsync(); ++ super.tickAsync(); // Akarin - async pathfinding } } }; @@ -48,7 +48,7 @@ index 681465d8a74831461dce4615d2d19c7ed46bc299..f04411a2a295d2a982dca5851ae76a80 if (!this.a(pathtype)) { return false; diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index 2405dc5e9a6a971a565c37710b61d5fc4737bdf8..2dac507e9e0044a32ae54ea57eada0de04c1467d 100644 +index 2405dc5e9a6a971a565c37710b61d5fc4737bdf8..78d1d96aeaf8c8b79f5f5bdf74178816c8bc8973 100644 --- a/src/main/java/net/minecraft/server/NavigationAbstract.java +++ b/src/main/java/net/minecraft/server/NavigationAbstract.java @@ -28,6 +28,15 @@ public abstract class NavigationAbstract { @@ -132,36 +132,25 @@ index 2405dc5e9a6a971a565c37710b61d5fc4737bdf8..2dac507e9e0044a32ae54ea57eada0de } - public void c() { -+/* public void c() { ++/* public void c() { // Yatopia ++this.e; if (this.m) { this.j(); -@@ -238,7 +290,7 @@ public abstract class NavigationAbstract { - Vec3D vec3d; - - if (this.a()) { -- this.l(); -+ //this.l(); - } else if (this.c != null && this.c.f() < this.c.e()) { - vec3d = this.b(); - Vec3D vec3d1 = this.c.a(this.a, this.c.f()); -@@ -256,9 +308,44 @@ public abstract class NavigationAbstract { +@@ -256,9 +308,43 @@ public abstract class NavigationAbstract { this.a.getControllerMove().a(vec3d.x, this.b.getType(blockposition.down()).isAir() ? vec3d.y : PathfinderNormal.a((IBlockAccess) this.b, blockposition), vec3d.z, this.d); } } -+ }*/ -+ //Yatopia Start ++ }*/ // Yatopia ++ // Yatopia start + public void c() { + this.tickAsync(); -+ } -+ //Yatopia End + } ++ // Yatopia end + // Akarin start - Async pathfinder, copied from above + public void tickAsync() { + ++this.e; + this.doPathfindAsync(); - } - -- protected void l() { ++ } + // This was copied from above partly with param + public void doTickAsync(PathEntity pathEntity) { + if (shouldContinuePathfind(pathEntity)) @@ -178,7 +167,8 @@ index 2405dc5e9a6a971a565c37710b61d5fc4737bdf8..2dac507e9e0044a32ae54ea57eada0de + pathEntity.c(pathEntity.f() + 1); + } + } -+ + +- protected void l() { + if (shouldContinuePathfind(pathEntity)) + return; + //PacketDebug.a(this.b, this.a, pathEntity, this.l); @@ -191,12 +181,12 @@ index 2405dc5e9a6a971a565c37710b61d5fc4737bdf8..2dac507e9e0044a32ae54ea57eada0de Vec3D vec3d = this.b(); this.l = this.a.getWidth() > 0.75F ? this.a.getWidth() / 2.0F : 0.75F - this.a.getWidth() / 2.0F; -@@ -273,8 +360,26 @@ public abstract class NavigationAbstract { +@@ -273,8 +359,26 @@ public abstract class NavigationAbstract { } this.a(vec3d); - } -+ }*/ ++ }*/ // Akarin end + + // Akarin start - Async pathfinder, copied from above with param + protected void applyPath(PathEntity pathEntity) { @@ -208,18 +198,18 @@ index 2405dc5e9a6a971a565c37710b61d5fc4737bdf8..2dac507e9e0044a32ae54ea57eada0de + double d1 = Math.abs(this.a.locY() - (double) baseblockposition.getY()); + double d2 = Math.abs(this.a.locZ() - ((double) baseblockposition.getZ() + 0.5D)); + boolean flag = d0 < (double) this.l && d2 < (double) this.l && d1 < 1.0D; - ++ + if (flag || this.a.b(pathEntity.h().l) && this.b(vec3d)) { + pathEntity.c(pathEntity.f() + 1); + } -+ + + this.applyPath0(pathEntity, vec3d); + } + // Akarin end private boolean b(Vec3D vec3d) { if (this.c.e() <= this.c.f() + 1) { return false; -@@ -324,7 +429,39 @@ public abstract class NavigationAbstract { +@@ -324,7 +428,39 @@ public abstract class NavigationAbstract { } } @@ -245,7 +235,7 @@ index 2405dc5e9a6a971a565c37710b61d5fc4737bdf8..2dac507e9e0044a32ae54ea57eada0de + + this.k = this.a.dM() > 0.0F ? d0 / (double) this.a.dM() * 1000.0D : 0.0D; + } -+ + + if (this.k > 0.0D && (double) this.i > this.k * 3.0D) { + this.e(); + this.o(); @@ -253,13 +243,13 @@ index 2405dc5e9a6a971a565c37710b61d5fc4737bdf8..2dac507e9e0044a32ae54ea57eada0de + + this.j = SystemUtils.getMonotonicMillis(); + } - ++ + } + // Akarin end private void e() { this.h = BaseBlockPosition.ZERO; this.i = 0L; -@@ -389,7 +526,11 @@ public abstract class NavigationAbstract { +@@ -389,7 +525,11 @@ public abstract class NavigationAbstract { public boolean r() { return this.o.e(); } @@ -273,7 +263,7 @@ index 2405dc5e9a6a971a565c37710b61d5fc4737bdf8..2dac507e9e0044a32ae54ea57eada0de if (this.c != null && !this.c.b() && this.c.e() != 0) { // Tuinity - diff on change - needed for isViableForPathRecalculationChecking() PathPoint pathpoint = this.c.c(); diff --git a/src/main/java/net/minecraft/server/NavigationFlying.java b/src/main/java/net/minecraft/server/NavigationFlying.java -index 0c33a0c9d59d79a39826b5ee14144604717ffebe..cf3f4c1a2a89cce0345566a62faa34ef7e93c603 100644 +index 0c33a0c9d59d79a39826b5ee14144604717ffebe..14b77c7f8ee54bb2189fbb17814dce9aaa7db3eb 100644 --- a/src/main/java/net/minecraft/server/NavigationFlying.java +++ b/src/main/java/net/minecraft/server/NavigationFlying.java @@ -28,7 +28,7 @@ public class NavigationFlying extends NavigationAbstract { @@ -281,7 +271,7 @@ index 0c33a0c9d59d79a39826b5ee14144604717ffebe..cf3f4c1a2a89cce0345566a62faa34ef } - @Override -+/* @Override ++/* @Override // Yatopia public void c() { ++this.e; if (this.m) { @@ -289,7 +279,7 @@ index 0c33a0c9d59d79a39826b5ee14144604717ffebe..cf3f4c1a2a89cce0345566a62faa34ef this.a.getControllerMove().a(vec3d.x, vec3d.y, vec3d.z, this.d); } } -+ }*/ ++ }*/ // Yatopia + + // This was copied from above partly with param + @Override diff --git a/patches/server/0030-Incremental-player-saving.patch b/patches/server/0030-Incremental-player-saving.patch index 57b3e12f..1c000175 100644 --- a/patches/server/0030-Incremental-player-saving.patch +++ b/patches/server/0030-Incremental-player-saving.patch @@ -7,11 +7,11 @@ Ported to Yatopia and 1.16.1 by MrIvanPlays Co-authored-by: MrIvanPlays diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java -index c4ab51e3eb22917159e0803f54c1654975c98485..d20ed58b781462ea667f75a2ac99b78cb23e283c 100644 +index 325d1fe8f91bdfa82a53a5f1f86804d04f973090..01a44ad139699a1f6b745853c36d79c39f7d75eb 100644 --- a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java +++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java @@ -231,4 +231,15 @@ public class YatopiaConfig { - fixFallDistance = getBoolean("settings.fixFallDistance", false); + fixFallDistance = getBoolean("settings.fixFallDistance", false); } + public static int maxPlayerAutoSavePerTick = 10; @@ -62,10 +62,10 @@ index 26ee6e9219059c9f7175148e934d2adec2b336a0..f3e67e96bea9059aad60c896d7f376f7 // Paper start for (WorldServer world : getWorlds()) { diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index c10a1d15bcfe0cb1c2ff6ee7f2881bc2040bcd1d..1dfd274e3af26792d5da88c59c0ebc71d8b9feb4 100644 +index 0b6c62ff0ac75c7ec11de9f8e9745b07ee12664e..60fa4b84c3701fc29d07215d005e5b7b45b5dfbb 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -484,6 +484,7 @@ public abstract class PlayerList { +@@ -483,6 +483,7 @@ public abstract class PlayerList { protected void savePlayerFile(EntityPlayer entityplayer) { if (!entityplayer.getBukkitEntity().isPersistent()) return; // CraftBukkit if (!entityplayer.didPlayerJoinEvent) return; // Paper - If we never fired PJE, we disconnected during login. Data has not changed, and additionally, our saved vehicle is not loaded! If we save now, we will lose our vehicle (CraftBukkit bug) @@ -73,7 +73,7 @@ index c10a1d15bcfe0cb1c2ff6ee7f2881bc2040bcd1d..1dfd274e3af26792d5da88c59c0ebc71 this.playerFileData.save(entityplayer); ServerStatisticManager serverstatisticmanager = (ServerStatisticManager) entityplayer.getStatisticManager(); // CraftBukkit -@@ -1130,10 +1131,21 @@ public abstract class PlayerList { +@@ -1129,10 +1130,21 @@ public abstract class PlayerList { } public void savePlayers() { diff --git a/patches/server/0034-Intellij-Optimize-Imports.patch b/patches/server/0034-Intellij-Optimize-Imports.patch index 97ce6e1b..90920e6d 100644 --- a/patches/server/0034-Intellij-Optimize-Imports.patch +++ b/patches/server/0034-Intellij-Optimize-Imports.patch @@ -587,22 +587,10 @@ index 26ddf92f86fccc2b2562f7abf4788d1ed6b73205..dfec5882598f09492e9a17de25774a4c private static final GameProfile[] EMPTY_PROFILES = new GameProfile[0]; diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java -index 0c5f2a010f30eb32bea273d7e65b0741016480e5..1152644a390decd48395f6b2e60887aafaf66ac4 100644 +index 2a67013f6d2656a3d89cb042ba401bcaeb731d83..9e2f0107b27f37ce13616c32f4b5691aae221fc8 100644 --- a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java +++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java -@@ -5,24 +5,17 @@ import com.google.common.base.Charsets; - import com.mojang.authlib.GameProfile; - import com.mojang.authlib.properties.Property; - import com.mojang.authlib.properties.PropertyMap; -- - import dev.tr7zw.yatopia.events.GameProfileLookupEvent; - import net.minecraft.server.MinecraftServer; - import net.minecraft.server.UserCache; - import org.apache.commons.lang3.Validate; -- - import org.bukkit.Bukkit; - import org.bukkit.craftbukkit.entity.CraftPlayer; - import org.spigotmc.SpigotConfig; +@@ -13,12 +13,7 @@ import org.spigotmc.SpigotConfig; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -1050,7 +1038,7 @@ index 76593df295e5f462adcbc223d791316a849fffeb..2fb99e8626b962184854c2850d0507f7 import java.util.List; diff --git a/src/main/java/de/minebench/origami/OrigamiConfig.java b/src/main/java/de/minebench/origami/OrigamiConfig.java -index 0f9f9554b00e7bda2e1ec34bcca325d4fcf983b9..43bc9c06da57866a7c9c38e3287d40e1b7d69a9a 100644 +index e0bd3efb0a856774600b8b5487ec7e2b5b81f41d..5918b1b66a42d97c4b44304eec22f252519bb4d1 100644 --- a/src/main/java/de/minebench/origami/OrigamiConfig.java +++ b/src/main/java/de/minebench/origami/OrigamiConfig.java @@ -1,12 +1,10 @@ @@ -1087,46 +1075,8 @@ index e6617833a7aea4803b78bc55b633fac9698688bd..43def748a996fea8caf56ee58a3585da import java.util.function.Predicate; -diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaCommand.java b/src/main/java/dev/tr7zw/yatopia/YatopiaCommand.java -index eca581513324401e1c6b3e818ba9ea6e9925490f..d9b6faea9adbe246eaede7c0db77a4eba05b82af 100644 ---- a/src/main/java/dev/tr7zw/yatopia/YatopiaCommand.java -+++ b/src/main/java/dev/tr7zw/yatopia/YatopiaCommand.java -@@ -1,26 +1,18 @@ - package dev.tr7zw.yatopia; - --import java.io.File; --import java.util.ArrayList; --import java.util.Arrays; --import java.util.Collection; --import java.util.Collections; --import java.util.Iterator; --import java.util.List; --import java.util.Locale; -- -+import com.google.common.base.Functions; -+import com.google.common.collect.Iterables; -+import com.google.common.collect.Lists; -+import net.minecraft.server.MinecraftKey; -+import net.minecraft.server.MinecraftServer; - import org.bukkit.Bukkit; - import org.bukkit.ChatColor; - import org.bukkit.Location; - import org.bukkit.command.Command; - import org.bukkit.command.CommandSender; - --import com.google.common.base.Functions; --import com.google.common.collect.Iterables; --import com.google.common.collect.Lists; -- --import net.minecraft.server.MinecraftKey; --import net.minecraft.server.MinecraftServer; -+import java.io.File; -+import java.util.*; - - public class YatopiaCommand extends Command { - diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java -index d20ed58b781462ea667f75a2ac99b78cb23e283c..f2acc0a5c24165e2e90f1a53107d2027dade584e 100644 +index 01a44ad139699a1f6b745853c36d79c39f7d75eb..185675b3ef36e9c73f5729d1d7d773e1a4a6f5b9 100644 --- a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java +++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java @@ -1,8 +1,11 @@ @@ -1156,33 +1106,26 @@ index d20ed58b781462ea667f75a2ac99b78cb23e283c..f2acc0a5c24165e2e90f1a53107d2027 public static File CONFIG_FILE; diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaVersionFetcher.java b/src/main/java/dev/tr7zw/yatopia/YatopiaVersionFetcher.java -index 523e3b50d535e91afe8b14fdb53966da030963dc..a2c92daeab053dd3785b8389a101c21fcfb73eef 100644 +index dfa51d6f170ec4fb010dce909c3fccb6c726deb4..b663a5707539e1e411647e466481ec880c511c9f 100644 --- a/src/main/java/dev/tr7zw/yatopia/YatopiaVersionFetcher.java +++ b/src/main/java/dev/tr7zw/yatopia/YatopiaVersionFetcher.java -@@ -1,9 +1,9 @@ +@@ -1,6 +1,7 @@ package dev.tr7zw.yatopia; --import javax.annotation.Nonnull; + import com.destroystokyo.paper.VersionHistoryManager; ++import com.destroystokyo.paper.util.VersionFetcher; + import com.google.common.base.Charsets; + import com.google.gson.Gson; + import com.google.gson.JsonObject; +@@ -11,8 +12,6 @@ import java.io.InputStreamReader; + import java.net.HttpURLConnection; + import java.net.URL; + import javax.annotation.Nonnull; - - import com.destroystokyo.paper.util.VersionFetcher; +-import com.destroystokyo.paper.util.VersionFetcher; + import javax.annotation.Nullable; -+import javax.annotation.Nonnull; -+ public class YatopiaVersionFetcher implements VersionFetcher { - - @Override -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 -index 8ee0c5982c3ec957ba043c0d7819ecbe586ac3f5..94c356e055851f4e8f01e10989e1f4a2242ce4df 100644 ---- 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 -@@ -1,7 +1,5 @@ - package me.jellysquid.mods.lithium.common.util.collections; - --import it.unimi.dsi.fastutil.objects.ObjectArraySet; -- - import java.util.*; - - /** diff --git a/src/main/java/me/jellysquid/mods/lithium/common/world/noise/SimplexNoiseCache.java b/src/main/java/me/jellysquid/mods/lithium/common/world/noise/SimplexNoiseCache.java index 167498cfab7aed0deb32232082ae06a123b7a039..a28486e5ad4a86bd02219f1db696d8049b6955bf 100644 --- a/src/main/java/me/jellysquid/mods/lithium/common/world/noise/SimplexNoiseCache.java @@ -1226,10 +1169,10 @@ index 315a03cf5e64264523ce95ce7b9ffe7c450e1e5b..9f48cfb84cd3fccc408d908db37d27f1 public class Advancement { diff --git a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java -index 5442c28c56f933c63bd611f579d0392876ecc2ef..2a2b7a1d6a2813740cc9aae6bc911cea659543e6 100644 +index 93b14f01fd7094175968918f0dcd7c3c921f156a..d62f6b17e4e3a5b2a49dab4edcd3e8ef3226579a 100644 --- a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java +++ b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java -@@ -15,25 +15,18 @@ import com.google.gson.stream.JsonReader; +@@ -15,23 +15,17 @@ import com.google.gson.stream.JsonReader; import com.mojang.datafixers.DataFixer; import com.mojang.serialization.Dynamic; import com.mojang.serialization.JsonOps; @@ -1250,9 +1193,7 @@ index 5442c28c56f933c63bd611f579d0392876ecc2ef..2a2b7a1d6a2813740cc9aae6bc911cea -import java.util.Map; +import java.util.*; import java.util.Map.Entry; --import java.util.Set; - import java.util.concurrent.ExecutorService; - import java.util.concurrent.Executors; + import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nullable; @@ -1639,27 +1580,17 @@ index cedd2a26cd373c10835df104206defdc50405a62..eba9f9a401a40ac4ad964e8f9fffb973 import java.util.Optional; diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java -index bfaba96eb56dd98a67d2c2179335ae48dcbe3849..d78b5cc7075a37bcf572c2043fa252bb624861a7 100644 +index f7f082c80442cd352e14daa4b199b2f3ad75c22f..c434aafff57af844b04730e53d17819364083885 100644 --- a/src/main/java/net/minecraft/server/BiomeBase.java +++ b/src/main/java/net/minecraft/server/BiomeBase.java -@@ -8,14 +8,12 @@ import com.mojang.serialization.Codec; +@@ -7,7 +7,6 @@ import com.google.common.collect.Sets; + import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import it.unimi.dsi.fastutil.longs.Long2FloatLinkedOpenHashMap; - import me.jellysquid.mods.lithium.common.util.collections.HashedList; -+import org.apache.logging.log4j.LogManager; -+import org.apache.logging.log4j.Logger; - -+import javax.annotation.Nullable; +- import java.util.*; --import java.util.function.Function; --import java.util.stream.Collectors; - import java.util.stream.Stream; --import javax.annotation.Nullable; --import org.apache.logging.log4j.LogManager; --import org.apache.logging.log4j.Logger; - - public class BiomeBase { - + import java.util.function.Function; + import java.util.stream.Collectors; diff --git a/src/main/java/net/minecraft/server/BiomeStorage.java b/src/main/java/net/minecraft/server/BiomeStorage.java index 49114864e3cd7ef48b827220939c5069d3b8ca3a..11b47ebc3a49927f4c704b111254b6b1e67dd1d0 100644 --- a/src/main/java/net/minecraft/server/BiomeStorage.java @@ -2865,24 +2796,6 @@ index ee6726e5c664115417c6397aa153315c8eb835a9..43b80b6667839a2769c14508fcdef71d public abstract class ChunkGenerator { -diff --git a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -index 448745b9e499b86f3ce6938c0f0fb0fbb222a781..e6eb96017bfda10971708f59b0fd009b8905837e 100644 ---- a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -+++ b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -@@ -7,12 +7,12 @@ import it.unimi.dsi.fastutil.objects.ObjectList; - import it.unimi.dsi.fastutil.objects.ObjectListIterator; - import me.jellysquid.mods.lithium.common.world.noise.SimplexNoiseCache; - -+import javax.annotation.Nullable; - import java.util.Iterator; - import java.util.List; - import java.util.Random; - import java.util.function.Predicate; - import java.util.stream.IntStream; --import javax.annotation.Nullable; - - public final class ChunkGeneratorAbstract extends ChunkGenerator { - diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java index 46fc70bd9878ca089c446619f97b997c9bb27eec..eabc303195f6cc560a4c3ad33e07bcd3abb3bce7 100644 --- a/src/main/java/net/minecraft/server/ChunkMapDistance.java @@ -3439,7 +3352,7 @@ index 079304e8b1abb2c37febef536b1dd9f76e5ad47d..c0f2e44c6c54e22f32d5df6cbc9e9263 public class Convertable { diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java -index 7de6e116a7e301754c637b68be39c30f610a04d7..83b8f9a7419db0dd7b9ffb36652290fbdafb3d8d 100644 +index da718601eb77330ff3e5eb25924d2820e3f8acaa..75afa85ce53ae0bfcdfa1a0b51f939c8c0dfed2c 100644 --- a/src/main/java/net/minecraft/server/CraftingManager.java +++ b/src/main/java/net/minecraft/server/CraftingManager.java @@ -1,23 +1,16 @@ @@ -3671,33 +3584,18 @@ index 52948a84b89554646c9ec1fd13d6d3c9e7cbf996..eada694a8e57284bdda477ccca2c2502 public class DataPaletteBlock implements DataPaletteExpandable { diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java -index d8147567b4dfdc48b86f6349fca084fdb4381c42..d3105bf3dd35ad26d3df64c03174cedcdfaca178 100644 +index 23fdd7c7d0368cc88e467a890cea8aa9b495fa11..e038b406de0de50b1df55349c125c18f691ca61a 100644 --- a/src/main/java/net/minecraft/server/DataWatcher.java +++ b/src/main/java/net/minecraft/server/DataWatcher.java -@@ -4,19 +4,14 @@ import com.google.common.collect.Lists; - import com.google.common.collect.Maps; - import io.netty.handler.codec.DecoderException; - import io.netty.handler.codec.EncoderException; --import java.io.IOException; --import java.util.ArrayList; --import java.util.Arrays; --import java.util.Iterator; --import java.util.List; --import java.util.Map; +@@ -9,8 +9,6 @@ import java.util.ArrayList; + import java.util.Iterator; + import java.util.List; + import java.util.Map; -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; --import javax.annotation.Nullable; + import javax.annotation.Nullable; import org.apache.commons.lang3.ObjectUtils; import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - -+import javax.annotation.Nullable; -+import java.io.IOException; -+import java.util.*; -+ - public class DataWatcher { - - private static final Logger LOGGER = LogManager.getLogger(); diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java index b045cfc0e8ade9632cfde5cffe8fe93b5ee08b27..8974915ea2e0d2e831d2fb25a5402c439320965d 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java @@ -3902,27 +3800,23 @@ index ac546ff959510a2d0120c24c90bf13ff83873161..892be05e196ffed7c8bd59fff0cba89a private static final Logger LOGGER = LogManager.getLogger(); diff --git a/src/main/java/net/minecraft/server/EULA.java b/src/main/java/net/minecraft/server/EULA.java -index e70da06948abf2aa2223a037aeb5f58fb0a466e3..30921ef96de4e98316634e2a55307b13b0c28f65 100644 +index 345f8b811946fd11695dd718d060c5a86cd64703..391ed2bbb7fd02294ddb20c2c01a6886883ffdad 100644 --- a/src/main/java/net/minecraft/server/EULA.java +++ b/src/main/java/net/minecraft/server/EULA.java -@@ -1,14 +1,14 @@ +@@ -1,11 +1,11 @@ package net.minecraft.server; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; -+ - import java.io.File; import java.io.InputStream; import java.io.OutputStream; import java.nio.file.Files; import java.util.Properties; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -- + public class EULA { - private static final Logger LOGGER = LogManager.getLogger(); diff --git a/src/main/java/net/minecraft/server/EnchantmentFrostWalker.java b/src/main/java/net/minecraft/server/EnchantmentFrostWalker.java index 176be2e4d0d23d3e7967b6e0e99d060a96b3d976..4d769a513216c56ae93944cd99d091fa3ad97e51 100644 --- a/src/main/java/net/minecraft/server/EnchantmentFrostWalker.java @@ -3996,15 +3890,10 @@ index e2c1de7ab246f1b4c8add06c513afc2eca97d796..589f00d27255aa1b227fea7c19a27862 private static final Logger LOGGER = LogManager.getLogger(); diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index de745c8678f5dca0a939afcd45f2cab5fae3c4f1..1779f7756a7093b558bcfc7ce96559558b911a92 100644 +index eef7128a81b58089a2ea2495264a7e94104668a8..9008edf5ac28ead63f6df91f00a7a457fc72f1d0 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2,11 +2,10 @@ package net.minecraft.server; - - import co.aikar.timings.MinecraftTimings; - import co.aikar.timings.Timing; --import dev.tr7zw.yatopia.YatopiaConfig; -- +@@ -5,6 +5,7 @@ import co.aikar.timings.Timing; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.collect.Sets; @@ -4012,7 +3901,7 @@ index de745c8678f5dca0a939afcd45f2cab5fae3c4f1..1779f7756a7093b558bcfc7ce9655955 import it.unimi.dsi.fastutil.objects.Object2DoubleArrayMap; import it.unimi.dsi.fastutil.objects.Object2DoubleMap; import org.apache.logging.log4j.LogManager; -@@ -23,12 +22,7 @@ import org.bukkit.entity.Hanging; +@@ -21,12 +22,7 @@ import org.bukkit.entity.Hanging; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Pose; import org.bukkit.entity.Vehicle; @@ -4026,7 +3915,7 @@ index de745c8678f5dca0a939afcd45f2cab5fae3c4f1..1779f7756a7093b558bcfc7ce9655955 import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; -@@ -37,16 +31,7 @@ import org.bukkit.event.vehicle.VehicleExitEvent; +@@ -35,16 +31,7 @@ import org.bukkit.event.vehicle.VehicleExitEvent; import org.bukkit.plugin.PluginManager; import javax.annotation.Nullable; @@ -4162,7 +4051,7 @@ index 3dd3b8913e345471f971c4ef55bb91200eb50a33..781cadf1471cf8aa405af406bc9ae8db public class EntityBat extends EntityAmbient { diff --git a/src/main/java/net/minecraft/server/EntityBee.java b/src/main/java/net/minecraft/server/EntityBee.java -index c4c3ef500b9b8465644a0b7712f43ba35ad3acc1..776f4df79ac8ffad2e876e400df131f5c5691faf 100644 +index dcd99ae6cb244c819c68dfafa681adf63a34622a..6311fcac0c408c546b459b5a120990ea7a1dbd8f 100644 --- a/src/main/java/net/minecraft/server/EntityBee.java +++ b/src/main/java/net/minecraft/server/EntityBee.java @@ -1,16 +1,12 @@ @@ -4540,7 +4429,7 @@ index 364697e0155012c300219ad94a3995809e6c2f8f..8de9b17292bc69e603d5e3ef1f5e82d5 public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, IJumpable, ISaddleable { diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 3966bf7160ef5a7ec6944397ffbf51f583875860..c6bc8dda20d4789499184b651092199de0c0c333 100644 +index 68c033e2b8542c5656d5b9534a4953a370999097..02b3fb9b12bb054117702283ed769b4b8238006c 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -5,18 +5,6 @@ import com.google.common.collect.ImmutableMap; @@ -5456,7 +5345,7 @@ index 99a98e37ebd292f8fb1c3613348bd6dd51e9191b..3af1ad56464ee6d0c43f8a2fcba993e3 protected static final DataWatcherObject b = DataWatcher.a(EntityVex.class, DataWatcherRegistry.a); diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index 2fb7f23275acad54d2f5e2ecd57d5bbb333facbe..52bab44807674a5f7aee105d015f639b8aef9829 100644 +index 1ecb19c1c81456148af4a9edd59059356c3c0b94..85d88dceb25f4a0aac2cd86fed2fbc5bc0658ffc 100644 --- a/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java @@ -7,24 +7,18 @@ import com.mojang.datafixers.util.Pair; @@ -6599,10 +6488,10 @@ index faa556d4358bc9890ae80c18ee10c38a8d46548e..0f342d972f94852d057e39f0c24baf46 public class ItemWorldMap extends ItemWorldMapBase { diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java -index 6d7452d05c648cdee50b2077aec6f100449b8229..da52912a4ae8d23d1fa14a2a1b4fdcba26c2500e 100644 +index 3fb72d6ee587d66a9b7e1dec27fc4f64b82ab4df..0859a8ac90c4a514d35d9df40f85677f64fa21c3 100644 --- a/src/main/java/net/minecraft/server/JsonList.java +++ b/src/main/java/net/minecraft/server/JsonList.java -@@ -1,29 +1,24 @@ +@@ -1,27 +1,23 @@ package net.minecraft.server; -import com.google.common.collect.Lists; @@ -6614,7 +6503,6 @@ index 6d7452d05c648cdee50b2077aec6f100449b8229..da52912a4ae8d23d1fa14a2a1b4fdcba -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; +import com.google.gson.*; -+import org.apache.commons.io.IOUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + @@ -6633,8 +6521,6 @@ index 6d7452d05c648cdee50b2077aec6f100449b8229..da52912a4ae8d23d1fa14a2a1b4fdcba import java.util.List; import java.util.Map; -import javax.annotation.Nullable; -- --import org.apache.commons.io.IOUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; @@ -7314,7 +7200,7 @@ index 376427eee7774a26da53ac041ae197bd982bafce..04552de8d42d9bd75fd37f7ef13ee275 public class NameReferencingFileConverter { diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index 2dac507e9e0044a32ae54ea57eada0de04c1467d..b0eeeb9827d523c878d1e84fde8f5036476fdf2e 100644 +index 78d1d96aeaf8c8b79f5f5bdf74178816c8bc8973..e1ee0992b5ff3b70da24fc7fc5624fe7c120ce02 100644 --- a/src/main/java/net/minecraft/server/NavigationAbstract.java +++ b/src/main/java/net/minecraft/server/NavigationAbstract.java @@ -1,10 +1,11 @@ @@ -7697,31 +7583,17 @@ index 29efbdd2ca77833e6be59e5b5b4c38633e43588d..b27679e5993177d550a7a2727fc3bcda public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget { diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -index 2378a833cd31d703db462dd6f55a5cb858796b8d..3d791a74c37193dbf76d6b0a3d428d94a988d39f 100644 +index 0ad38a7b426b8b1e0ae8a98a2cb5b28878ae1249..d1c00b0535128ae234c3aa8139614185f79683fb 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -@@ -1,17 +1,13 @@ +@@ -1,7 +1,6 @@ package net.minecraft.server; --import com.destroystokyo.paper.util.set.OptimizedSmallEnumSet; // Paper - remove streams from pathfindergoalselector -+import com.destroystokyo.paper.util.set.OptimizedSmallEnumSet; - import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; -+import org.apache.logging.log4j.LogManager; -+import org.apache.logging.log4j.Logger; - --import java.util.EnumMap; --import java.util.EnumSet; --import java.util.Iterator; // Paper - remove streams from pathfindergoalselector --import java.util.Map; --import java.util.Set; -+import java.util.*; - import java.util.function.Supplier; - import java.util.stream.Stream; --import org.apache.logging.log4j.LogManager; --import org.apache.logging.log4j.Logger; - - public class PathfinderGoalSelector { - + import com.destroystokyo.paper.util.set.OptimizedSmallEnumSet; // Paper - remove streams from pathfindergoalselector +-import com.google.common.collect.Sets; + import java.util.EnumMap; + import java.util.EnumSet; + import java.util.Iterator; // Paper - remove streams from pathfindergoalselector diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalTarget.java index 29822c19496e3927eb9a061869872f4fee525254..6d1b9348e95ce154a1cae31e7f67a6213a1d3803 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalTarget.java @@ -7767,26 +7639,6 @@ index 112d8bab65bf41263a477c5faa717687fe8a2bc9..85e63bc6f46637e8a4c0fec77a61f9ca public class PathfinderGoalWrapped extends PathfinderGoal { -diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java -index 279ca87d8826ea2696ffc08d4b52c55a5e7bd392..af25ec2b833fa10a7d27c4cf91c505aee85bffe6 100644 ---- a/src/main/java/net/minecraft/server/PathfinderNormal.java -+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java -@@ -4,14 +4,12 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectMap; - import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; - import it.unimi.dsi.fastutil.objects.Object2BooleanMap; - import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; --import com.google.common.collect.Sets; -- - import it.unimi.dsi.fastutil.objects.Reference2ReferenceMap; - import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; - -+import javax.annotation.Nullable; - import java.util.EnumSet; - import java.util.Iterator; --import javax.annotation.Nullable; - - public class PathfinderNormal extends PathfinderAbstract { - diff --git a/src/main/java/net/minecraft/server/PathfinderTargetCondition.java b/src/main/java/net/minecraft/server/PathfinderTargetCondition.java index af09e1926fb6f3b780a5063b2e2e00da4cdc8ce6..c855ca15a6b2e463de48a86738d5182d28b32c20 100644 --- a/src/main/java/net/minecraft/server/PathfinderTargetCondition.java @@ -8115,7 +7967,7 @@ index 3b65711b91c51ac7b4b5b2b0144ffd279fe60eeb..b7fe6425a6c830b2b63710b3c4c3c6e7 public class PlayerInventory implements IInventory, INamableTileEntity { diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 1dfd274e3af26792d5da88c59c0ebc71d8b9feb4..bffb8fcdd32c98b3253430d06955a4e2f170dbea 100644 +index 60fa4b84c3701fc29d07215d005e5b7b45b5dfbb..c3b833c8a0c9a9746fdd6bed9ac21a0060c79dda 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -1,6 +1,8 @@ @@ -8127,23 +7979,8 @@ index 1dfd274e3af26792d5da88c59c0ebc71d8b9feb4..bffb8fcdd32c98b3253430d06955a4e2 import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -@@ -8,42 +10,24 @@ import com.mojang.authlib.GameProfile; - import com.mojang.serialization.DataResult; - import com.mojang.serialization.Dynamic; - import io.netty.buffer.Unpooled; --import java.io.File; --import java.net.SocketAddress; --import java.text.SimpleDateFormat; --import java.util.Collection; --import java.util.Iterator; --import java.util.List; --import java.util.Map; --import java.util.Optional; --import java.util.Set; --import java.util.UUID; --import java.util.concurrent.CompletableFuture; --import java.util.concurrent.TimeUnit; --import javax.annotation.Nullable; +@@ -22,26 +24,13 @@ import java.util.concurrent.CompletableFuture; + import javax.annotation.Nullable; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; - @@ -8170,17 +8007,8 @@ index 1dfd274e3af26792d5da88c59c0ebc71d8b9feb4..bffb8fcdd32c98b3253430d06955a4e2 -import org.bukkit.util.Vector; +import org.bukkit.event.player.*; import org.spigotmc.event.player.PlayerSpawnLocationEvent; -+ -+import javax.annotation.Nullable; -+import java.io.File; -+import java.net.SocketAddress; -+import java.text.SimpleDateFormat; -+import java.util.*; -+import java.util.concurrent.CompletableFuture; -+import java.util.concurrent.TimeUnit; // CraftBukkit end - public abstract class PlayerList { diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java index 68f693de5eaa5eaa8dc65230ffa95556530c2368..0b4a0052a25470033326f7533880a14eaccd6321 100644 --- a/src/main/java/net/minecraft/server/PortalTravelAgent.java @@ -8804,7 +8632,7 @@ index ea52e89bd965afbd74f15b0e2974657319c28e4a..e5b69c561f3ff2e76351f784d970f77d import java.util.UUID; diff --git a/src/main/java/net/minecraft/server/ServerStatisticManager.java b/src/main/java/net/minecraft/server/ServerStatisticManager.java -index 5f222d8b90951c61e77ab7032f8728772ba8ab9d..48a6f61bfd7408f2bdebcdd9bf07bde1c750209a 100644 +index a734cb47df9cffaee52a5c798bb3324212a004ba..eaf788301779d2d4ad57d849b0864d5af82c054f 100644 --- a/src/main/java/net/minecraft/server/ServerStatisticManager.java +++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java @@ -12,6 +12,9 @@ import com.mojang.datafixers.DataFixer; @@ -8817,13 +8645,9 @@ index 5f222d8b90951c61e77ab7032f8728772ba8ab9d..48a6f61bfd7408f2bdebcdd9bf07bde1 import java.io.File; import java.io.IOException; import java.io.StringReader; -@@ -20,13 +23,9 @@ import java.util.Map; - import java.util.Map.Entry; +@@ -21,9 +24,6 @@ import java.util.Map.Entry; import java.util.Optional; import java.util.Set; --import java.util.Map.Entry; - import java.util.concurrent.ExecutorService; - import java.util.concurrent.Executors; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; @@ -9344,7 +9168,7 @@ index 89537dec8ed278e79e078cb2fd3d3e839cdbab59..159db8d095f9abed59348594147a640c public class TileEntityEndGateway extends TileEntityEnderPortal implements ITickable { diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java -index eded99b59beb7d6fe759b21fa7d3082057c741d4..497ca14dd5c6df02dfce897820967c3f6094a255 100644 +index 7637d86ccafbf323f4edaab758fa9fc3cf657841..9b45020c41a0aa6e34853587894f0e907db257ff 100644 --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java +++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java @@ -5,12 +5,6 @@ import com.google.common.collect.Maps; @@ -9373,7 +9197,7 @@ index eded99b59beb7d6fe759b21fa7d3082057c741d4..497ca14dd5c6df02dfce897820967c3f public abstract class TileEntityFurnace extends TileEntityContainer implements IWorldInventory, RecipeHolder, AutoRecipeOutput, ITickable { diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java -index a5a8528db91c15afcf8c77d5e4727c8e0212bb63..4285e9e4c1064468922b66d8cafbd102827f7f24 100644 +index e386ffda975b8a0adc218fd47a02e5b38d12e79d..500f2783a9fc1bc89de95aeb462bc44750451566 100644 --- a/src/main/java/net/minecraft/server/TileEntityHopper.java +++ b/src/main/java/net/minecraft/server/TileEntityHopper.java @@ -1,20 +1,17 @@ @@ -9481,31 +9305,17 @@ index c4b0d8720e71c7bf2cac7ed962b8fd33cf0b49b3..fa63d9c7eae6f38a953176be8bcf1125 public class TileEntitySign extends TileEntity implements ICommandListener { // CraftBukkit - implements diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java -index ceb1f18a49ebc8fbac270d9f221fa44f9baea216..b9def7587a1dad2acce3509cc7b82e9768f8b1bc 100644 +index ab553f408b31cb7e2d281cc3d8fe42e19dc717d9..870b1faebfe5194aa48c70293593bc89d24aa116 100644 --- a/src/main/java/net/minecraft/server/TileEntitySkull.java +++ b/src/main/java/net/minecraft/server/TileEntitySkull.java -@@ -1,32 +1,23 @@ - package net.minecraft.server; +@@ -9,19 +9,14 @@ import javax.annotation.Nullable; --import com.google.common.collect.Iterables; --import com.mojang.authlib.GameProfile; --import com.mojang.authlib.minecraft.MinecraftSessionService; --import com.mojang.authlib.properties.Property; -- --import dev.tr7zw.yatopia.events.GameProfileLookupEvent; -- --import java.util.UUID; --import javax.annotation.Nullable; -- --import org.bukkit.Bukkit; -- --// Spigot start + // Spigot start import com.google.common.base.Predicate; -import com.google.common.cache.LoadingCache; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; -+import com.google.common.collect.Iterables; import com.google.common.util.concurrent.Futures; -import java.util.concurrent.Executors; -import java.util.concurrent.ExecutorService; @@ -9514,16 +9324,8 @@ index ceb1f18a49ebc8fbac270d9f221fa44f9baea216..b9def7587a1dad2acce3509cc7b82e97 - import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.mojang.authlib.Agent; -+import com.mojang.authlib.GameProfile; import com.mojang.authlib.ProfileLookupCallback; -import java.util.concurrent.Callable; -+import com.mojang.authlib.minecraft.MinecraftSessionService; -+import com.mojang.authlib.properties.Property; -+import dev.tr7zw.yatopia.events.GameProfileLookupEvent; -+import org.bukkit.Bukkit; -+ -+import javax.annotation.Nullable; -+import java.util.UUID; +import java.util.concurrent.*; // Spigot end @@ -9754,7 +9556,7 @@ index 34a180361e817b5cbd37d206fbc7cfd5ad2a468b..fa35fe79d1d35a6862151aca0dba0923 import java.util.Objects; import java.util.stream.Stream; diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index cc40e3ef589cd636225941ac755b5849520f7b70..922ef8752a4aad8f0669f43ad0333713fde45f24 100644 +index 8beda792cc67e5c789574076f5a06214614a6031..9047b02dc61d161fa4093885c39c8e7f793fc406 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -1,30 +1,14 @@ @@ -9936,34 +9738,17 @@ index 3b1779f8220afc61d4d63926bcda0c27b44dd96e..e3bcf63922639db39e83c8b6b1ad65b9 public class WorldMap extends PersistentBase { diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java -index b14f3d44a76ccac791b7be353bb2899fc59f70ec..484058ca6e5aea094a36f6e4e0d2c3106ec2da73 100644 +index 12ffee96cfbd135f107b1dff7a058177e2649964..d763c9f06d8b006936c2e19daedd6396d42a5d12 100644 --- a/src/main/java/net/minecraft/server/WorldNBTStorage.java +++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java -@@ -1,21 +1,14 @@ - package net.minecraft.server; - - import com.mojang.datafixers.DataFixer; --import java.io.File; --import java.io.FileInputStream; --import java.io.FileOutputStream; --import java.io.InputStream; --import java.io.OutputStream; --import javax.annotation.Nullable; +@@ -9,6 +9,7 @@ import java.io.OutputStream; + import javax.annotation.Nullable; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -+import org.bukkit.craftbukkit.entity.CraftPlayer; - --// CraftBukkit start --import java.util.UUID; -+import javax.annotation.Nullable; -+import java.io.*; - import java.util.concurrent.ExecutorService; - import java.util.concurrent.Executors; -- --import org.bukkit.craftbukkit.entity.CraftPlayer; ++// CraftBukkit start + import org.bukkit.craftbukkit.entity.CraftPlayer; // CraftBukkit end - public class WorldNBTStorage { diff --git a/src/main/java/net/minecraft/server/WorldPersistentData.java b/src/main/java/net/minecraft/server/WorldPersistentData.java index a2a25cf6a43a1f59a80c997e2980f2bb8e6b3817..045605b71a74a1ea3a29e622bb790bdd690d33dc 100644 --- a/src/main/java/net/minecraft/server/WorldPersistentData.java @@ -10107,7 +9892,7 @@ index 7cde55ae407012b3445f11b07a0ebc9d00e031e3..23cbd9a980ce65c99cdfd1cbade3ffa5 public class PurpurWorldConfig { diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 4fce6ed06fccc65ab022cff3623f06f40b49372b..2040f3629366358e3c81313718e3be2e72a7362f 100644 +index f27214eba0aedfceb770a39e444c46f9df19dcf6..e646e9e579ba8f90dbe1d2f891cd836e2221dae9 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -1,5 +1,9 @@