diff --git a/AirplaneLite b/AirplaneLite index 20b8c796..5e8ebc09 160000 --- a/AirplaneLite +++ b/AirplaneLite @@ -1 +1 @@ -Subproject commit 20b8c796f4b66bce7bc3be496f5c9e9edef1d226 +Subproject commit 5e8ebc09f1c090843d154e8db1160c9075be7649 diff --git a/Empirecraft b/Empirecraft index d32f7b26..a841b5a5 160000 --- a/Empirecraft +++ b/Empirecraft @@ -1 +1 @@ -Subproject commit d32f7b265f971d588a1ee69eb25e74ad372e133d +Subproject commit a841b5a54e163bd6c9e1f9ab3c1d7876b932521f diff --git a/Origami b/Origami index 36c0e05c..e204bb8e 160000 --- a/Origami +++ b/Origami @@ -1 +1 @@ -Subproject commit 36c0e05ca7b28d77f18fcd698c9b57f6c35d0ece +Subproject commit e204bb8e0fa441dd74d2df98c0444cc2f43854a3 diff --git a/PATCHES.md b/PATCHES.md index 6c39fb37..74d02788 100644 --- a/PATCHES.md +++ b/PATCHES.md @@ -18,6 +18,7 @@ # Patches | server | Add NBT API as a first-class lib | tr7zw | | | api | Add StructureLocateEvent | dfsek | | | server | Add StructureLocateEvent | dfsek | | +| server | Add a special case for floodgate and offline uuids | Ivan Pekov | | | server | Add component util | William Blake Galbreath | | | api | Add last tick time API | Ivan Pekov | tr7zw | | server | Add last tick time API | Ivan Pekov | tr7zw | @@ -50,7 +51,6 @@ # Patches | server | Configurable villager brain ticks | William Blake Galbreath | | | server | Cows eat mushrooms | William Blake Galbreath | | | server | Custom Locale Support | Bud Gidiere | | -| server | DataBits slight optimization | Paul Sauve | | | api | Default permissions | William Blake Galbreath | | | server | Despawn rate config options per projectile type | jmp | | | api | Disable reload command | Ivan Pekov | | @@ -68,6 +68,7 @@ # Patches | server | Fix LightEngineThreaded memory leak | Ivan Pekov | | | server | Fix exp drop of zombie pigmen (MC-56653) | Phoenix616 | | | server | Fix lead fall dmg config | tr7zw | | +| server | Fix rotating UP/DOWN CW and CCW | BillyGalbreath | | | server | Fix the dead lagging the server | William Blake Galbreath | | | server | Fix vanilla command permission handler | William Blake Galbreath | | | server | Global Eula file | tr7zw | | @@ -76,13 +77,11 @@ # Patches | server | Highly optimize VillagePlace filtering | Ivan Pekov | | | server | Hopper Optimizations | Phoenix616 | | | server | Implement TPSBar | BillyGalbreath | | -| server | Implement bamboo growth settings | William Blake Galbreath | | | server | Implement infinite lava | William Blake Galbreath | | | server | Improve task performance | ishland | Mykyta Komarn | | server | Infinity No Arrows | Bud Gidiere | | | server | Infinity bow settings | William Blake Galbreath | | | server | Item stuck sleep config | tr7zw | | -| api | Kill AnnotationTest | tr7zw | | | server | Lagging threshold | William Blake Galbreath | | | server | MC-147659 - Fix non black cats spawning in swamp huts | William Blake Galbreath | | | server | MC-168772 Fix - Add turtle egg block options | William Blake Galbreath | | @@ -94,6 +93,7 @@ # Patches | server | Nuke streams off SectionPosition | Ivan Pekov | | | api | Optimise Bukkit's MapPalette | epserv | | | server | Optimise portals | Ivan Pekov | | +| server | Optimised hallowen checker | Ivan Pekov | | | server | Optimize BehaviorController | MrIvanPlays | | | server | Optimize TileEntity load/unload | tr7zw | | | server | Optimize Villagers | Ivan Pekov | | @@ -105,8 +105,8 @@ # Patches | server | Option to toggle milk curing bad omen | William Blake Galbreath | | | server | Origami Server Config | Phoenix616 | | | server | PaperPR - Add hex color code support for console logging | Esophose | | +| server | PaperPR - Fix username connecting with no texture being | Camotoy | | | server | PaperPR - Projectile load/save limit per chunk | jmp | | -| server | PaperPR: Fix harming potion dupe | PepperCode1 | | | server | Per entity (type) collision settings | MrIvanPlays | tr7zw | | server | Persistent TileEntity Lore and DisplayName | jmp | | | api | PlayerAttackEntityEvent | Ivan Pekov | | @@ -124,6 +124,7 @@ # Patches | server | Simpler ShapelessRecipes comparison for Vanilla | Paul Sauve | | | server | Skip events if there's no listeners | William Blake Galbreath | | | server | Smarter statistics ticking | Mykyta Komarnytskyy | | +| server | Smol entity optimisations | Ivan Pekov | | | server | Snowman drop and put back pumpkin | William Blake Galbreath | | | server | Spread out and optimise player list ticks | James Lyne | | | server | Squid EAR immunity | William Blake Galbreath | | diff --git a/Purpur b/Purpur index 5758335e..5c0dbf17 160000 --- a/Purpur +++ b/Purpur @@ -1 +1 @@ -Subproject commit 5758335e73176ec765e6d8c73b78c3f39f5262ee +Subproject commit 5c0dbf179b9bad231e894fe1e47169a66404004a diff --git a/Tuinity b/Tuinity index 86b20d4e..33b3f860 160000 --- a/Tuinity +++ b/Tuinity @@ -1 +1 @@ -Subproject commit 86b20d4ea11e52f1d5e9509351ac577e8a9cdce5 +Subproject commit 33b3f860c233cf20cd2be93e474ee687116e180b diff --git a/patches/AirplaneLite/server.txt b/patches/AirplaneLite/server.txt index e667ee12..adc227aa 100644 --- a/patches/AirplaneLite/server.txt +++ b/patches/AirplaneLite/server.txt @@ -1 +1 @@ -AirplaneLite-MC-Dev-Fixes&AirplaneLite-Data-Structs&Strip-raytracing-for-EntityLiving-hasLineOfSight&Simpler-ShapelessRecipes-comparison-for-Vanilla&Use-unmodifiableMap-instead-of-making-copy&DataBits-slight-optimization&Swap-priority-of-checks-in-chunk-ticking&Reduce-projectile-chunk-loading \ No newline at end of file +AirplaneLite-MC-Dev-Fixes&AirplaneLite-Data-Structs&Strip-raytracing-for-EntityLiving-hasLineOfSight&Simpler-ShapelessRecipes-comparison-for-Vanilla&Use-unmodifiableMap-instead-of-making-copy&Swap-priority-of-checks-in-chunk-ticking&Reduce-projectile-chunk-loading \ No newline at end of file diff --git a/patches/Purpur/server.txt b/patches/Purpur/server.txt index b58768de..4a1f098c 100644 --- a/patches/Purpur/server.txt +++ b/patches/Purpur/server.txt @@ -1 +1 @@ -Purpur-config-files&Timings-stuff&Add-component-util&Barrels-and-enderchests-6-rows&Lagging-threshold&Configurable-villager-brain-ticks&Alternative-Keepalive-Handling&MC-168772-Fix-Add-turtle-egg-block-options&Fix-vanilla-command-permission-handler&Fix-outdated-server-showing-in-ping-before-server-fu&Dont-send-useless-entity-packets&MC-147659-Fix-non-black-cats-spawning-in-swamp-huts&Cows-eat-mushrooms&Snowman-drop-and-put-back-pumpkin&Signs-editable-on-right-click&Signs-allow-color-codes&Allow-soil-to-moisten-from-water-directly-under-it&Option-to-toggle-milk-curing-bad-omen&Fix-the-dead-lagging-the-server&Skip-events-if-there-s-no-listeners&Add-permission-for-F3-N-debug&Allow-leashing-villagers&Implement-infinite-lava&Make-lava-flow-speed-configurable&PaperPR-Projectile-load-save-limit-per-chunk&Implement-bamboo-growth-settings&Add-5-second-tps-average-in-tps&Entity-lifespan&Squid-EAR-immunity&Allow-anvil-colors&Add-no-tick-block-list&Add-option-to-disable-dolphin-treasure-searching&Stop-squids-floating-on-top-of-water&Despawn-rate-config-options-per-projectile-type&PaperPR-Add-hex-color-code-support-for-console-loggi&Persistent-TileEntity-Lore-and-DisplayName&Infinity-bow-settings&Allow-infinite-and-mending-enchantments-together&Add-twisting-and-weeping-vines-growth-rates&Config-migration-disable-saving-projectiles-to-disk-&Spread-out-and-optimise-player-list-ticks&Implement-TPSBar \ No newline at end of file +Purpur-config-files&Timings-stuff&Add-component-util&Barrels-and-enderchests-6-rows&Lagging-threshold&Configurable-villager-brain-ticks&Alternative-Keepalive-Handling&MC-168772-Fix-Add-turtle-egg-block-options&Fix-vanilla-command-permission-handler&Fix-outdated-server-showing-in-ping-before-server-fu&Dont-send-useless-entity-packets&MC-147659-Fix-non-black-cats-spawning-in-swamp-huts&Cows-eat-mushrooms&Snowman-drop-and-put-back-pumpkin&Signs-editable-on-right-click&Signs-allow-color-codes&Allow-soil-to-moisten-from-water-directly-under-it&Option-to-toggle-milk-curing-bad-omen&Fix-the-dead-lagging-the-server&Skip-events-if-there-s-no-listeners&Add-permission-for-F3-N-debug&Allow-leashing-villagers&Implement-infinite-lava&Make-lava-flow-speed-configurable&PaperPR-Projectile-load-save-limit-per-chunk&Add-5-second-tps-average-in-tps&Entity-lifespan&Squid-EAR-immunity&Allow-anvil-colors&Add-no-tick-block-list&Add-option-to-disable-dolphin-treasure-searching&Stop-squids-floating-on-top-of-water&Despawn-rate-config-options-per-projectile-type&PaperPR-Add-hex-color-code-support-for-console-loggi&Persistent-TileEntity-Lore-and-DisplayName&Infinity-bow-settings&Allow-infinite-and-mending-enchantments-together&Add-twisting-and-weeping-vines-growth-rates&Config-migration-disable-saving-projectiles-to-disk-&Spread-out-and-optimise-player-list-ticks&Implement-TPSBar&Fix-rotating-UP-DOWN-CW-and-CCW \ No newline at end of file diff --git a/patches/api/0001-Yatopia-API-Bundle.patch b/patches/api/0001-Yatopia-API-Bundle.patch index deff16a7..1f3daf7f 100644 --- a/patches/api/0001-Yatopia-API-Bundle.patch +++ b/patches/api/0001-Yatopia-API-Bundle.patch @@ -25,6 +25,18 @@ index fecd7b14d317f55eb1ce7b5c6af9913917971427..6df897ed32a94df4a06e1d5ac3d749e6 + } + // Purpur end } +diff --git a/src/main/java/org/bukkit/ChatColor.java b/src/main/java/org/bukkit/ChatColor.java +index 06bdfddb7b1acb7bb7b347ad1aa13bff0c823ab1..bd2723618272068bee0fb6be8d702c34cb44762b 100644 +--- a/src/main/java/org/bukkit/ChatColor.java ++++ b/src/main/java/org/bukkit/ChatColor.java +@@ -312,6 +312,7 @@ public enum ChatColor { + * @return Associative {@link org.bukkit.ChatColor} with the given id, + * or null if it doesn't exist + */ ++ @Nullable // Yatopia + public static ChatColor getById(int id) { + return BY_ID.get(id); + } diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java index b45ad8df8b7a44c9e6d12326e5ea85e8d166a16c..40d342ef1a618b7d85731b238b0344402e551251 100644 --- a/src/main/java/org/bukkit/Server.java diff --git a/patches/api/0002-Modify-POM.patch b/patches/api/0002-Modify-POM.patch index 1f491362..c3c31971 100644 --- a/patches/api/0002-Modify-POM.patch +++ b/patches/api/0002-Modify-POM.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Modify POM diff --git a/pom.xml b/pom.xml -index 4516ba097e8afc3e422efc368311fa66e967c05a..f641f2b375bdb5c43880ff67195764c4d4124155 100644 +index 024be926afb1219c6443c496721f4bd0a4fec222..89542d52c14cc009d8bf50f446ab2bebb8516c94 100644 --- a/pom.xml +++ b/pom.xml @@ -3,18 +3,18 @@ diff --git a/patches/api/0004-Add-GameProfileLookupEvent.patch b/patches/api/0003-Add-GameProfileLookupEvent.patch similarity index 66% rename from patches/api/0004-Add-GameProfileLookupEvent.patch rename to patches/api/0003-Add-GameProfileLookupEvent.patch index 3809f043..3699d080 100644 --- a/patches/api/0004-Add-GameProfileLookupEvent.patch +++ b/patches/api/0003-Add-GameProfileLookupEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add GameProfileLookupEvent diff --git a/pom.xml b/pom.xml -index f641f2b375bdb5c43880ff67195764c4d4124155..31aba885d940acf0a9df5d4e83dfec69030b2a37 100644 +index 89542d52c14cc009d8bf50f446ab2bebb8516c94..3e6971d0bbc383e4639e402c076af5292ee9236a 100644 --- a/pom.xml +++ b/pom.xml @@ -52,6 +52,10 @@ @@ -35,18 +35,18 @@ index f641f2b375bdb5c43880ff67195764c4d4124155..31aba885d940acf0a9df5d4e83dfec69 fastutil diff --git a/src/main/java/dev/tr7zw/yatopia/events/GameProfileLookupEvent.java b/src/main/java/dev/tr7zw/yatopia/events/GameProfileLookupEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..ff58b8875a07b34de02b9b479ff3e6daf66d7832 +index 0000000000000000000000000000000000000000..313fe42442a93db76f91eaab50a345340f314fa8 --- /dev/null +++ b/src/main/java/dev/tr7zw/yatopia/events/GameProfileLookupEvent.java -@@ -0,0 +1,45 @@ +@@ -0,0 +1,51 @@ +package dev.tr7zw.yatopia.events; + ++import com.mojang.authlib.GameProfile; +import java.util.UUID; -+ +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; -+ -+import com.mojang.authlib.GameProfile; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; + +public class GameProfileLookupEvent extends Event { + private static final HandlerList handlers = new HandlerList(); @@ -54,32 +54,38 @@ index 0000000000000000000000000000000000000000..ff58b8875a07b34de02b9b479ff3e6da + private final UUID uuid; + private final String name; + -+ public GameProfileLookupEvent(boolean async, UUID uuid, String name) { -+ super(async); -+ this.uuid = uuid; -+ this.name = name; -+ } ++ public GameProfileLookupEvent(boolean async, @NotNull UUID uuid, @NotNull String name) { ++ super(async); ++ this.uuid = uuid; ++ this.name = name; ++ } + -+ public GameProfile getGameProfile() { -+ return gameProfile; -+ } ++ @Nullable ++ public GameProfile getGameProfile() { ++ return gameProfile; ++ } + -+ public void setGameProfile(GameProfile gameProfile) { -+ this.gameProfile = gameProfile; -+ } ++ public void setGameProfile(@Nullable GameProfile gameProfile) { ++ this.gameProfile = gameProfile; ++ } + -+ public UUID getUuid() { -+ return uuid; -+ } ++ @NotNull ++ public UUID getUuid() { ++ return uuid; ++ } + -+ public String getName() { -+ return name; -+ } ++ @NotNull ++ public String getName() { ++ return name; ++ } + -+ public HandlerList getHandlers() { ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { + return handlers; + } + ++ @NotNull + public static HandlerList getHandlerList() { + return handlers; + } diff --git a/patches/api/0003-Kill-AnnotationTest.patch b/patches/api/0003-Kill-AnnotationTest.patch deleted file mode 100644 index 23c50e9e..00000000 --- a/patches/api/0003-Kill-AnnotationTest.patch +++ /dev/null @@ -1,271 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: tr7zw -Date: Sat, 1 Aug 2020 15:52:19 -0500 -Subject: [PATCH] Kill AnnotationTest - - -diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java -deleted file mode 100644 -index a48be38b159bec27ec398666b28620a9ea625547..0000000000000000000000000000000000000000 ---- a/src/test/java/org/bukkit/AnnotationTest.java -+++ /dev/null -@@ -1,259 +0,0 @@ --package org.bukkit; -- --import java.io.File; --import java.io.FileInputStream; --import java.io.IOException; --import java.net.URISyntaxException; --import java.net.URL; --import java.util.ArrayList; --import java.util.Collection; --import java.util.Collections; --import java.util.HashMap; --import java.util.List; --import java.util.Map; --import org.jetbrains.annotations.NotNull; --import org.jetbrains.annotations.Nullable; --import org.junit.Assert; --import org.junit.Test; --import org.objectweb.asm.ClassReader; --import org.objectweb.asm.Opcodes; --import org.objectweb.asm.Type; --import org.objectweb.asm.tree.AnnotationNode; --import org.objectweb.asm.tree.ClassNode; --import org.objectweb.asm.tree.MethodNode; --import org.objectweb.asm.tree.ParameterNode; -- --public class AnnotationTest { -- -- private static final String[] ACCEPTED_ANNOTATIONS = { -- "Lorg/jetbrains/annotations/Nullable;", -- "Lorg/jetbrains/annotations/NotNull;", -- "Lorg/jetbrains/annotations/Contract;", -- "Lorg/bukkit/UndefinedNullability;" -- }; -- -- private static final String[] EXCLUDED_CLASSES = { -- // Internal technical classes -- "org/bukkit/plugin/java/JavaPluginLoader", -- "org/bukkit/util/io/BukkitObjectInputStream", -- "org/bukkit/util/io/BukkitObjectOutputStream", -- "org/bukkit/util/io/Wrapper", -- "org/bukkit/plugin/java/PluginClassLoader", -- // Generic functional interface -- "org/bukkit/util/Consumer", -- // Paper start -- // Timings history is broken in terms of nullability due to guavas Function defining that the param is NonNull -- "co/aikar/timings/TimingHistory$2", -- "co/aikar/timings/TimingHistory$2$1", -- "co/aikar/timings/TimingHistory$2$1$1", -- "co/aikar/timings/TimingHistory$2$1$2", -- "co/aikar/timings/TimingHistory$3", -- "co/aikar/timings/TimingHistory$4", -- "co/aikar/timings/TimingHistoryEntry$1" -- // Paper end -- }; -- -- @Test -- public void testAll() throws IOException, URISyntaxException { -- URL loc = Bukkit.class.getProtectionDomain().getCodeSource().getLocation(); -- File file = new File(loc.toURI()); -- -- // Running from jar is not supported yet -- Assert.assertTrue("code must be in a directory", file.isDirectory()); -- -- final HashMap foundClasses = new HashMap<>(); -- collectClasses(file, foundClasses); -- -- final ArrayList errors = new ArrayList<>(); -- -- for (ClassNode clazz : foundClasses.values()) { -- if (!isClassIncluded(clazz, foundClasses)) { -- continue; -- } -- -- for (MethodNode method : clazz.methods) { -- if (!isMethodIncluded(clazz, method, foundClasses)) { -- continue; -- } -- -- if (mustBeAnnotated(Type.getReturnType(method.desc)) && !isWellAnnotated(method.invisibleAnnotations)) { -- warn(errors, clazz, method, "return value"); -- } -- -- Type[] paramTypes = Type.getArgumentTypes(method.desc); -- List parameters = method.parameters; -- -- for (int i = 0; i < paramTypes.length; i++) { -- if (mustBeAnnotated(paramTypes[i]) && !isWellAnnotated(method.invisibleParameterAnnotations == null ? null : method.invisibleParameterAnnotations[i])) { -- ParameterNode paramNode = parameters == null ? null : parameters.get(i); -- String paramName = paramNode == null ? null : paramNode.name; -- -- warn(errors, clazz, method, "parameter " + i + (paramName == null ? "" : ": " + paramName)); -- } -- } -- } -- } -- -- if (errors.isEmpty()) { -- // Success -- return; -- } -- -- Collections.sort(errors); -- -- System.out.println(errors.size() + " missing annotation(s):"); -- for (String message : errors) { -- System.out.print("\t"); -- System.out.println(message); -- } -- -- Assert.fail("There " + errors.size() + " are missing annotation(s)"); -- } -- -- private static void collectClasses(@NotNull File from, @NotNull Map to) throws IOException { -- if (from.isDirectory()) { -- final File[] files = from.listFiles(); -- assert files != null; -- -- for (File file : files) { -- collectClasses(file, to); -- } -- return; -- } -- -- if (!from.getName().endsWith(".class")) { -- return; -- } -- -- try (FileInputStream in = new FileInputStream(from)) { -- final ClassReader cr = new ClassReader(in); -- -- final ClassNode node = new ClassNode(); -- cr.accept(node, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES); -- -- to.put(node.name, node); -- } -- } -- -- private static boolean isClassIncluded(@NotNull ClassNode clazz, @NotNull Map allClasses) { -- // Exclude private, synthetic or deprecated classes and annotations, since their members can't be null -- if ((clazz.access & (Opcodes.ACC_PRIVATE | Opcodes.ACC_SYNTHETIC | Opcodes.ACC_DEPRECATED | Opcodes.ACC_ANNOTATION)) != 0) { -- return false; -- } -- -- if (isSubclassOf(clazz, "org/bukkit/material/MaterialData", allClasses)) { -- throw new AssertionError("Subclass of MaterialData must be deprecated: " + clazz.name); -- } -- -- if (isSubclassOf(clazz, "java/lang/Exception", allClasses) -- || isSubclassOf(clazz, "java/lang/RuntimeException", allClasses)) { -- // Exceptions are excluded -- return false; -- } -- -- for (String excludedClass : EXCLUDED_CLASSES) { -- if (excludedClass.equals(clazz.name)) { -- return false; -- } -- } -- -- return true; -- } -- -- private static boolean isMethodIncluded(@NotNull ClassNode clazz, @NotNull MethodNode method, @NotNull Map allClasses) { -- // Exclude private, synthetic and deprecated methods -- if ((method.access & (Opcodes.ACC_PRIVATE | Opcodes.ACC_SYNTHETIC | Opcodes.ACC_DEPRECATED)) != 0 || (method.access & (Opcodes.ACC_PRIVATE | Opcodes.ACC_PROTECTED | Opcodes.ACC_PUBLIC)) == 0) { // Paper - ignore package-private -- return false; -- } -- -- // Exclude Java methods -- if (is(method, "toString", 0) || is(method, "clone", 0) || is(method, "equals", 1)) { -- return false; -- } -- -- // Exclude generated Enum methods -- if (isSubclassOf(clazz, "java/lang/Enum", allClasses) && (is(method, "values", 0) || is(method, "valueOf", 1))) { -- return false; -- } -- -- // Anonymous classes have generated constructors, which can't be annotated nor invoked -- if ("".equals(method.name) && isAnonymous(clazz)) { -- return false; -- } -- -- return true; -- } -- -- private static boolean isWellAnnotated(@Nullable List annotations) { -- if (annotations == null) { -- return false; -- } -- -- for (AnnotationNode node : annotations) { -- for (String acceptedAnnotation : ACCEPTED_ANNOTATIONS) { -- if (acceptedAnnotation.equals(node.desc)) { -- return true; -- } -- } -- } -- -- return false; -- } -- -- private static boolean mustBeAnnotated(@NotNull Type type) { -- return type.getSort() == Type.ARRAY || type.getSort() == Type.OBJECT; -- } -- -- private static boolean is(@NotNull MethodNode method, @NotNull String name, int parameters) { -- final List params = method.parameters; -- return method.name.equals(name) && (params == null || params.size() == parameters); -- } -- -- /** -- * Checks if the class is anonymous. -- * -- * @param clazz the class to check -- * @return true if given class is anonymous -- */ -- private static boolean isAnonymous(@NotNull ClassNode clazz) { -- final String name = clazz.name; -- if (name == null) { -- return false; -- } -- final int nestedSeparator = name.lastIndexOf('$'); -- if (nestedSeparator == -1 || nestedSeparator + 1 == name.length()) { -- return false; -- } -- -- // Nested classes have purely numeric names. Java classes can't begin with a number, -- // so if first character is a number, the class must be anonymous -- final char c = name.charAt(nestedSeparator + 1); -- return c >= '0' && c <= '9'; -- } -- -- private static boolean isSubclassOf(@NotNull ClassNode what, @NotNull String ofWhat, @NotNull Map allClasses) { -- if (ofWhat.equals(what.name) -- // Not only optimization: Super class may not be present in allClasses, so it is checked here -- || ofWhat.equals(what.superName)) { -- return true; -- } -- -- final ClassNode parent = allClasses.get(what.superName); -- if (parent != null && isSubclassOf(parent, ofWhat, allClasses)) { -- return true; -- } -- -- for (String superInterface : what.interfaces) { -- final ClassNode interfaceParent = allClasses.get(superInterface); -- if (interfaceParent != null && isSubclassOf(interfaceParent, ofWhat, allClasses)) { -- return true; -- } -- } -- -- return false; -- } -- -- private static void warn(@NotNull Collection out, @NotNull ClassNode clazz, @NotNull MethodNode method, @NotNull String description) { -- out.add(clazz.name + " \t" + method.name + " \t" + description); -- } --} diff --git a/patches/api/0005-Add-last-tick-time-API.patch b/patches/api/0004-Add-last-tick-time-API.patch similarity index 82% rename from patches/api/0005-Add-last-tick-time-API.patch rename to patches/api/0004-Add-last-tick-time-API.patch index 01701db7..cecb10c0 100644 --- a/patches/api/0005-Add-last-tick-time-API.patch +++ b/patches/api/0004-Add-last-tick-time-API.patch @@ -7,7 +7,7 @@ Original patch by: Co-authored-by: tr7zw diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 6df897ed32a94df4a06e1d5ac3d749e6a360ab2f..7b704b5841aa2f212b70719cf9bd79b4fb21fcf0 100644 +index 6df897ed32a94df4a06e1d5ac3d749e6a360ab2f..b08a5a91315f3cd80c4c4ef47f5fc6755cbf73d8 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -1828,4 +1828,14 @@ public final class Bukkit { @@ -20,16 +20,16 @@ index 6df897ed32a94df4a06e1d5ac3d749e6a360ab2f..7b704b5841aa2f212b70719cf9bd79b4 + public static long getLastTickMs() { + return server.getLastTickMs(); + } -+ public static java.time.Duration getLastTickTime() { ++ @NotNull public static java.time.Duration getLastTickTime() { + return server.getLastTickTime(); + } + // Yatopia end } diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 40d342ef1a618b7d85731b238b0344402e551251..2f86ada4a487a6d59fa8b173c8339dcdda65cb30 100644 +index 40d342ef1a618b7d85731b238b0344402e551251..d6ba0895f259c15de9fb974a5c74da709158fc28 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -1651,4 +1651,23 @@ public interface Server extends PluginMessageRecipient { +@@ -1651,4 +1651,24 @@ public interface Server extends PluginMessageRecipient { */ boolean isLagging(); // Purpur end @@ -50,6 +50,7 @@ index 40d342ef1a618b7d85731b238b0344402e551251..2f86ada4a487a6d59fa8b173c8339dcd + * + * @return duration + */ ++ @NotNull + java.time.Duration getLastTickTime(); + // Yatopia end } diff --git a/patches/api/0006-Add-NBT-API-as-a-first-class-lib.patch b/patches/api/0005-Add-NBT-API-as-a-first-class-lib.patch similarity index 83% rename from patches/api/0006-Add-NBT-API-as-a-first-class-lib.patch rename to patches/api/0005-Add-NBT-API-as-a-first-class-lib.patch index cd8d2b65..7354d49b 100644 --- a/patches/api/0006-Add-NBT-API-as-a-first-class-lib.patch +++ b/patches/api/0005-Add-NBT-API-as-a-first-class-lib.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add NBT API as a first-class lib diff --git a/pom.xml b/pom.xml -index 31aba885d940acf0a9df5d4e83dfec69030b2a37..afe3477c9a577a5fa1ef6c7dfd5a221fd3ca9f6b 100644 +index 3e6971d0bbc383e4639e402c076af5292ee9236a..0e762240836299630743f29d00db03ffa193d4ab 100644 --- a/pom.xml +++ b/pom.xml @@ -56,6 +56,11 @@ @@ -27,7 +27,7 @@ index 31aba885d940acf0a9df5d4e83dfec69030b2a37..afe3477c9a577a5fa1ef6c7dfd5a221f + + de.tr7zw + item-nbt-api -+ 2.6.0 ++ 2.7.1 + @@ -45,6 +45,27 @@ index 31aba885d940acf0a9df5d4e83dfec69030b2a37..afe3477c9a577a5fa1ef6c7dfd5a221f +diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java +index 98263d896f316983609432c45b85401a2692432d..afaa459d2c351f99b598ec9054a6838ffb0098e8 100644 +--- a/src/main/java/org/bukkit/Chunk.java ++++ b/src/main/java/org/bukkit/Chunk.java +@@ -275,4 +275,16 @@ public interface Chunk extends PersistentDataHolder { + * @return if the block is contained within + */ + boolean contains(@NotNull BlockData block); ++ ++ // Yatopia start ++ /** ++ * Returns a custom tag container of this chunk. ++ * ++ * @return custom NBT tags container ++ */ ++ @NotNull ++ default de.tr7zw.changeme.nbtapi.NBTCompound getNBTC() { ++ return new de.tr7zw.changeme.nbtapi.NBTChunk(this).getPersistentDataContainer(); ++ } ++ // Yatopia end + } diff --git a/src/main/java/org/bukkit/block/TileState.java b/src/main/java/org/bukkit/block/TileState.java index 3b10fcc13893403b29f0260b8605144679e89b82..1e9a96d8b08cc396acf73dc42083009354e89d8a 100644 --- a/src/main/java/org/bukkit/block/TileState.java @@ -108,10 +129,10 @@ index 76e857c364fe79e20cf9bde54b65e5b7108174fd..dc7e9983b89726625acce95026b45695 + // Yatopia end } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index ccd81fca25233c2a9c2a8c3f4dda3053d7b2e723..5ad9dfb7856b2f86947b12b5444b2f8147f72bbf 100644 +index 4f2520f7a4ca6d57a85924ada1068a055b9a01fb..9ac89fe309e5cb393bdda3a77f8313991ab77732 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -791,4 +791,42 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { +@@ -792,4 +792,42 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { return itemMeta.hasItemFlag(flag); } // Paper end diff --git a/patches/api/0007-ProxyForwardDataEvent.patch b/patches/api/0006-ProxyForwardDataEvent.patch similarity index 72% rename from patches/api/0007-ProxyForwardDataEvent.patch rename to patches/api/0006-ProxyForwardDataEvent.patch index 56d730b3..835aa36b 100644 --- a/patches/api/0007-ProxyForwardDataEvent.patch +++ b/patches/api/0006-ProxyForwardDataEvent.patch @@ -6,12 +6,13 @@ Subject: [PATCH] ProxyForwardDataEvent diff --git a/src/main/java/net/yatopia/api/event/ProxyForwardDataEvent.java b/src/main/java/net/yatopia/api/event/ProxyForwardDataEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..22775d2d03ccd4c7decebc3e26b453efd44d865b +index 0000000000000000000000000000000000000000..d3780d965bdd491425a92bf5e554f7def6e0ecf0 --- /dev/null +++ b/src/main/java/net/yatopia/api/event/ProxyForwardDataEvent.java -@@ -0,0 +1,114 @@ +@@ -0,0 +1,125 @@ +package net.yatopia.api.event; + ++import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; +import com.mojang.authlib.properties.Property; +import java.util.List; @@ -19,6 +20,7 @@ index 0000000000000000000000000000000000000000..22775d2d03ccd4c7decebc3e26b453ef +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; + +/** + * Called when a proxy such as BungeeCord or Velocity forwards player data to the server. @@ -29,7 +31,7 @@ index 0000000000000000000000000000000000000000..22775d2d03ccd4c7decebc3e26b453ef + private final String name; + private List properties; + -+ public ProxyForwardDataEvent(boolean async, UUID uuid, String name, List properties) { ++ public ProxyForwardDataEvent(boolean async, @NotNull UUID uuid, @NotNull String name, @NotNull List properties) { + super(async); + this.uuid = uuid; + this.name = name; @@ -41,6 +43,7 @@ index 0000000000000000000000000000000000000000..22775d2d03ccd4c7decebc3e26b453ef + * + * @return unique id + */ ++ @NotNull + public UUID getUuid() { + return uuid; + } @@ -50,15 +53,19 @@ index 0000000000000000000000000000000000000000..22775d2d03ccd4c7decebc3e26b453ef + * + * @return name + */ ++ @NotNull + public String getName() { + return name; + } + + /** + * Returns an immutable copy of the forwarded properties. ++ *

