From 34bef7d1bd200617195d2b487b66cb13c975d558 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Tue, 26 Jan 2021 18:53:44 -0500 Subject: [PATCH] Updated Upstream and Sidestream(s) (Tuinity/AirplaneLite/Purpur) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Tuinity Changes: 06ce05b Fix broken chunk loading while under high block update stress AirplaneLite Changes: 1b05468 Always reset comment list adbefaa DEAR merged! (fix comment) 6e86873 Merge branch 'perf/activation-ranges' 12c221c Merge pull request #2 from Encode42/master 6095a90 Fix webhook build status 9ec74d9 Fix compile error b0adfa5 Hoglin support 829a3a2 Rebuild patches 553e5c4 Merge branch 'master' into perf/activation-ranges 95fb8ac Merge branch 'master' into perf/activation-ranges 4444971 ok 767e9e1 DEAR for piglins ce074ea Merge branch 'master' into perf/activation-ranges f12fce4 lower bound on activation prio d9962ce Add villager dynamic EAR ticking 10929cc Spelling 21d241c Merge branch 'master' into perf/activation-ranges 8f0039a Add configuration to activation ranges c758dfa Merge branch 'master' into perf/activation-ranges 17605f8 Raise lowest tick amount to 1s 1b604ca Fix Paper inactive tick, finish our range impl 72f27b7 Merge master dafa5a9 Merge branch 'master' into perf/activation-ranges 55c051f Tuning, still needs config 089d995 First pass at dynamic activation range Purpur Changes: d72b228 Updated Upstream (Paper & Tuinity) --- PATCHES.md | 2 + .../server/0002-Airplane-Configuration.patch | 286 ++++++++++++++++++ ...treams.patch => 0003-Remove-streams.patch} | 0 ...ing-for-EntityLiving-hasLineOfSight.patch} | 0 ...elessRecipes-comparison-for-Vanilla.patch} | 0 ...006-Queue-lighting-update-only-once.patch} | 0 ...odifiableMap-instead-of-making-copy.patch} | 0 ...priority-of-checks-in-chunk-ticking.patch} | 0 ...009-Reduce-projectile-chunk-loading.patch} | 0 ...imize-random-calls-in-chunk-ticking.patch} | 0 ...-get-entity-equipment-if-not-needed.patch} | 0 ...irplaneLite-Dynamic-activation-range.patch | 208 +++++++++++++ .../server/0006-Yatopia-configuration.patch | 6 +- .../0014-lithium-MixinGoalSelector.patch | 2 +- patches/server/0021-Redirect-Configs.patch | 4 +- .../0024-Fix-lead-fall-dmg-config.patch | 4 +- patches/server/0042-Add-nspt-command.patch | 4 +- upstream/Purpur | 2 +- upstreamCommits/Purpur | 2 +- upstreamConfig/0003-AirplaneLite.properties | 2 +- 20 files changed, 509 insertions(+), 13 deletions(-) create mode 100644 patches/AirplaneLite/patches/server/0002-Airplane-Configuration.patch rename patches/AirplaneLite/patches/server/{0002-Remove-streams.patch => 0003-Remove-streams.patch} (100%) rename patches/AirplaneLite/patches/server/{0003-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch => 0004-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch} (100%) rename patches/AirplaneLite/patches/server/{0004-Simpler-ShapelessRecipes-comparison-for-Vanilla.patch => 0005-Simpler-ShapelessRecipes-comparison-for-Vanilla.patch} (100%) rename patches/AirplaneLite/patches/server/{0005-Queue-lighting-update-only-once.patch => 0006-Queue-lighting-update-only-once.patch} (100%) rename patches/AirplaneLite/patches/server/{0006-Use-unmodifiableMap-instead-of-making-copy.patch => 0007-Use-unmodifiableMap-instead-of-making-copy.patch} (100%) rename patches/AirplaneLite/patches/server/{0007-Swap-priority-of-checks-in-chunk-ticking.patch => 0008-Swap-priority-of-checks-in-chunk-ticking.patch} (100%) rename patches/AirplaneLite/patches/server/{0008-Reduce-projectile-chunk-loading.patch => 0009-Reduce-projectile-chunk-loading.patch} (100%) rename patches/AirplaneLite/patches/server/{0009-Optimize-random-calls-in-chunk-ticking.patch => 0010-Optimize-random-calls-in-chunk-ticking.patch} (100%) rename patches/AirplaneLite/patches/server/{0010-Don-t-get-entity-equipment-if-not-needed.patch => 0011-Don-t-get-entity-equipment-if-not-needed.patch} (100%) create mode 100644 patches/AirplaneLite/patches/server/0012-AirplaneLite-Dynamic-activation-range.patch diff --git a/PATCHES.md b/PATCHES.md index 999a2fa37..21cbb728a 100644 --- a/PATCHES.md +++ b/PATCHES.md @@ -8,6 +8,7 @@ This is an overview over all patches that are currently used. | Side | Patch | Author | CoAuthors | | ----- | ------------- |:-------------:| -----:| +| server | (AirplaneLite) Dynamic activation range | Paul Sauve | | | server | AFK API | William Blake Galbreath | | | api | AFK API | William Blake Galbreath | | | server | Ability to re-add farmland mechanics from Alpha | Yive | | @@ -67,6 +68,7 @@ This is an overview over all patches that are currently used. | server | Add wither skeleton takes wither damage option | William Blake Galbreath | | | server | Advancement API | William Blake Galbreath | | | api | Advancement API | William Blake Galbreath | | +| server | Airplane Configuration | Paul Sauve | | | server | AirplaneLite MC Dev Fixes | Paul Sauve | | | server | Allow Entities to be removed from a world while ticking | Spottedleaf | | | server | Allow anvil colors | William Blake Galbreath | | diff --git a/patches/AirplaneLite/patches/server/0002-Airplane-Configuration.patch b/patches/AirplaneLite/patches/server/0002-Airplane-Configuration.patch new file mode 100644 index 000000000..d75d7bc9f --- /dev/null +++ b/patches/AirplaneLite/patches/server/0002-Airplane-Configuration.patch @@ -0,0 +1,286 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Paul Sauve +Date: Wed, 20 Jan 2021 13:08:53 -0600 +Subject: [PATCH] Airplane Configuration + + +diff --git a/src/main/java/gg/airplane/AirplaneConfig.java b/src/main/java/gg/airplane/AirplaneConfig.java +new file mode 100644 +index 0000000000000000000000000000000000000000..4feb9686f45ce4ae9f474447496b8e0f6fcb7e31 +--- /dev/null ++++ b/src/main/java/gg/airplane/AirplaneConfig.java +@@ -0,0 +1,46 @@ ++package gg.airplane; ++ ++import gg.airplane.manual.ManualParser; ++import net.minecraft.server.MinecraftServer; ++import org.apache.logging.log4j.Level; ++ ++import java.io.File; ++import java.io.IOException; ++import java.lang.reflect.Method; ++import java.lang.reflect.Modifier; ++ ++public class AirplaneConfig { ++ ++ private static ManualParser manual; ++ ++ public static void load() { ++ try { ++ manual = new ManualParser(new File("airplane.air")); ++ } catch (IOException e) { ++ e.printStackTrace(); ++ } ++ ++ manual.get("info.version", "1.0"); ++ manual.setComment("info", ++ " Airplane Configuration", ++ " Please see https://airplane.gg/config for help."); ++ ++ for (Method method : AirplaneConfig.class.getDeclaredMethods()) { ++ if (Modifier.isStatic(method.getModifiers()) && Modifier.isPrivate(method.getModifiers())) { ++ method.setAccessible(true); ++ try { ++ method.invoke(null); ++ } catch (Throwable t) { ++ MinecraftServer.LOGGER.log(Level.WARN, "Failed to load configuration option from " + method.getName(), t); ++ } ++ } ++ } ++ ++ try { ++ manual.save(); ++ } catch (IOException e) { ++ e.printStackTrace(); ++ } ++ } ++ ++} +diff --git a/src/main/java/gg/airplane/manual/ManualParser.java b/src/main/java/gg/airplane/manual/ManualParser.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ace29adb0f140d99a8d85ac824654beded4bf5b8 +--- /dev/null ++++ b/src/main/java/gg/airplane/manual/ManualParser.java +@@ -0,0 +1,210 @@ ++package gg.airplane.manual; ++ ++import java.io.BufferedReader; ++import java.io.BufferedWriter; ++import java.io.File; ++import java.io.FileReader; ++import java.io.FileWriter; ++import java.io.IOException; ++import java.util.ArrayList; ++import java.util.Arrays; ++import java.util.LinkedHashMap; ++import java.util.List; ++import java.util.Map; ++import java.util.TreeMap; ++ ++// todo make this cleaner and more ergonomic to use ++// also probably needs lists eventually ++public class ManualParser { ++ ++ private final File file; ++ private final Map sections = new LinkedHashMap<>(); ++ ++ private static class ManualObject { ++ public final String key; ++ public final List comments; ++ ++ private ManualObject(String key, List comments) { ++ this.key = key; ++ this.comments = comments == null ? new ArrayList<>() : comments; ++ } ++ } ++ ++ private static class Section extends ManualObject { ++ public final Map values; ++ ++ private Section(String key, List comments) { ++ super(key, comments); ++ this.values = new LinkedHashMap<>(); ++ } ++ ++ public void add(String key, Value value) { ++ this.values.put(key, value); ++ value.parent = this; ++ } ++ ++ public Value get(String key) { ++ return this.values.computeIfAbsent(key, k -> { ++ Value value = new Value(k, null, null); ++ value.parent = this; ++ return value; ++ }); ++ } ++ } ++ ++ private static class Value extends ManualObject { ++ public Object value; ++ public Section parent; ++ ++ private Value(String key, Object value, List comments) { ++ super(key, comments); ++ this.value = value; ++ } ++ } ++ ++ public ManualParser(File file) throws IOException { ++ this.file = file; ++ ++ if (!file.exists()) { ++ return; ++ } ++ ++ try (BufferedReader reader = new BufferedReader(new FileReader(file))) { ++ Section currentSection = null; ++ List currentComment = new ArrayList<>(); ++ ++ String line; ++ while ((line = reader.readLine()) != null) { ++ line = line.trim(); ++ ++ if (line.length() == 0) { ++ continue; // empty line ++ } ++ ++ if (line.startsWith("#")) { ++ currentComment.add(line.substring(1).trim()); ++ } else if (line.startsWith("[")) { ++ if (!line.endsWith("]")) { ++ throw new IllegalArgumentException("Invalid configuration, section '" + line + "' does not end with ]"); ++ } ++ if (line.length() < 3) { ++ throw new IllegalArgumentException("Invalid configuration, section '" + line + "' does not have a name"); ++ } ++ String sectionName = line.substring(1, line.length() - 1); ++ Section newSection = new Section(sectionName, currentComment); ++ currentComment = new ArrayList<>(); ++ currentSection = newSection; ++ this.sections.put(sectionName, newSection); ++ } else { ++ if (currentSection == null) { ++ throw new IllegalArgumentException("Invalid configuration, found value outside of section " + line); ++ } ++ int equals = line.indexOf("="); ++ if (equals <= 1 || equals == line.length() - 1) { ++ throw new IllegalArgumentException("Invalid configuration, assignment invalid " + line); ++ } ++ ++ String key = line.substring(0, equals).trim(); ++ ++ String value = line.substring(equals + 1).trim(); ++ if (value.length() == 0) { ++ throw new IllegalArgumentException("Invalid configuration, value does not exist " + line); ++ } ++ if (value.startsWith("\"")) { ++ if (!value.endsWith("\"")) { ++ throw new IllegalArgumentException("Invalid configuration, value has no ending quote " + line); ++ } ++ String stringValue = value.substring(1, value.length() - 1); ++ currentSection.add(key, new Value(key, stringValue, currentComment)); ++ } else if (Character.isDigit(value.charAt(0))) { ++ if (value.contains(".")) { ++ double doubleValue = Double.parseDouble(value); ++ currentSection.add(key, new Value(key, doubleValue, currentComment)); ++ } else { ++ int intValue = Integer.parseInt(value); ++ currentSection.add(key, new Value(key, intValue, currentComment)); ++ } ++ } else if (value.equals("true") || value.equals("false")) { ++ boolean boolValue = Boolean.parseBoolean(value); ++ currentSection.add(key, new Value(key, boolValue, currentComment)); ++ } else { ++ throw new IllegalArgumentException("Invalid configuration, unknown type for " + line); ++ } ++ currentComment = new ArrayList<>(); ++ } ++ } ++ } ++ } ++ ++ public void save() throws IOException { ++ try (BufferedWriter writer = new BufferedWriter(new FileWriter(this.file))) { ++ for (Map.Entry entry : this.sections.entrySet()) { ++ Section section = entry.getValue(); ++ if (section.comments != null) { ++ for (String comment : section.comments) { ++ writer.write("# " + comment + "\n"); ++ } ++ } ++ writer.write("[" + section.key + "]" + "\n"); ++ for (Value value : section.values.values()) { ++ if (value.comments != null) { ++ for (String comment : value.comments) { ++ writer.write(" # " + comment + "\n"); ++ } ++ } ++ writer.write(" " + value.key + " = " + serialize(value.value) + "\n"); ++ } ++ writer.write("\n"); ++ } ++ } ++ } ++ ++ private ManualObject getObject(String key) { ++ String[] split = key.split("\\.", 2); ++ if (split.length == 1) { ++ return this.sections.computeIfAbsent(key, k -> new Section(k, null)); ++ } ++ return this.sections.computeIfAbsent(split[0], k -> new Section(k, null)).get(split[1]); ++ } ++ ++ public void setComment(String key, String... comment) { ++ ManualObject object = this.getObject(key); ++ object.comments.clear(); ++ object.comments.addAll(Arrays.asList(comment)); ++ } ++ ++ public T get(String key, T defaultValue, String... comment) { ++ String[] split = key.split("\\.", 2); ++ if (split.length == 1) { ++ throw new IllegalArgumentException("Key " + key + " does not include section"); ++ } ++ Section section = this.sections.computeIfAbsent(split[0], k -> new Section(k, null)); ++ if (!section.values.containsKey(split[1])) { ++ Value value = section.get(split[1]); ++ value.value = defaultValue; ++ value.comments.addAll(Arrays.asList(comment)); ++ return defaultValue; ++ } ++ Value value = section.get(split[1]); ++ if (value.comments.isEmpty()) { ++ value.comments.addAll(Arrays.asList(comment)); ++ } ++ return (T) value.value; ++ } ++ ++ public void set(String key, Object value) { ++ ManualObject object = getObject(key); ++ if (!(object instanceof Value)) { ++ throw new IllegalArgumentException("Invalid key for value " + key); ++ } ++ ((Value) object).value = value; ++ } ++ ++ private String serialize(Object object) { ++ if (object instanceof String) { ++ return "\"" + object + "\""; ++ } ++ return String.valueOf(object); ++ } ++ ++} +diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java +index 3ee8d31c453105eca7b96bede39a9ebbf40e1c2c..ca3d9dbcbeeb5059a942cae1a5020f0bcc59ac9c 100644 +--- a/src/main/java/net/minecraft/server/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/DedicatedServer.java +@@ -179,6 +179,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now + // Paper end + com.tuinity.tuinity.config.TuinityConfig.init((java.io.File) options.valueOf("tuinity-settings")); // Tuinity - Server Config ++ gg.airplane.AirplaneConfig.load(); // Airplane - config + + this.setPVP(dedicatedserverproperties.pvp); + this.setAllowFlight(dedicatedserverproperties.allowFlight); diff --git a/patches/AirplaneLite/patches/server/0002-Remove-streams.patch b/patches/AirplaneLite/patches/server/0003-Remove-streams.patch similarity index 100% rename from patches/AirplaneLite/patches/server/0002-Remove-streams.patch rename to patches/AirplaneLite/patches/server/0003-Remove-streams.patch diff --git a/patches/AirplaneLite/patches/server/0003-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch b/patches/AirplaneLite/patches/server/0004-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch similarity index 100% rename from patches/AirplaneLite/patches/server/0003-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch rename to patches/AirplaneLite/patches/server/0004-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch diff --git a/patches/AirplaneLite/patches/server/0004-Simpler-ShapelessRecipes-comparison-for-Vanilla.patch b/patches/AirplaneLite/patches/server/0005-Simpler-ShapelessRecipes-comparison-for-Vanilla.patch similarity index 100% rename from patches/AirplaneLite/patches/server/0004-Simpler-ShapelessRecipes-comparison-for-Vanilla.patch rename to patches/AirplaneLite/patches/server/0005-Simpler-ShapelessRecipes-comparison-for-Vanilla.patch diff --git a/patches/AirplaneLite/patches/server/0005-Queue-lighting-update-only-once.patch b/patches/AirplaneLite/patches/server/0006-Queue-lighting-update-only-once.patch similarity index 100% rename from patches/AirplaneLite/patches/server/0005-Queue-lighting-update-only-once.patch rename to patches/AirplaneLite/patches/server/0006-Queue-lighting-update-only-once.patch diff --git a/patches/AirplaneLite/patches/server/0006-Use-unmodifiableMap-instead-of-making-copy.patch b/patches/AirplaneLite/patches/server/0007-Use-unmodifiableMap-instead-of-making-copy.patch similarity index 100% rename from patches/AirplaneLite/patches/server/0006-Use-unmodifiableMap-instead-of-making-copy.patch rename to patches/AirplaneLite/patches/server/0007-Use-unmodifiableMap-instead-of-making-copy.patch diff --git a/patches/AirplaneLite/patches/server/0007-Swap-priority-of-checks-in-chunk-ticking.patch b/patches/AirplaneLite/patches/server/0008-Swap-priority-of-checks-in-chunk-ticking.patch similarity index 100% rename from patches/AirplaneLite/patches/server/0007-Swap-priority-of-checks-in-chunk-ticking.patch rename to patches/AirplaneLite/patches/server/0008-Swap-priority-of-checks-in-chunk-ticking.patch diff --git a/patches/AirplaneLite/patches/server/0008-Reduce-projectile-chunk-loading.patch b/patches/AirplaneLite/patches/server/0009-Reduce-projectile-chunk-loading.patch similarity index 100% rename from patches/AirplaneLite/patches/server/0008-Reduce-projectile-chunk-loading.patch rename to patches/AirplaneLite/patches/server/0009-Reduce-projectile-chunk-loading.patch diff --git a/patches/AirplaneLite/patches/server/0009-Optimize-random-calls-in-chunk-ticking.patch b/patches/AirplaneLite/patches/server/0010-Optimize-random-calls-in-chunk-ticking.patch similarity index 100% rename from patches/AirplaneLite/patches/server/0009-Optimize-random-calls-in-chunk-ticking.patch rename to patches/AirplaneLite/patches/server/0010-Optimize-random-calls-in-chunk-ticking.patch diff --git a/patches/AirplaneLite/patches/server/0010-Don-t-get-entity-equipment-if-not-needed.patch b/patches/AirplaneLite/patches/server/0011-Don-t-get-entity-equipment-if-not-needed.patch similarity index 100% rename from patches/AirplaneLite/patches/server/0010-Don-t-get-entity-equipment-if-not-needed.patch rename to patches/AirplaneLite/patches/server/0011-Don-t-get-entity-equipment-if-not-needed.patch diff --git a/patches/AirplaneLite/patches/server/0012-AirplaneLite-Dynamic-activation-range.patch b/patches/AirplaneLite/patches/server/0012-AirplaneLite-Dynamic-activation-range.patch new file mode 100644 index 000000000..511f9babb --- /dev/null +++ b/patches/AirplaneLite/patches/server/0012-AirplaneLite-Dynamic-activation-range.patch @@ -0,0 +1,208 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Paul Sauve +Date: Fri, 15 Jan 2021 19:05:01 -0600 +Subject: [PATCH] (AirplaneLite) Dynamic activation range + +This replaces the current method of ticking an inactive entity's +pathfinder 1/4 times with a new method that's dynamic based off how far +away it is from a player. If an entity is within 32 blocks, it gets +ticked every tick. If it's within 45 blocks, it gets ticked every other +tick. If it's within 55 blocks, it gets ticked once every three ticks. + +todo use with actual entity ticking, not just inactive. + +diff --git a/src/main/java/gg/airplane/AirplaneConfig.java b/src/main/java/gg/airplane/AirplaneConfig.java +index 4feb9686f45ce4ae9f474447496b8e0f6fcb7e31..a5af04f8b549a5d1ff5b6bc2d46ce0e2640e5b48 100644 +--- a/src/main/java/gg/airplane/AirplaneConfig.java ++++ b/src/main/java/gg/airplane/AirplaneConfig.java +@@ -43,4 +43,27 @@ public class AirplaneConfig { + } + } + ++ ++ public static int maximumActivationPrio = 20; ++ public static int activationDistanceMod = 9; ++ public static boolean dynamicPiglinBehavior = true; ++ public static boolean dynamicHoglinBehavior = true; ++ ++ private static void dynamicActivationRange() { ++ manual.setComment("activation-range", "Optimizes how entities act when", "they're far away from the player"); ++ ++ maximumActivationPrio = manual.get("activation-range.max-tick-freq", maximumActivationPrio, ++ "This value defines how often in ticks, the furthest entity", ++ "will get their pathfinders and behaviors ticked. 20 = 1s"); ++ activationDistanceMod = manual.get("activation-range.activation-dist-mod", activationDistanceMod, ++ "This value defines how much distance modifies an entity's", ++ "tick frequency. freq = (distanceToPlayer^2) / (2^value)", ++ "If you want further away entities to tick less often, use 8.", ++ "If you want further away entities to tick more often, try 10."); ++ ++ manual.setComment("behavior-activation", "A list of entities to use the dynamic activation range", "to modify how often their behaviors are ticked"); ++ dynamicPiglinBehavior = manual.get("behavior-activation.piglin", dynamicPiglinBehavior); ++ dynamicHoglinBehavior = manual.get("behavior-activation.hoglin", dynamicHoglinBehavior); ++ } ++ + } +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index 63eb29635957d4e6ce1274ee17a59af62d442d4e..af7651499391a8b4a5b83cb158846647ce3dc5aa 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -197,6 +197,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + public void inactiveTick() { } + // Spigot end + public boolean shouldBeRemoved; // Paper ++ // AirplaneL start ++ public int activatedPriority = gg.airplane.AirplaneConfig.maximumActivationPrio; // golf score ++ // AirplaneL end + + public float getBukkitYaw() { + return this.yaw; +diff --git a/src/main/java/net/minecraft/server/EntityHoglin.java b/src/main/java/net/minecraft/server/EntityHoglin.java +index 4a3469aca9f9e47d2ea3f3bae6ce77f5f11d6b50..5af5b50889961b10e812598dbea657c4e2aeceeb 100644 +--- a/src/main/java/net/minecraft/server/EntityHoglin.java ++++ b/src/main/java/net/minecraft/server/EntityHoglin.java +@@ -102,13 +102,18 @@ public class EntityHoglin extends EntityAnimal implements IMonster, IOglin { + return (BehaviorController) super.getBehaviorController(); // Purpur - decompile error + } + ++ private int behaviorTick; // Airplane + @Override + protected void mobTick() { ++ // Airplane - dynamic tick ++ if (!gg.airplane.AirplaneConfig.dynamicHoglinBehavior || this.behaviorTick++ % this.activatedPriority == 0) { + this.world.getMethodProfiler().enter("hoglinBrain"); + if (getRider() == null) // Purpur - only use brain if no rider + this.getBehaviorController().a((WorldServer) this.world, this); // Purpur - decompile error + this.world.getMethodProfiler().exit(); + HoglinAI.a(this); ++ } ++ // Airplane end + if (this.isConverting()) { + ++this.conversionTicks; + if (this.conversionTicks > 300) { +diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +index b9c537104bfdc0bca0ad387c073650da169b871a..400edac98e03afe9dc6dfeab98fc8cc9e8200ac7 100644 +--- a/src/main/java/net/minecraft/server/EntityInsentient.java ++++ b/src/main/java/net/minecraft/server/EntityInsentient.java +@@ -132,10 +132,10 @@ public abstract class EntityInsentient extends EntityLiving { + @Override + public void inactiveTick() { + super.inactiveTick(); +- if (this.goalSelector.inactiveTick()) { ++ if (this.goalSelector.inactiveTick(this.activatedPriority)) { // AirplaneL - pass activated priroity + this.goalSelector.doTick(); + } +- if (this.targetSelector.inactiveTick()) { ++ if (this.targetSelector.inactiveTick(this.activatedPriority)) { // AirplaneL - pass activated priority + this.targetSelector.doTick(); + } + } +@@ -795,9 +795,11 @@ public abstract class EntityInsentient extends EntityLiving { + this.bo.a(); + this.world.getMethodProfiler().exit(); + this.world.getMethodProfiler().enter("targetSelector"); ++ if (this.targetSelector.inactiveTick(this.activatedPriority)) // AirplaneL - use this to alternate ticking + this.targetSelector.doTick(); + this.world.getMethodProfiler().exit(); + this.world.getMethodProfiler().enter("goalSelector"); ++ if (this.goalSelector.inactiveTick(this.activatedPriority)) // AirplaneL - use this to alternate ticking + this.goalSelector.doTick(); + this.world.getMethodProfiler().exit(); + this.world.getMethodProfiler().enter("navigation"); +diff --git a/src/main/java/net/minecraft/server/EntityPiglin.java b/src/main/java/net/minecraft/server/EntityPiglin.java +index 4849829df1041568a9fcac6d16501fc0606d95da..2ac74751ac8cea0b829b3d0ed03f052162a78781 100644 +--- a/src/main/java/net/minecraft/server/EntityPiglin.java ++++ b/src/main/java/net/minecraft/server/EntityPiglin.java +@@ -216,13 +216,18 @@ public class EntityPiglin extends EntityPiglinAbstract implements ICrossbow { + return !this.cannotHunt; + } + ++ private int behaviorTick; // Airplane + @Override + protected void mobTick() { ++ // Airplane - dynamic tick ++ if (!gg.airplane.AirplaneConfig.dynamicPiglinBehavior || this.behaviorTick++ % this.activatedPriority == 0) { + this.world.getMethodProfiler().enter("piglinBrain"); + if (getRider() == null) // Purpur - only use brain if no rider + this.getBehaviorController().a((WorldServer) this.world, this); // Purpur - decompile error + this.world.getMethodProfiler().exit(); + PiglinAI.b(this); ++ } ++ // Airplane end + super.mobTick(); + } + +diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java +index 9cad895c7d008487ce885cbcc2c3966645df4c19..b8b2c54e54645a6d710bd145c238b18f13922a62 100644 +--- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java ++++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java +@@ -43,10 +43,17 @@ public class PathfinderGoalSelector { + } + + // Paper start ++ /* + public boolean inactiveTick() { + incRate(); + return getCurRate() % getTickRate() == 0; + } ++ */ ++ public boolean inactiveTick(int tickRate) { ++ tickRate = Math.max(tickRate, getTickRate()); ++ return !(this.curRate++ % tickRate != 0); ++ } ++ + public boolean hasTasks() { + for (PathfinderGoalWrapped task : getTasks()) { + if (task.isRunning()) { +diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java +index ff0621e08aaf058154f228abd46475ffaa3920cf..f64a569333c698564b2e2623d6bf3840e46f332b 100644 +--- a/src/main/java/org/spigotmc/ActivationRange.java ++++ b/src/main/java/org/spigotmc/ActivationRange.java +@@ -50,6 +50,9 @@ import net.minecraft.server.EntityInsentient; + import net.minecraft.server.EntityLlama; + import net.minecraft.server.EntityWaterAnimal; + // Paper end ++// AirplaneL start ++import net.minecraft.server.Vec3D; ++// AirplaneL end + + public class ActivationRange + { +@@ -231,7 +234,7 @@ public class ActivationRange + Chunk chunk = chunkProvider.getChunkAtIfLoadedMainThreadNoCache( i1, j1 ); // Paper + if ( chunk != null ) + { +- activateChunkEntities( chunk ); ++ activateChunkEntities( chunk, player.getPositionVector() ); // AirplaneL + } + } + } +@@ -244,7 +247,7 @@ public class ActivationRange + * + * @param chunk + */ +- private static void activateChunkEntities(Chunk chunk) ++ private static void activateChunkEntities(Chunk chunk, Vec3D playerVec) // AirplaneL - add player location + { + // Paper start + Entity[] rawData = chunk.entities.getRawData(); +@@ -253,11 +256,19 @@ public class ActivationRange + //for ( Entity entity : (Collection) slice ) + // Paper end + { ++ // AirplaneL start ++ Vec3D entityVec = entity.getPositionVector(); ++ double diffX = playerVec.x - entityVec.x, diffY = playerVec.y - entityVec.y, diffZ = playerVec.z - entityVec.z; ++ int priority = Math.max(1, (int) (diffX * diffX + diffY * diffY + diffZ * diffZ) >> gg.airplane.AirplaneConfig.activationDistanceMod); + if (MinecraftServer.currentTick > entity.activatedTick) { + if (entity.defaultActivationState || entity.activationType.boundingBox.c(entity.getBoundingBox())) { // Paper + entity.activatedTick = MinecraftServer.currentTick; + } ++ entity.activatedPriority = Math.min(gg.airplane.AirplaneConfig.maximumActivationPrio, priority); ++ } else { ++ entity.activatedPriority = Math.min(gg.airplane.AirplaneConfig.maximumActivationPrio, Math.min(priority, entity.activatedPriority)); + } ++ // AirplaneL end + } + } + } diff --git a/patches/server/0006-Yatopia-configuration.patch b/patches/server/0006-Yatopia-configuration.patch index 4d30c2ae6..5bacb1d47 100644 --- a/patches/server/0006-Yatopia-configuration.patch +++ b/patches/server/0006-Yatopia-configuration.patch @@ -27,12 +27,12 @@ index 55b67f1057224101272f9d6023a93872c4423405..3ec187f39250214a7a72b1d7ef7b3e2e String hostName = "BrokenHost"; try { diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 3ee8d31c453105eca7b96bede39a9ebbf40e1c2c..0a9f03526abf0638ada15d9810b949887fca9f9a 100644 +index ca3d9dbcbeeb5059a942cae1a5020f0bcc59ac9c..20da9b4333e02a1f24eff0c7bbe17a7231bb3359 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -180,6 +180,15 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - // Paper end +@@ -181,6 +181,15 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer com.tuinity.tuinity.config.TuinityConfig.init((java.io.File) options.valueOf("tuinity-settings")); // Tuinity - Server Config + gg.airplane.AirplaneConfig.load(); // Airplane - config + // Yatopia start + try { diff --git a/patches/server/0014-lithium-MixinGoalSelector.patch b/patches/server/0014-lithium-MixinGoalSelector.patch index 8967a12d7..1323ed695 100644 --- a/patches/server/0014-lithium-MixinGoalSelector.patch +++ b/patches/server/0014-lithium-MixinGoalSelector.patch @@ -9,7 +9,7 @@ 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 9cad895c7d008487ce885cbcc2c3966645df4c19..b63f274ec0afec96b4879f9ebaed72c416d1f9d2 100644 +index b8b2c54e54645a6d710bd145c238b18f13922a62..173ccec366b29bc06011bfd6facc06dde9944150 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java @@ -11,6 +11,7 @@ import java.util.function.Supplier; diff --git a/patches/server/0021-Redirect-Configs.patch b/patches/server/0021-Redirect-Configs.patch index 0d75fe185..1c886332a 100644 --- a/patches/server/0021-Redirect-Configs.patch +++ b/patches/server/0021-Redirect-Configs.patch @@ -39,10 +39,10 @@ index 15aa603a771c327879a4088609850fb86c6347bd..553d6fafbcabafeb008fcf5b60adb8d1 for (final Method method : clazz.getDeclaredMethods()) { if (method.getReturnType() != void.class || method.getParameterCount() != 0 || diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 0a9f03526abf0638ada15d9810b949887fca9f9a..64b662dc9146d0d414a9668d9b93e07aa6665f32 100644 +index 20da9b4333e02a1f24eff0c7bbe17a7231bb3359..4bacbd38bc0b39724f1c07ec5a266942d2d1ed81 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -188,7 +188,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -189,7 +189,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer return false; } // Yatopia end diff --git a/patches/server/0024-Fix-lead-fall-dmg-config.patch b/patches/server/0024-Fix-lead-fall-dmg-config.patch index e397bd69d..cb91d8f58 100644 --- a/patches/server/0024-Fix-lead-fall-dmg-config.patch +++ b/patches/server/0024-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 63eb29635957d4e6ce1274ee17a59af62d442d4e..e629f10cdbd70a354f9edaa75973b169a8588d08 100644 +index af7651499391a8b4a5b83cb158846647ce3dc5aa..04afdf4cb616f7634d9d8fbe5c82f22a56671f6d 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1287,6 +1287,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1290,6 +1290,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/0042-Add-nspt-command.patch b/patches/server/0042-Add-nspt-command.patch index 0438795ef..925e1f5e8 100644 --- a/patches/server/0042-Add-nspt-command.patch +++ b/patches/server/0042-Add-nspt-command.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add nspt command diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 64b662dc9146d0d414a9668d9b93e07aa6665f32..2473eb88ec7be3f4935debe04eeabcc0815b3233 100644 +index 4bacbd38bc0b39724f1c07ec5a266942d2d1ed81..72e093bceb7cbf5b55271bf09d04ee73b79e5d45 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -187,6 +187,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -188,6 +188,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer DedicatedServer.LOGGER.error("Unable to load server configuration", e); return false; } diff --git a/upstream/Purpur b/upstream/Purpur index 7b0b3f74e..d72b22863 160000 --- a/upstream/Purpur +++ b/upstream/Purpur @@ -1 +1 @@ -Subproject commit 7b0b3f74e188b9502d712c78c4b8a4bcceaf8046 +Subproject commit d72b22863d0e9d2eb25f0d001d2de6123ff7d755 diff --git a/upstreamCommits/Purpur b/upstreamCommits/Purpur index 224fd1f5b..7baae73ee 100644 --- a/upstreamCommits/Purpur +++ b/upstreamCommits/Purpur @@ -1 +1 @@ -7b0b3f74e188b9502d712c78c4b8a4bcceaf8046 \ No newline at end of file +d72b22863d0e9d2eb25f0d001d2de6123ff7d755 \ No newline at end of file diff --git a/upstreamConfig/0003-AirplaneLite.properties b/upstreamConfig/0003-AirplaneLite.properties index f1de9057f..c6cb7d69d 100644 --- a/upstreamConfig/0003-AirplaneLite.properties +++ b/upstreamConfig/0003-AirplaneLite.properties @@ -1,4 +1,4 @@ name=AirplaneLite useBlackList=False -list=server/AirplaneLite-MC-Dev-Fixes.patch,server/Remove-streams.patch,server/Strip-raytracing-for-EntityLiving-hasLineOfSight.patch,server/Simpler-ShapelessRecipes-comparison-for-Vanilla.patch,server/Queue-lighting-update-only-once.patch,server/Use-unmodifiableMap-instead-of-making-copy.patch,server/Swap-priority-of-checks-in-chunk-ticking.patch,server/Reduce-projectile-chunk-loading.patch,server/Optimize-random-calls-in-chunk-ticking.patch,server/Don-t-get-entity-equipment-if-not-needed.patch +list=server/AirplaneLite-MC-Dev-Fixes.patch,server/Airplane-Configuration.patch,server/Remove-streams.patch,server/Strip-raytracing-for-EntityLiving-hasLineOfSight.patch,server/Simpler-ShapelessRecipes-comparison-for-Vanilla.patch,server/Queue-lighting-update-only-once.patch,server/Use-unmodifiableMap-instead-of-making-copy.patch,server/Swap-priority-of-checks-in-chunk-ticking.patch,server/Reduce-projectile-chunk-loading.patch,server/Optimize-random-calls-in-chunk-ticking.patch,server/Don-t-get-entity-equipment-if-not-needed.patch,server/Dynamic-activation-range.patch branch=origin/master