From 839b53062faec1ec0c81123407efbda69ecd64cd Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Wed, 24 Nov 2021 09:58:26 -0800 Subject: [PATCH] a bunch more patches done --- .../api/Add-BlockFailedDispenseEvent.patch | 0 .../api/Add-EntityLoadCrossbowEvent.patch | 0 .../Added-PlayerLecternPageChangeEvent.patch | 0 .../Added-PlayerLoomPatternSelectEvent.patch | 0 .../Added-ServerResourcesReloadedEvent.patch | 0 .../api/Added-WorldGameRuleChangeEvent.patch | 0 patches/api/Annotation-Test-changes.patch | 23 +++++++++++++ .../server/Add-EntityLoadCrossbowEvent.patch | 0 ...-despawn-distances-for-living-entiti.patch | 2 +- .../Added-PlayerLecternPageChangeEvent.patch | 0 .../Added-PlayerLoomPatternSelectEvent.patch | 0 .../Added-ServerResourcesReloadedEvent.patch | 0 .../Added-WorldGameRuleChangeEvent.patch | 0 ...ld-settings-for-mobs-picking-up-loot.patch | 2 +- ...figurable-baby-zombie-movement-speed.patch | 2 +- ...actus-bamboo-and-reed-growth-heights.patch | 5 ++- ...onfigurable-door-breaking-difficulty.patch | 17 ++-------- .../Fix-nerfed-slime-when-splitting.patch | 0 .../server/Guardian-beam-workaround.patch | 0 ...Implemented-BlockFailedDispenseEvent.patch | 0 patches/server/Paper-config-files.patch | 6 ++++ .../api/Better-AnnotationTest-printout.patch | 33 ------------------- 22 files changed, 36 insertions(+), 54 deletions(-) rename patches/{unapplied => }/api/Add-BlockFailedDispenseEvent.patch (100%) rename patches/{unapplied => }/api/Add-EntityLoadCrossbowEvent.patch (100%) rename patches/{unapplied => }/api/Added-PlayerLecternPageChangeEvent.patch (100%) rename patches/{unapplied => }/api/Added-PlayerLoomPatternSelectEvent.patch (100%) rename patches/{unapplied => }/api/Added-ServerResourcesReloadedEvent.patch (100%) rename patches/{unapplied => }/api/Added-WorldGameRuleChangeEvent.patch (100%) rename patches/{unapplied => }/server/Add-EntityLoadCrossbowEvent.patch (100%) rename patches/{unapplied => }/server/Added-PlayerLecternPageChangeEvent.patch (100%) rename patches/{unapplied => }/server/Added-PlayerLoomPatternSelectEvent.patch (100%) rename patches/{unapplied => }/server/Added-ServerResourcesReloadedEvent.patch (100%) rename patches/{unapplied => }/server/Added-WorldGameRuleChangeEvent.patch (100%) rename patches/{unapplied => }/server/Added-world-settings-for-mobs-picking-up-loot.patch (96%) rename patches/{unapplied => }/server/Configurable-door-breaking-difficulty.patch (80%) rename patches/{unapplied => }/server/Fix-nerfed-slime-when-splitting.patch (100%) rename patches/{unapplied => }/server/Guardian-beam-workaround.patch (100%) rename patches/{unapplied => }/server/Implemented-BlockFailedDispenseEvent.patch (100%) delete mode 100644 patches/unapplied/api/Better-AnnotationTest-printout.patch diff --git a/patches/unapplied/api/Add-BlockFailedDispenseEvent.patch b/patches/api/Add-BlockFailedDispenseEvent.patch similarity index 100% rename from patches/unapplied/api/Add-BlockFailedDispenseEvent.patch rename to patches/api/Add-BlockFailedDispenseEvent.patch diff --git a/patches/unapplied/api/Add-EntityLoadCrossbowEvent.patch b/patches/api/Add-EntityLoadCrossbowEvent.patch similarity index 100% rename from patches/unapplied/api/Add-EntityLoadCrossbowEvent.patch rename to patches/api/Add-EntityLoadCrossbowEvent.patch diff --git a/patches/unapplied/api/Added-PlayerLecternPageChangeEvent.patch b/patches/api/Added-PlayerLecternPageChangeEvent.patch similarity index 100% rename from patches/unapplied/api/Added-PlayerLecternPageChangeEvent.patch rename to patches/api/Added-PlayerLecternPageChangeEvent.patch diff --git a/patches/unapplied/api/Added-PlayerLoomPatternSelectEvent.patch b/patches/api/Added-PlayerLoomPatternSelectEvent.patch similarity index 100% rename from patches/unapplied/api/Added-PlayerLoomPatternSelectEvent.patch rename to patches/api/Added-PlayerLoomPatternSelectEvent.patch diff --git a/patches/unapplied/api/Added-ServerResourcesReloadedEvent.patch b/patches/api/Added-ServerResourcesReloadedEvent.patch similarity index 100% rename from patches/unapplied/api/Added-ServerResourcesReloadedEvent.patch rename to patches/api/Added-ServerResourcesReloadedEvent.patch diff --git a/patches/unapplied/api/Added-WorldGameRuleChangeEvent.patch b/patches/api/Added-WorldGameRuleChangeEvent.patch similarity index 100% rename from patches/unapplied/api/Added-WorldGameRuleChangeEvent.patch rename to patches/api/Added-WorldGameRuleChangeEvent.patch diff --git a/patches/api/Annotation-Test-changes.patch b/patches/api/Annotation-Test-changes.patch index 0b7b0ede1b..b7607b3e65 100644 --- a/patches/api/Annotation-Test-changes.patch +++ b/patches/api/Annotation-Test-changes.patch @@ -71,6 +71,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ParameterNode paramNode = parameters == null ? null : parameters.get(i); String paramName = paramNode == null ? null : paramNode.name; +@@ -0,0 +0,0 @@ public class AnnotationTest { + + Collections.sort(errors); + +- System.out.println(errors.size() + " missing annotation(s):"); ++ StringBuilder builder = new StringBuilder() ++ .append("There ") ++ .append(errors.size() != 1 ? "are " : "is ") ++ .append(errors.size()) ++ .append(" missing annotation") ++ .append(errors.size() != 1 ? "s:\n" : ":\n"); ++ + for (String message : errors) { +- System.out.print("\t"); +- System.out.println(message); ++ builder.append("\t").append(message).append("\n"); + } + +- Assert.fail("There " + errors.size() + " are missing annotation(s)"); ++ Assert.fail(builder.toString()); + } + + private static void collectClasses(@NotNull File from, @NotNull Map to) throws IOException { @@ -0,0 +0,0 @@ public class AnnotationTest { private static boolean isMethodIncluded(@NotNull ClassNode clazz, @NotNull MethodNode method, @NotNull Map allClasses) { diff --git a/patches/unapplied/server/Add-EntityLoadCrossbowEvent.patch b/patches/server/Add-EntityLoadCrossbowEvent.patch similarity index 100% rename from patches/unapplied/server/Add-EntityLoadCrossbowEvent.patch rename to patches/server/Add-EntityLoadCrossbowEvent.patch diff --git a/patches/server/Add-configurable-despawn-distances-for-living-entiti.patch b/patches/server/Add-configurable-despawn-distances-for-living-entiti.patch index 36ef8db931..635d65c55f 100644 --- a/patches/server/Add-configurable-despawn-distances-for-living-entiti.patch +++ b/patches/server/Add-configurable-despawn-distances-for-living-entiti.patch @@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ package com.destroystokyo.paper; - import java.util.List; + import java.util.stream.Collectors; +import it.unimi.dsi.fastutil.objects.Reference2IntMap; +import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap; +import net.minecraft.world.entity.MobCategory; diff --git a/patches/unapplied/server/Added-PlayerLecternPageChangeEvent.patch b/patches/server/Added-PlayerLecternPageChangeEvent.patch similarity index 100% rename from patches/unapplied/server/Added-PlayerLecternPageChangeEvent.patch rename to patches/server/Added-PlayerLecternPageChangeEvent.patch diff --git a/patches/unapplied/server/Added-PlayerLoomPatternSelectEvent.patch b/patches/server/Added-PlayerLoomPatternSelectEvent.patch similarity index 100% rename from patches/unapplied/server/Added-PlayerLoomPatternSelectEvent.patch rename to patches/server/Added-PlayerLoomPatternSelectEvent.patch diff --git a/patches/unapplied/server/Added-ServerResourcesReloadedEvent.patch b/patches/server/Added-ServerResourcesReloadedEvent.patch similarity index 100% rename from patches/unapplied/server/Added-ServerResourcesReloadedEvent.patch rename to patches/server/Added-ServerResourcesReloadedEvent.patch diff --git a/patches/unapplied/server/Added-WorldGameRuleChangeEvent.patch b/patches/server/Added-WorldGameRuleChangeEvent.patch similarity index 100% rename from patches/unapplied/server/Added-WorldGameRuleChangeEvent.patch rename to patches/server/Added-WorldGameRuleChangeEvent.patch diff --git a/patches/unapplied/server/Added-world-settings-for-mobs-picking-up-loot.patch b/patches/server/Added-world-settings-for-mobs-picking-up-loot.patch similarity index 96% rename from patches/unapplied/server/Added-world-settings-for-mobs-picking-up-loot.patch rename to patches/server/Added-world-settings-for-mobs-picking-up-loot.patch index 210a3583c7..9e7f143a61 100644 --- a/patches/unapplied/server/Added-world-settings-for-mobs-picking-up-loot.patch +++ b/patches/server/Added-world-settings-for-mobs-picking-up-loot.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { - log("Creeper lingering effect: " + disableCreeperLingeringEffect); + phantomOnlyAttackInsomniacs = getBoolean("phantoms-only-attack-insomniacs", phantomOnlyAttackInsomniacs); } + public boolean zombiesAlwaysCanPickUpLoot; diff --git a/patches/server/Configurable-baby-zombie-movement-speed.patch b/patches/server/Configurable-baby-zombie-movement-speed.patch index 940dc0716b..dbf57d9c10 100644 --- a/patches/server/Configurable-baby-zombie-movement-speed.patch +++ b/patches/server/Configurable-baby-zombie-movement-speed.patch @@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { + bambooMinHeight = getInt("max-growth-height.bamboo.min", 11); log("Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight + ". Max height for bamboo growth " + bambooMaxHeight + ". Min height for fully-grown bamboo " + bambooMinHeight + "."); - } + + public double babyZombieMovementModifier; diff --git a/patches/server/Configurable-cactus-bamboo-and-reed-growth-heights.patch b/patches/server/Configurable-cactus-bamboo-and-reed-growth-heights.patch index 075227e7a2..6322bafee3 100644 --- a/patches/server/Configurable-cactus-bamboo-and-reed-growth-heights.patch +++ b/patches/server/Configurable-cactus-bamboo-and-reed-growth-heights.patch @@ -11,8 +11,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { - config.addDefault("world-settings.default." + path, def); - return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path)); + config.addDefault("world-settings.default." + path, def.stream().map(Enum::name).collect(Collectors.toList())); + return ((List) (config.getList("world-settings." + worldName + "." + path, config.getList("world-settings.default." + path)))).stream().map(s -> Enum.valueOf(type, s)).collect(Collectors.toList()); } + + public int cactusMaxHeight; @@ -25,7 +25,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + bambooMaxHeight = getInt("max-growth-height.bamboo.max", 16); + bambooMinHeight = getInt("max-growth-height.bamboo.min", 11); + log("Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight + ". Max height for bamboo growth " + bambooMaxHeight + ". Min height for fully-grown bamboo " + bambooMinHeight + "."); -+ + } } diff --git a/src/main/java/net/minecraft/world/level/block/BambooBlock.java b/src/main/java/net/minecraft/world/level/block/BambooBlock.java diff --git a/patches/unapplied/server/Configurable-door-breaking-difficulty.patch b/patches/server/Configurable-door-breaking-difficulty.patch similarity index 80% rename from patches/unapplied/server/Configurable-door-breaking-difficulty.patch rename to patches/server/Configurable-door-breaking-difficulty.patch index a9d9815603..ba37a8e9a3 100644 --- a/patches/unapplied/server/Configurable-door-breaking-difficulty.patch +++ b/patches/server/Configurable-door-breaking-difficulty.patch @@ -8,17 +8,16 @@ diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/m index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -0,0 +0,0 @@ import java.util.List; +@@ -0,0 +0,0 @@ import java.util.stream.Collectors; import it.unimi.dsi.fastutil.objects.Reference2IntMap; import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap; import net.minecraft.world.entity.MobCategory; -+import java.util.stream.Collectors; +import net.minecraft.world.Difficulty; +import net.minecraft.world.entity.monster.Vindicator; +import net.minecraft.world.entity.monster.Zombie; - import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray.EngineMode; import org.bukkit.Bukkit; import org.bukkit.configuration.file.YamlConfiguration; + import org.spigotmc.SpigotWorldConfig; @@ -0,0 +0,0 @@ public class PaperWorldConfig { disableMobSpawnerSpawnEggTransformation = getBoolean("game-mechanics.disable-mob-spawner-spawn-egg-transformation", disableMobSpawnerSpawnEggTransformation); } @@ -45,18 +44,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public short keepLoadedRange; private void keepLoadedRange() { keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); -@@ -0,0 +0,0 @@ public class PaperWorldConfig { - return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path)); - } - -+ private > List getEnumList(String path, List def, Class type) { -+ config.addDefault("world-settings.default." + path, def.stream().map(Enum::name).collect(Collectors.toList())); -+ return ((List) (config.getList("world-settings." + worldName + "." + path, config.getList("world-settings.default." + path)))).stream().map(s -> Enum.valueOf(type, s)).collect(Collectors.toList()); -+ } -+ - public int cactusMaxHeight; - public int reedMaxHeight; - public int bambooMaxHeight; diff --git a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java diff --git a/patches/unapplied/server/Fix-nerfed-slime-when-splitting.patch b/patches/server/Fix-nerfed-slime-when-splitting.patch similarity index 100% rename from patches/unapplied/server/Fix-nerfed-slime-when-splitting.patch rename to patches/server/Fix-nerfed-slime-when-splitting.patch diff --git a/patches/unapplied/server/Guardian-beam-workaround.patch b/patches/server/Guardian-beam-workaround.patch similarity index 100% rename from patches/unapplied/server/Guardian-beam-workaround.patch rename to patches/server/Guardian-beam-workaround.patch diff --git a/patches/unapplied/server/Implemented-BlockFailedDispenseEvent.patch b/patches/server/Implemented-BlockFailedDispenseEvent.patch similarity index 100% rename from patches/unapplied/server/Implemented-BlockFailedDispenseEvent.patch rename to patches/server/Implemented-BlockFailedDispenseEvent.patch diff --git a/patches/server/Paper-config-files.patch b/patches/server/Paper-config-files.patch index 64f4f1a2a4..59d90990d4 100644 --- a/patches/server/Paper-config-files.patch +++ b/patches/server/Paper-config-files.patch @@ -500,6 +500,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import java.util.List; + ++import java.util.stream.Collectors; +import org.bukkit.Bukkit; +import org.bukkit.configuration.file.YamlConfiguration; +import org.spigotmc.SpigotWorldConfig; @@ -583,6 +584,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + config.addDefault("world-settings.default." + path, def); + return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path)); + } ++ ++ private > List getEnumList(String path, List def, Class type) { ++ config.addDefault("world-settings.default." + path, def.stream().map(Enum::name).collect(Collectors.toList())); ++ return ((List) (config.getList("world-settings." + worldName + "." + path, config.getList("world-settings.default." + path)))).stream().map(s -> Enum.valueOf(type, s)).collect(Collectors.toList()); ++ } +} diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/patches/unapplied/api/Better-AnnotationTest-printout.patch b/patches/unapplied/api/Better-AnnotationTest-printout.patch deleted file mode 100644 index de65d3c1e4..0000000000 --- a/patches/unapplied/api/Better-AnnotationTest-printout.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 3 Dec 2020 14:04:57 -0800 -Subject: [PATCH] Better AnnotationTest printout - - -diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/test/java/org/bukkit/AnnotationTest.java -+++ b/src/test/java/org/bukkit/AnnotationTest.java -@@ -0,0 +0,0 @@ public class AnnotationTest { - - Collections.sort(errors); - -- System.out.println(errors.size() + " missing annotation(s):"); -+ StringBuilder builder = new StringBuilder() -+ .append("There ") -+ .append(errors.size() != 1 ? "are " : "is ") -+ .append(errors.size()) -+ .append(" missing annotation") -+ .append(errors.size() != 1 ? "s:\n" : ":\n"); -+ - for (String message : errors) { -- System.out.print("\t"); -- System.out.println(message); -+ builder.append("\t").append(message).append("\n"); - } - -- Assert.fail("There " + errors.size() + " are missing annotation(s)"); -+ Assert.fail(builder.toString()); - } - - private static void collectClasses(@NotNull File from, @NotNull Map to) throws IOException {