++ * If there were no properties, it would return an empty list. + * + * @return properties + */ ++ @NotNull + public List getProperties() { + return ImmutableList.copyOf(properties); + } @@ -68,7 +75,8 @@ index 0000000000000000000000000000000000000000..22775d2d03ccd4c7decebc3e26b453ef + * + * @param property property + */ -+ public void addProperty(Property property) { ++ public void addProperty(@NotNull Property property) { ++ Preconditions.checkNotNull(property, "property"); + if (hasProperty(property.getName())) { + removeProperty(property.getName()); + } @@ -81,9 +89,11 @@ index 0000000000000000000000000000000000000000..22775d2d03ccd4c7decebc3e26b453ef + * @param property the property's name you want to get + * @return property if present + */ -+ public Property getProperty(String property) { ++ @Nullable ++ public Property getProperty(@NotNull String property) { ++ Preconditions.checkNotNull(property, "property"); + for (Property prop : properties) { -+ if (prop.getName().toLowerCase().equalsIgnoreCase(property.toLowerCase())) { ++ if (prop.getName().equalsIgnoreCase(property)) { + return prop; + } + } @@ -96,7 +106,7 @@ index 0000000000000000000000000000000000000000..22775d2d03ccd4c7decebc3e26b453ef + * @param property the name of the property you want to check if exists + * @return boolean value + */ -+ public boolean hasProperty(String property) { ++ public boolean hasProperty(@NotNull String property) { + return getProperty(property) != null; + } + @@ -105,8 +115,8 @@ index 0000000000000000000000000000000000000000..22775d2d03ccd4c7decebc3e26b453ef + * + * @param property the property's name you want to remove + */ -+ public void removeProperty(String property) { -+ properties.removeIf(prop -> prop.getName().toLowerCase().equalsIgnoreCase(property.toLowerCase())); ++ public void removeProperty(@NotNull String property) { ++ properties.removeIf(prop -> prop.getName().equalsIgnoreCase(property)); + } + + /** @@ -114,13 +124,14 @@ index 0000000000000000000000000000000000000000..22775d2d03ccd4c7decebc3e26b453ef + * + * @param property the property you want to remove + */ -+ public void removeProperty(Property property) { ++ public void removeProperty(@NotNull Property property) { ++ Preconditions.checkNotNull(property, "property"); + properties.remove(property); + } + + // + private static final HandlerList handlers = new HandlerList(); + @NotNull @Override public HandlerList getHandlers() { return handlers; } -+ public static HandlerList getHandlerList() { return handlers; } ++ @NotNull public static HandlerList getHandlerList() { return handlers; } + // +} diff --git a/patches/api/0008-PlayerAttackEntityEvent.patch b/patches/api/0007-PlayerAttackEntityEvent.patch similarity index 88% rename from patches/api/0008-PlayerAttackEntityEvent.patch rename to patches/api/0007-PlayerAttackEntityEvent.patch index 5a545802..93d75bfb 100644 --- a/patches/api/0008-PlayerAttackEntityEvent.patch +++ b/patches/api/0007-PlayerAttackEntityEvent.patch @@ -7,10 +7,10 @@ Added per request diff --git a/src/main/java/net/yatopia/api/event/PlayerAttackEntityEvent.java b/src/main/java/net/yatopia/api/event/PlayerAttackEntityEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..72e2cfd4c62f02154d8dddaa964249fe5aa64e98 +index 0000000000000000000000000000000000000000..7a4bd2d6518409972651373c3e6ea0fd17f8fcf7 --- /dev/null +++ b/src/main/java/net/yatopia/api/event/PlayerAttackEntityEvent.java -@@ -0,0 +1,121 @@ +@@ -0,0 +1,123 @@ +package net.yatopia.api.event; + +import org.bukkit.entity.Entity; @@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..72e2cfd4c62f02154d8dddaa964249fe + private boolean criticalHit; + private float damage; + -+ public PlayerAttackEntityEvent(HumanEntity attacker, Entity attacked, ItemStack attackItem, boolean criticalHit, float damage) { ++ public PlayerAttackEntityEvent(@NotNull HumanEntity attacker, @NotNull Entity attacked, @NotNull ItemStack attackItem, boolean criticalHit, float damage) { + this.attacker = attacker; + this.attacked = attacked; + this.attackItem = attackItem; @@ -67,6 +67,8 @@ index 0000000000000000000000000000000000000000..72e2cfd4c62f02154d8dddaa964249fe + + /** + * Returns the attack item used to damage the {@link #getAttackedEntity()} ++ *

++ * If there wasn't any item, it would return ItemStack(Material.AIR) + * + * @return attack item + */ @@ -129,6 +131,6 @@ index 0000000000000000000000000000000000000000..72e2cfd4c62f02154d8dddaa964249fe + // + private static final HandlerList handlers = new HandlerList(); + @NotNull @Override public HandlerList getHandlers() { return handlers; } -+ public static HandlerList getHandlerList() { return handlers; } ++ @NotNull public static HandlerList getHandlerList() { return handlers; } + // +} diff --git a/patches/api/0009-Add-StructureLocateEvent.patch b/patches/api/0008-Add-StructureLocateEvent.patch similarity index 100% rename from patches/api/0009-Add-StructureLocateEvent.patch rename to patches/api/0008-Add-StructureLocateEvent.patch diff --git a/patches/api/0010-Disable-reload-command.patch b/patches/api/0009-Disable-reload-command.patch similarity index 100% rename from patches/api/0010-Disable-reload-command.patch rename to patches/api/0009-Disable-reload-command.patch diff --git a/patches/server/0001-Yatopia-Server-Fixes.patch b/patches/server/0001-Yatopia-Server-Fixes.patch index 9173a9fc..471592aa 100644 --- a/patches/server/0001-Yatopia-Server-Fixes.patch +++ b/patches/server/0001-Yatopia-Server-Fixes.patch @@ -142,7 +142,7 @@ index 2291135eaef64c403183724cb6e413cd7e472672..6fcc7ed7c129e6a33386d65b37cbba4a public static long a(long i, EnumDirection enumdirection) { return a(i, enumdirection.getAdjacentX(), enumdirection.getAdjacentY(), enumdirection.getAdjacentZ()); diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java -index cabce1a8ba5db56495628edd9bc796aee7a53356..9754a9eac48c50efdefdceefbb4386bf0df583dd 100644 +index 17753c8a997aa286460be5d8eb6508e2eaed18ce..56d5cebd155f2b5ee24c1d8b75903316e59688d1 100644 --- a/src/main/java/net/minecraft/server/CommandDispatcher.java +++ b/src/main/java/net/minecraft/server/CommandDispatcher.java @@ -107,6 +107,7 @@ public class CommandDispatcher { @@ -153,7 +153,7 @@ index cabce1a8ba5db56495628edd9bc796aee7a53356..9754a9eac48c50efdefdceefbb4386bf } if (commanddispatcher_servertype.d) { -@@ -337,6 +338,7 @@ public class CommandDispatcher { +@@ -338,6 +339,7 @@ public class CommandDispatcher { } @@ -161,7 +161,7 @@ index cabce1a8ba5db56495628edd9bc796aee7a53356..9754a9eac48c50efdefdceefbb4386bf public static LiteralArgumentBuilder a(String s) { return LiteralArgumentBuilder.literal(s); } -@@ -356,6 +358,7 @@ public class CommandDispatcher { +@@ -357,6 +359,7 @@ public class CommandDispatcher { }; } @@ -197,7 +197,7 @@ index 86f1cfe454ea0a989775b49a6b88375c766ef647..da53af61d1171db3c167c6e007adf953 if (!(this.k instanceof EntityPlayer)) { throw CommandListenerWrapper.a.create(); diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 985d0d4aea2210e908ac76fbeafc0c895372aee7..d224b1d0e224853e825486559938aed2c56c3981 100644 +index 77100ab382b33aef8b2194b611c0b1d454da91fd..1ece3e1e9e7a26f1ee07202916687f627c9e4c95 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -434,7 +434,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -373,7 +373,7 @@ index dd52a8fe4fd46e57a5d1af49ba1965a483cf4fcc..00000000000000000000000000000000 - IChunkAccess ichunkaccess = iworldreader.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS, !(iworldreader instanceof World) || !((World) iworldreader).origamiConfig.onlyFindGeneratedFeatures); - if (ichunkaccess == null) { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 07d47ad2362c5ebfa7993262a8faed240cc21717..107d7ac761bfb7667dfab88b31712e2061a46258 100644 +index c2b5874a77ae8a992bc668dc19f5300bebf3d239..3bbfb0117187a26354fa58ec46eeb6e62845851e 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -96,6 +96,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -394,7 +394,7 @@ index 07d47ad2362c5ebfa7993262a8faed240cc21717..107d7ac761bfb7667dfab88b31712e20 this.world = new CraftWorld((WorldServer) this, gen, env); diff --git a/src/main/java/net/minecraft/server/World.java.rej b/src/main/java/net/minecraft/server/World.java.rej deleted file mode 100644 -index 313aa8f7d47c53a6a0130994c9d61d7c073c95c6..0000000000000000000000000000000000000000 +index f4e9c5a0136d3a0ed813efec7fe8a0e7f256cf40..0000000000000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/World.java.rej +++ /dev/null @@ -1,18 +0,0 @@ @@ -411,7 +411,7 @@ index 313aa8f7d47c53a6a0130994c9d61d7c073c95c6..00000000000000000000000000000000 -@@ -124,6 +126,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - protected World(WorldDataMutable worlddatamutable, ResourceKey resourcekey, final DimensionManager dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper - this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((WorldDataServer) worlddatamutable).getName()); // Spigot -- this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig((((WorldDataServer)worlddatamutable).getName()), this.spigotConfig); // Paper +- this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((WorldDataServer) worlddatamutable).getName(), this.spigotConfig); // Paper -+ this.origamiConfig = new de.minebench.origami.OrigamiConfig.WorldConfig(((WorldDataServer)worlddatamutable).getName()); // Origami - World Config - this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray - this.generator = gen; diff --git a/patches/server/0002-Modify-POM.patch b/patches/server/0002-Modify-POM.patch index 55ac6f0d..bc273799 100644 --- a/patches/server/0002-Modify-POM.patch +++ b/patches/server/0002-Modify-POM.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Modify POM diff --git a/pom.xml b/pom.xml -index 78c2a8bbcc0132f891c8aa545529d20aa0d9eb57..9f2cc8fbc0bfaefd772904076e6fd4d0c78f30ee 100644 +index 174c0b67c1c5b41d80613128ebf2d78ee27f3cee..e20489a5834e9727a8c50435768ffe0e87af2188 100644 --- a/pom.xml +++ b/pom.xml @@ -1,11 +1,11 @@ diff --git a/patches/server/0003-Brandings.patch b/patches/server/0003-Brandings.patch index abf18723..2abd54d9 100644 --- a/patches/server/0003-Brandings.patch +++ b/patches/server/0003-Brandings.patch @@ -39,10 +39,10 @@ index 74ed02fa9296583977bb721014b10ff8b708b43c..a13c7b2b5bc79ecaea404779149ed02c .completer(new ConsoleCommandCompleter(this.server)) ); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index a91869dde9f47e00b6c6e380e7d3b92282d9b235..fc3abab760aa90e2afa5b4bf6abd3a0aff897f25 100644 +index 97cece32f994db6ff1d88b740060996869648f3c..c929c3ecb2a8c9056cad0418b2266b47bd0bbcaf 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1524,7 +1524,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant Co-authored-by: Ivan Pekov diff --git a/pom.xml b/pom.xml -index 9f2cc8fbc0bfaefd772904076e6fd4d0c78f30ee..2acc51071e968333f85959d76b86e7e6e0ee828b 100644 +index e20489a5834e9727a8c50435768ffe0e87af2188..50fa602350b757a0444d104d5efd7b947aaf6cbd 100644 --- a/pom.xml +++ b/pom.xml @@ -166,6 +166,12 @@ diff --git a/patches/server/0006-Add-last-tick-time-API.patch b/patches/server/0006-Add-last-tick-time-API.patch index b4007812..31b8c491 100644 --- a/patches/server/0006-Add-last-tick-time-API.patch +++ b/patches/server/0006-Add-last-tick-time-API.patch @@ -7,10 +7,10 @@ Original patch by: Co-authored-by: tr7zw diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index fc3abab760aa90e2afa5b4bf6abd3a0aff897f25..e990a39d97cb1427dd2ce43bdc79fb84e93e9c4b 100644 +index c929c3ecb2a8c9056cad0418b2266b47bd0bbcaf..a342a13f387b4079bfc983d500a0fde534891196 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -936,6 +936,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java -index 1d3c2dd93657fb5dc71ee6b444c585b54619d1e8..77ea56c5a25fe09a1721429d42965ad34d905870 100644 +index e75e676d196d9f5a3409ec50645fab611b0afdad..fa2b88b54a419f506a195130e664701766720ceb 100644 --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java +++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java -@@ -83,7 +83,14 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I - this.c = recipes; - } - -+ private static Object2IntOpenHashMap cachedFuelMap = null; // Yatopia -+ - public static Map f() { -+ // Yatopia start -+ if(cachedFuelMap != null) { -+ return cachedFuelMap; -+ } -+ // Yatopia end - Map map = Maps.newLinkedHashMap(); - - a(map, (IMaterial) Items.LAVA_BUCKET, 20000); -@@ -146,6 +153,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); -+ cachedFuelMap = new Object2IntOpenHashMap<>(map); // Yatopia - return map; - } - -@@ -271,7 +279,10 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I +@@ -283,7 +283,10 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I this.cookTime = MathHelper.clamp(this.cookTime - 2, 0, this.cookTimeTotal); } } else { @@ -44,7 +21,7 @@ index 1d3c2dd93657fb5dc71ee6b444c585b54619d1e8..77ea56c5a25fe09a1721429d42965ad3 if (!this.isBurning() && this.canBurn(irecipe)) { // CraftBukkit start -@@ -597,4 +608,18 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I +@@ -609,4 +612,18 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I } } diff --git a/patches/server/0020-Optimize-TileEntity-load-unload.patch b/patches/server/0020-Optimize-TileEntity-load-unload.patch index 69d53a1d..82c56802 100644 --- a/patches/server/0020-Optimize-TileEntity-load-unload.patch +++ b/patches/server/0020-Optimize-TileEntity-load-unload.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize TileEntity load/unload diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 107d7ac761bfb7667dfab88b31712e2061a46258..95b9663e072991004904365cfc2ba11edb01de20 100644 +index 3bbfb0117187a26354fa58ec46eeb6e62845851e..ed2f75195d7a39882675af9ff0a7e8e7d208f906 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -42,8 +42,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { diff --git a/patches/server/0022-Redirect-Configs.patch b/patches/server/0022-Redirect-Configs.patch index ae7f011e..f6eff443 100644 --- a/patches/server/0022-Redirect-Configs.patch +++ b/patches/server/0022-Redirect-Configs.patch @@ -52,7 +52,7 @@ index 0a9f03526abf0638ada15d9810b949887fca9f9a..64b662dc9146d0d414a9668d9b93e07a this.setAllowFlight(dedicatedserverproperties.allowFlight); this.setResourcePack(dedicatedserverproperties.resourcePack, this.ba()); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index ce08abf2eabfdb606b806f4d6d374055f5e10168..b9d11f4ba9a49d955b487ccf5a6dac4e1c9ba19b 100644 +index e7818d40d9cac682eb28fadf319d08f8ca88e89d..605b7477dfce17c5d9752fd48a71098739e3f4c2 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -303,7 +303,7 @@ public class Main { diff --git a/patches/server/0025-Fix-lead-fall-dmg-config.patch b/patches/server/0025-Fix-lead-fall-dmg-config.patch index e8f5f600..f2c84219 100644 --- a/patches/server/0025-Fix-lead-fall-dmg-config.patch +++ b/patches/server/0025-Fix-lead-fall-dmg-config.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix lead fall dmg config diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index d224b1d0e224853e825486559938aed2c56c3981..0bca08dc6ffd367de7cffab0433900d6bfe555cf 100644 +index 1ece3e1e9e7a26f1ee07202916687f627c9e4c95..540bd5ccb01789d9130ea64a78dc125f94f94bb6 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1290,6 +1290,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1301,6 +1301,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); diff --git a/patches/server/0035-ProxyForwardDataEvent.patch b/patches/server/0035-ProxyForwardDataEvent.patch index 5bc6fa91..2cbaed4c 100644 --- a/patches/server/0035-ProxyForwardDataEvent.patch +++ b/patches/server/0035-ProxyForwardDataEvent.patch @@ -25,7 +25,7 @@ index 79f726ef43e70b8882890007146df199824d14e3..edb7a9de55718d9c860c82580aca78c3 { ChatMessage chatmessage = new ChatMessage("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!"); diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index d987483255195c0bde713a92676baced1eaff2b3..2fa0f21cfa81670f6c3f18f76e7fa8d0bb541f11 100644 +index d987483255195c0bde713a92676baced1eaff2b3..bb45fc83d81948c84bc721961474e5e806ab404a 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java @@ -125,6 +125,23 @@ public class LoginListener implements PacketLoginInListener { @@ -38,7 +38,7 @@ index d987483255195c0bde713a92676baced1eaff2b3..2fa0f21cfa81670f6c3f18f76e7fa8d0 + if (networkManager.spoofedProfile != null) { + properties = new java.util.ArrayList<>(Arrays.asList(networkManager.spoofedProfile)); + } else { -+ properties = new java.util.ArrayList<>(); ++ properties = java.util.Collections.emptyList(); + } + net.yatopia.api.event.ProxyForwardDataEvent event = new net.yatopia.api.event.ProxyForwardDataEvent( + !org.bukkit.Bukkit.isPrimaryThread(), uuid, i.getName(), properties diff --git a/patches/server/0037-Respect-PlayerKickEvent-leaveMessage.patch b/patches/server/0037-Respect-PlayerKickEvent-leaveMessage.patch index 2f638601..ce5ef26d 100644 --- a/patches/server/0037-Respect-PlayerKickEvent-leaveMessage.patch +++ b/patches/server/0037-Respect-PlayerKickEvent-leaveMessage.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Respect PlayerKickEvent leaveMessage diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 10139becc33a483a81858dcad2d07571e48ea43e..c258b5b1cc6d5f7fae49c311865e9506d0164c6a 100644 +index 9d058ddf875e660cb3bd5209e5ddbf1a7abbd04c..63bceb9f1695ce4db5b932ca627d944506b03c0d 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -323,7 +323,7 @@ public class PlayerConnection implements PacketListenerPlayIn { diff --git a/patches/server/0040-Optimize-whitelist-command-for-multiple-additions-re.patch b/patches/server/0040-Optimize-whitelist-command-for-multiple-additions-re.patch index 07157d6c..27ab1636 100644 --- a/patches/server/0040-Optimize-whitelist-command-for-multiple-additions-re.patch +++ b/patches/server/0040-Optimize-whitelist-command-for-multiple-additions-re.patch @@ -185,10 +185,10 @@ index 0224a6d0e47e836fa485b39e7b4ce5b83ea554bf..fe578d306575bbdc8ca4a993a648e889 return (String[]) this.d.keySet().toArray(new String[this.d.size()]); } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index e990a39d97cb1427dd2ce43bdc79fb84e93e9c4b..c7031706ea51dd6d8c22c10fab2ce3154daac361 100644 +index a342a13f387b4079bfc983d500a0fde534891196..156f350e8c4c3f9a8a59e4950e4bd03050dc3e62 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1969,6 +1969,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant -Date: Mon, 19 Oct 2020 15:56:47 +0300 -Subject: [PATCH] PaperPR: Fix harming potion dupe - - -diff --git a/src/main/java/net/minecraft/server/ItemPotion.java b/src/main/java/net/minecraft/server/ItemPotion.java -index 7862b63a245222d9a3d0896bdb2741b0e5e7ac40..04e48b195387410d9494ef87beba15e8d9e0419d 100644 ---- a/src/main/java/net/minecraft/server/ItemPotion.java -+++ b/src/main/java/net/minecraft/server/ItemPotion.java -@@ -22,6 +22,8 @@ public class ItemPotion extends Item { - CriterionTriggers.z.a((EntityPlayer) entityhuman, itemstack); - } - -+ List instantLater = new java.util.ArrayList<>(); // Yatopia -+ - if (!world.isClientSide) { - List list = PotionUtil.getEffects(itemstack); - Iterator iterator = list.iterator(); -@@ -30,7 +32,7 @@ public class ItemPotion extends Item { - MobEffect mobeffect = (MobEffect) iterator.next(); - - if (mobeffect.getMobEffect().isInstant()) { -- mobeffect.getMobEffect().applyInstantEffect(entityhuman, entityhuman, entityliving, mobeffect.getAmplifier(), 1.0D); -+ instantLater.add(mobeffect); // Yatopia - } else { - entityliving.addEffect(new MobEffect(mobeffect), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.POTION_DRINK); // CraftBukkit - } -@@ -44,7 +46,24 @@ public class ItemPotion extends Item { - } - } - -+ // Yatopia start - fix harming potion dupe -+ if (!world.isClientSide) { -+ int len = instantLater.size(); -+ while (len > 0) { -+ MobEffect mobeffect = instantLater.remove(0); -+ mobeffect.getMobEffect().applyInstantEffect(entityhuman, entityhuman, entityliving, mobeffect.getAmplifier(), 1.0D); -+ len--; -+ } -+ } -+ // Yatopia end -+ - if (entityhuman == null || !entityhuman.abilities.canInstantlyBuild) { -+ // Yatopia start - fix harming potion dupe -+ if (entityliving.getHealth() <= 0 && !(entityhuman != null && entityliving.world.getGameRules().getBoolean(GameRules.KEEP_INVENTORY))) { -+ entityliving.dropItem(new ItemStack(Items.GLASS_BOTTLE), 0); -+ return ItemStack.NULL_ITEM; -+ } -+ // Yatopia end - if (itemstack.isEmpty()) { - return new ItemStack(Items.GLASS_BOTTLE); - } diff --git a/patches/server/0052-lithium-PerlinNoiseSamplerMixin.patch b/patches/server/0051-lithium-PerlinNoiseSamplerMixin.patch similarity index 100% rename from patches/server/0052-lithium-PerlinNoiseSamplerMixin.patch rename to patches/server/0051-lithium-PerlinNoiseSamplerMixin.patch diff --git a/patches/server/0053-lithium-VoronoiBiomeAccessTypeMixin.patch b/patches/server/0052-lithium-VoronoiBiomeAccessTypeMixin.patch similarity index 100% rename from patches/server/0053-lithium-VoronoiBiomeAccessTypeMixin.patch rename to patches/server/0052-lithium-VoronoiBiomeAccessTypeMixin.patch diff --git a/patches/server/0054-lithium-NoiseChunkGeneratorMixin.patch b/patches/server/0053-lithium-NoiseChunkGeneratorMixin.patch similarity index 100% rename from patches/server/0054-lithium-NoiseChunkGeneratorMixin.patch rename to patches/server/0053-lithium-NoiseChunkGeneratorMixin.patch diff --git a/patches/server/0055-lithium-reduce-allocations.patch b/patches/server/0054-lithium-reduce-allocations.patch similarity index 100% rename from patches/server/0055-lithium-reduce-allocations.patch rename to patches/server/0054-lithium-reduce-allocations.patch diff --git a/patches/server/0056-Smarter-statistics-ticking.patch b/patches/server/0055-Smarter-statistics-ticking.patch similarity index 100% rename from patches/server/0056-Smarter-statistics-ticking.patch rename to patches/server/0055-Smarter-statistics-ticking.patch diff --git a/patches/server/0057-Configurable-criterion-triggers.patch b/patches/server/0056-Configurable-criterion-triggers.patch similarity index 100% rename from patches/server/0057-Configurable-criterion-triggers.patch rename to patches/server/0056-Configurable-criterion-triggers.patch diff --git a/patches/server/0058-Configurable-BlockPhysicsEvent.patch b/patches/server/0057-Configurable-BlockPhysicsEvent.patch similarity index 93% rename from patches/server/0058-Configurable-BlockPhysicsEvent.patch rename to patches/server/0057-Configurable-BlockPhysicsEvent.patch index fa3df713..377311be 100644 --- a/patches/server/0058-Configurable-BlockPhysicsEvent.patch +++ b/patches/server/0057-Configurable-BlockPhysicsEvent.patch @@ -8,10 +8,10 @@ Paper does alleviate this quite well by only firing if plugins are listening, bu This patch implements a hard toggle for the event. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c7031706ea51dd6d8c22c10fab2ce3154daac361..f4ca05cc77ae5ea47db51770f316413fdf8a728b 100644 +index 156f350e8c4c3f9a8a59e4950e4bd03050dc3e62..5bc6b4acb86fcc774d7d90308dc7e8d0f9c9ff77 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1412,7 +1412,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant methodProfiler; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index a69b38f293723a58691b2777d170f9cc146d1148..b746d1efbb06173e16a5b3a7f6bf0f3303a5ae05 100644 +index 8904b39db2203118fe3589133cb7e64334c20f33..d37c1e1f05b40ea672145478aa608a4002bc09bd 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -334,7 +334,7 @@ public class CraftWorld implements World { diff --git a/patches/server/0063-Configurable-enchanting-table-tick.patch b/patches/server/0062-Configurable-enchanting-table-tick.patch similarity index 100% rename from patches/server/0063-Configurable-enchanting-table-tick.patch rename to patches/server/0062-Configurable-enchanting-table-tick.patch diff --git a/patches/server/0064-Do-not-update-distance-map-when-animal-and-mob-spawn.patch b/patches/server/0063-Do-not-update-distance-map-when-animal-and-mob-spawn.patch similarity index 93% rename from patches/server/0064-Do-not-update-distance-map-when-animal-and-mob-spawn.patch rename to patches/server/0063-Do-not-update-distance-map-when-animal-and-mob-spawn.patch index 0c65d9eb..93eaea47 100644 --- a/patches/server/0064-Do-not-update-distance-map-when-animal-and-mob-spawn.patch +++ b/patches/server/0063-Do-not-update-distance-map-when-animal-and-mob-spawn.patch @@ -9,7 +9,7 @@ Licensed under Bukkit and CraftBukkit's original license, GPLv3 The following patch should be treated as it is licensed in GPLv3 diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 84429f12d0c6e0990b7cbb1b503b7868b3a02b14..f04a5a526748f913e885b673dda793e5bb16c1b7 100644 +index 12d9b73ccc2f4406957932397746cac7902d650e..a0d4a175720a2285dca2eaee96fc614104a76bcc 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -982,7 +982,7 @@ public class ChunkProviderServer extends IChunkProvider { diff --git a/patches/server/0064-Add-a-special-case-for-floodgate-and-offline-uuids.patch b/patches/server/0064-Add-a-special-case-for-floodgate-and-offline-uuids.patch new file mode 100644 index 00000000..061d1dcf --- /dev/null +++ b/patches/server/0064-Add-a-special-case-for-floodgate-and-offline-uuids.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ivan Pekov +Date: Tue, 29 Dec 2020 08:47:43 +0200 +Subject: [PATCH] Add a special case for floodgate and offline uuids + +floodgate spoofs uuids, but plugins such as luckperms get the uuid that the server uses, causing problems +if this option is configured properly, such things won't happen + +diff --git a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java +index 2d4fb0a4664578f8d5c23db854eb8f2764724940..00c600d74ba84cb564b9b22f53f279a93839d71f 100644 +--- a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java ++++ b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java +@@ -225,7 +225,16 @@ public class YatopiaConfig { + fixFallDistance = getBoolean("settings.fixFallDistance", false); + } + ++ public static boolean usingFloodgate = false; ++ private static void usingFloodgate() { ++ usingFloodgate = getBoolean("settings.using-floodgate", false); ++ } ++ + public static boolean shouldUseOfflineUUID() { ++ if (usingFloodgate) { ++ // never cuz floodgate spoofs an uuid ++ return false; ++ } + if (org.spigotmc.SpigotConfig.bungee && com.destroystokyo.paper.PaperConfig.bungeeOnlineMode) { + return false; + } diff --git a/patches/server/0065-PaperPR-Fix-username-connecting-with-no-texture-bein.patch b/patches/server/0065-PaperPR-Fix-username-connecting-with-no-texture-bein.patch new file mode 100644 index 00000000..c454176e --- /dev/null +++ b/patches/server/0065-PaperPR-Fix-username-connecting-with-no-texture-bein.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Camotoy <20743703+Camotoy@users.noreply.github.com> +Date: Mon, 4 Jan 2021 10:45:49 +0200 +Subject: [PATCH] PaperPR - Fix username connecting with no texture being + overwritten by usercache + + +diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java +index 8bda2180576d3c58ad592e6158621160a8c4c5cf..44132e902b653b07b21fd01d13a88870290af439 100644 +--- a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java ++++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java +@@ -166,9 +166,15 @@ public class CraftPlayerProfile implements PlayerProfile { + if ((profile.getName() == null || !hasTextures()) && profile.getId() != null) { + GameProfile profile = userCache.getProfile(this.profile.getId()); + if (profile != null) { ++ // Yatopia start - fix username connecting with no texture being overwritten by user cache ++ if (this.profile.getName() == null) { + // if old has it, assume its newer, so overwrite, else use cached if it was set and ours wasn't + copyProfileProperties(this.profile, profile); + this.profile = profile; ++ } else { ++ copyProfileProperties(profile, this.profile); ++ } ++ // Yatopia end + } + } + return this.profile.isComplete(); diff --git a/patches/server/0066-Optimised-hallowen-checker.patch b/patches/server/0066-Optimised-hallowen-checker.patch new file mode 100644 index 00000000..f5505bb5 --- /dev/null +++ b/patches/server/0066-Optimised-hallowen-checker.patch @@ -0,0 +1,144 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ivan Pekov +Date: Mon, 4 Jan 2021 20:12:36 +0200 +Subject: [PATCH] Optimised hallowen checker + + +diff --git a/src/main/java/net/minecraft/server/EntityBat.java b/src/main/java/net/minecraft/server/EntityBat.java +index 0a59e02d762a096cb3de62e0f8105cc5a5fab8d4..bdcbdc21f986852277dcc41a2b0f385f8caeb9f7 100644 +--- a/src/main/java/net/minecraft/server/EntityBat.java ++++ b/src/main/java/net/minecraft/server/EntityBat.java +@@ -222,11 +222,16 @@ public class EntityBat extends EntityAmbient { + } + + private static boolean eJ() { ++ // Yatopia start - optimised halloween checker ++ /* + LocalDate localdate = LocalDate.now(); + int i = localdate.get(ChronoField.DAY_OF_MONTH); + int j = localdate.get(ChronoField.MONTH_OF_YEAR); + + return j == 10 && i >= 20 || j == 11 && i <= 3; ++ */ ++ return org.yatopiamc.yatopia.server.entity.HalloweenChecker.isHalloweenSeason(); ++ // Yatopia end + } + + @Override +diff --git a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java +index f73304240a626f3f7d9355e6e5f2963a06c4bb7d..3ca3280d4a4d3cd8e0b4aff8431d8fe5904d23a4 100644 +--- a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java ++++ b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java +@@ -109,11 +109,15 @@ public abstract class EntitySkeletonAbstract extends EntityMonster implements IR + this.eL(); + this.setCanPickupLoot(this.world.paperConfig.skeletonsAlwaysCanPickUpLoot || this.random.nextFloat() < 0.55F * difficultydamagescaler.d()); // Paper + if (this.getEquipment(EnumItemSlot.HEAD).isEmpty()) { ++ /* // Yatopia start - optimised halloween checker + LocalDate localdate = LocalDate.now(); + int i = localdate.get(ChronoField.DAY_OF_MONTH); + int j = localdate.get(ChronoField.MONTH_OF_YEAR); + + if (j == 10 && i == 31 && this.random.nextFloat() < 0.25F) { ++ */ ++ if (org.yatopiamc.yatopia.server.entity.HalloweenChecker.isHalloweenDay() && this.random.nextFloat() < 0.25F) { ++ // Yatopia end + this.setSlot(EnumItemSlot.HEAD, new ItemStack(this.random.nextFloat() < 0.1F ? Blocks.JACK_O_LANTERN : Blocks.CARVED_PUMPKIN)); + this.dropChanceArmor[EnumItemSlot.HEAD.b()] = 0.0F; + } +diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java +index 752e39ad94ea9e8254853a3fda846be2bd436918..f470650838ab0e349a7ffc79fcb4b84460d32832 100644 +--- a/src/main/java/net/minecraft/server/EntityZombie.java ++++ b/src/main/java/net/minecraft/server/EntityZombie.java +@@ -472,11 +472,15 @@ public class EntityZombie extends EntityMonster { + } + + if (this.getEquipment(EnumItemSlot.HEAD).isEmpty()) { ++ /* // Yatopia start - optimised halloween checker + LocalDate localdate = LocalDate.now(); + int i = localdate.get(ChronoField.DAY_OF_MONTH); + int j = localdate.get(ChronoField.MONTH_OF_YEAR); + + if (j == 10 && i == 31 && this.random.nextFloat() < 0.25F) { ++ */ ++ if (org.yatopiamc.yatopia.server.entity.HalloweenChecker.isHalloweenDay() && this.random.nextFloat() < 0.25F) { ++ // Yatopia end + this.setSlot(EnumItemSlot.HEAD, new ItemStack(this.random.nextFloat() < 0.1F ? Blocks.JACK_O_LANTERN : Blocks.CARVED_PUMPKIN)); + this.dropChanceArmor[EnumItemSlot.HEAD.b()] = 0.0F; + } +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 0d23591fffcda1f8121e7bc7a6aa00d088b6e80b..7b326635aac5b1e7fb6e3933d133d7e181b7541c 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -1335,6 +1335,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant ++ * Checks whether or not it is halloween at a specific rate rather than every time when ++ * a entity is being spawned. ++ *

++ * The rate changes depending on how much TPS the server has. By default, the rate is every ++ * 2 hours, or every 144k ticks (if the server has _that_ much uptime) ++ * ++ * @author MrIvanPlays ++ */ ++public class HalloweenChecker { ++ ++ private static boolean halloweenSeason = false; ++ private static boolean halloweenDay = false; ++ ++ private static int delay = (20 * 60 * 60) * 2; ++ private static int lastCheckTick = -delay; ++ ++ public static void tick() { ++ if (MinecraftServer.currentTick % 100 == 0) { ++ // update the delay every 100 ticks ++ if (MinecraftServer.TPS >= 20) { ++ delay = (20 * 60 * 60) * 2; ++ } ++ if (MinecraftServer.TPS < 15) { ++ delay = delay + (20 * 60 * 15); ++ } ++ if (MinecraftServer.TPS < 10) { ++ delay = delay + (20 * 60 * 30); ++ } ++ } ++ if (MinecraftServer.currentTick - lastCheckTick > delay) { ++ LocalDate now = LocalDate.now(); ++ int day = now.getDayOfMonth(); ++ int month = now.get(ChronoField.MONTH_OF_YEAR); ++ ++ halloweenDay = (month == 10) && (day == 31); ++ halloweenSeason = ((month == 10) && (day >= 20)) || ((month == 11) && (day <= 3)); ++ ++ lastCheckTick = MinecraftServer.currentTick; ++ } ++ } ++ ++ public static boolean isHalloweenSeason() { ++ return halloweenSeason; ++ } ++ ++ public static boolean isHalloweenDay() { ++ return halloweenDay; ++ } ++ ++} diff --git a/patches/server/0067-Smol-entity-optimisations.patch b/patches/server/0067-Smol-entity-optimisations.patch new file mode 100644 index 00000000..895ba55a --- /dev/null +++ b/patches/server/0067-Smol-entity-optimisations.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ivan Pekov +Date: Mon, 4 Jan 2021 20:32:06 +0200 +Subject: [PATCH] Smol entity optimisations + + +diff --git a/src/main/java/net/minecraft/server/EntityBat.java b/src/main/java/net/minecraft/server/EntityBat.java +index bdcbdc21f986852277dcc41a2b0f385f8caeb9f7..dff2dc82c2a6b26c6e41b3949953abcaf379b20a 100644 +--- a/src/main/java/net/minecraft/server/EntityBat.java ++++ b/src/main/java/net/minecraft/server/EntityBat.java +@@ -208,7 +208,7 @@ public class EntityBat extends EntityAmbient { + if (blockposition.getY() >= generatoraccess.getSeaLevel()) { + return false; + } else { +- int i = generatoraccess.getLightLevel(blockposition); ++ //int i = generatoraccess.getLightLevel(blockposition); // Yatopia - moved down + byte b0 = 4; + + if (eJ()) { +@@ -217,6 +217,7 @@ public class EntityBat extends EntityAmbient { + return false; + } + ++ int i = generatoraccess.getLightLevel(blockposition); // Yatopia - moved from above + return i > random.nextInt(b0) ? false : a(entitytypes, generatoraccess, enummobspawn, blockposition, random); + } + }