diff --git a/patches/server/0002-MC-Dev-fixes.patch b/patches/server/0002-MC-Dev-fixes.patch new file mode 100644 index 0000000..f9ddeab --- /dev/null +++ b/patches/server/0002-MC-Dev-fixes.patch @@ -0,0 +1,55 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Fri, 31 Mar 2023 20:40:28 -0700 +Subject: [PATCH] MC-Dev fixes + + +diff --git a/src/main/java/net/minecraft/world/entity/ai/Brain.java b/src/main/java/net/minecraft/world/entity/ai/Brain.java +index 10e7b6a846b443362f1e626b8ee2f63a3803fddb..328c3ecd0d35d2cad15173ec80962cee9177eaf8 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/Brain.java ++++ b/src/main/java/net/minecraft/world/entity/ai/Brain.java +@@ -72,15 +72,15 @@ public class Brain { + } + + public DataResult> decode(DynamicOps dynamicOps, MapLike mapLike) { +- MutableObject>>> mutableObject = new MutableObject<>(DataResult.success(ImmutableList.builder())); ++ MutableObject>>> mutableObject2 = new MutableObject<>(DataResult.success(ImmutableList.builder())); // Folia - decompile fix + mapLike.entries().forEach((pair) -> { + DataResult> dataResult = BuiltInRegistries.MEMORY_MODULE_TYPE.byNameCodec().parse(dynamicOps, pair.getFirst()); + DataResult> dataResult2 = dataResult.flatMap((memoryType) -> { + return this.captureRead(memoryType, dynamicOps, (T)pair.getSecond()); + }); +- mutableObject.setValue(mutableObject.getValue().apply2(ImmutableList.Builder::add, dataResult2)); ++ mutableObject2.setValue(mutableObject2.getValue().apply2(ImmutableList.Builder::add, dataResult2)); // Folia - decompile fix + }); +- ImmutableList> immutableList = mutableObject.getValue().resultOrPartial(Brain.LOGGER::error).map(ImmutableList.Builder::build).orElseGet(ImmutableList::of); ++ ImmutableList> immutableList = mutableObject2.getValue().resultOrPartial(Brain.LOGGER::error).map(ImmutableList.Builder::build).orElseGet(ImmutableList::of); // Folia - decompile fix + return DataResult.success(new Brain<>(memoryModules, sensors, immutableList, mutableObject::getValue)); + } + +@@ -181,14 +181,14 @@ public class Brain { + if (optional == null) { + throw new IllegalStateException("Unregistered memory fetched: " + type); + } else { +- return optional.map(ExpirableValue::getValue); ++ return (Optional)optional.map(ExpirableValue::getValue); // Folia - decompile fix + } + } + + @Nullable + public Optional getMemoryInternal(MemoryModuleType type) { + Optional> optional = this.memories.get(type); +- return optional == null ? null : optional.map(ExpirableValue::getValue); ++ return optional == null ? null : (Optional)optional.map(ExpirableValue::getValue); // Folia - decompile fix + } + + public long getTimeUntilExpiry(MemoryModuleType type) { +@@ -483,7 +483,7 @@ public class Brain { + private final Optional> value; + + static Brain.MemoryValue createUnchecked(MemoryModuleType type, Optional> data) { +- return new Brain.MemoryValue<>(type, data); ++ return new Brain.MemoryValue<>(type, (Optional>)data); // Folia - decompile fix + } + + MemoryValue(MemoryModuleType type, Optional> data) { diff --git a/patches/server/0002-New-player-chunk-loader-system.patch b/patches/server/0003-New-player-chunk-loader-system.patch similarity index 100% rename from patches/server/0002-New-player-chunk-loader-system.patch rename to patches/server/0003-New-player-chunk-loader-system.patch diff --git a/patches/server/0003-Make-ChunkStatus.EMPTY-not-rely-on-the-main-thread-f.patch b/patches/server/0004-Make-ChunkStatus.EMPTY-not-rely-on-the-main-thread-f.patch similarity index 100% rename from patches/server/0003-Make-ChunkStatus.EMPTY-not-rely-on-the-main-thread-f.patch rename to patches/server/0004-Make-ChunkStatus.EMPTY-not-rely-on-the-main-thread-f.patch diff --git a/patches/server/0004-Threaded-Regions.patch b/patches/server/0005-Threaded-Regions.patch similarity index 99% rename from patches/server/0004-Threaded-Regions.patch rename to patches/server/0005-Threaded-Regions.patch index 3f00a37..2d8d724 100644 --- a/patches/server/0004-Threaded-Regions.patch +++ b/patches/server/0005-Threaded-Regions.patch @@ -18945,6 +18945,29 @@ index 02cb6b8c1d59855ff4a8aad3024fe12007eca0ee..88e2d818264450e63e0f5693fdc7940d if (entityhuman != null) { double d0 = entityhuman.distanceToSqr((Entity) this); +diff --git a/src/main/java/net/minecraft/world/entity/ai/Brain.java b/src/main/java/net/minecraft/world/entity/ai/Brain.java +index 328c3ecd0d35d2cad15173ec80962cee9177eaf8..625e03abc4a62f42774fedee31a5f5f776169674 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/Brain.java ++++ b/src/main/java/net/minecraft/world/entity/ai/Brain.java +@@ -412,9 +412,17 @@ public class Brain { + } + + public void stopAll(ServerLevel world, E entity) { ++ // Folia start - region threading ++ List> behaviors = this.getRunningBehaviors(); ++ if (behaviors.isEmpty()) { ++ // avoid calling getGameTime, as this may be called while portalling an entity - which will cause ++ // the world data retrieval to fail ++ return; ++ } ++ // Folia end - region threading + long l = entity.level.getGameTime(); + +- for(BehaviorControl behaviorControl : this.getRunningBehaviors()) { ++ for(BehaviorControl behaviorControl : behaviors) { // Folia - region threading + behaviorControl.doStop(world, entity, l); + } + diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/PoiCompetitorScan.java b/src/main/java/net/minecraft/world/entity/ai/behavior/PoiCompetitorScan.java index 8ec07578c1e41997a2e5ef158885ad3f4c2a31b6..6dcacfca6eb4a8a6425f1aaeb57733d29989032a 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/PoiCompetitorScan.java diff --git a/patches/server/0005-Increase-parallelism-for-neighbour-writing-chunk-sta.patch b/patches/server/0006-Increase-parallelism-for-neighbour-writing-chunk-sta.patch similarity index 100% rename from patches/server/0005-Increase-parallelism-for-neighbour-writing-chunk-sta.patch rename to patches/server/0006-Increase-parallelism-for-neighbour-writing-chunk-sta.patch diff --git a/patches/server/0006-Cache-whether-region-files-do-not-exist.patch b/patches/server/0007-Cache-whether-region-files-do-not-exist.patch similarity index 100% rename from patches/server/0006-Cache-whether-region-files-do-not-exist.patch rename to patches/server/0007-Cache-whether-region-files-do-not-exist.patch diff --git a/patches/server/0007-Max-pending-logins.patch b/patches/server/0008-Max-pending-logins.patch similarity index 100% rename from patches/server/0007-Max-pending-logins.patch rename to patches/server/0008-Max-pending-logins.patch diff --git a/patches/server/0008-Add-chunk-system-throughput-counters-to-tps.patch b/patches/server/0009-Add-chunk-system-throughput-counters-to-tps.patch similarity index 100% rename from patches/server/0008-Add-chunk-system-throughput-counters-to-tps.patch rename to patches/server/0009-Add-chunk-system-throughput-counters-to-tps.patch diff --git a/patches/server/0009-Make-CraftEntity-getHandle-and-overrides-perform-thr.patch b/patches/server/0010-Make-CraftEntity-getHandle-and-overrides-perform-thr.patch similarity index 100% rename from patches/server/0009-Make-CraftEntity-getHandle-and-overrides-perform-thr.patch rename to patches/server/0010-Make-CraftEntity-getHandle-and-overrides-perform-thr.patch diff --git a/patches/server/0010-Disable-mid-tick-task-execution.patch b/patches/server/0011-Disable-mid-tick-task-execution.patch similarity index 100% rename from patches/server/0010-Disable-mid-tick-task-execution.patch rename to patches/server/0011-Disable-mid-tick-task-execution.patch diff --git a/patches/server/0011-Throw-UnsupportedOperationException-for-broken-APIs.patch b/patches/server/0012-Throw-UnsupportedOperationException-for-broken-APIs.patch similarity index 100% rename from patches/server/0011-Throw-UnsupportedOperationException-for-broken-APIs.patch rename to patches/server/0012-Throw-UnsupportedOperationException-for-broken-APIs.patch diff --git a/patches/server/0012-Fix-tests-by-removing-them.patch b/patches/server/0013-Fix-tests-by-removing-them.patch similarity index 100% rename from patches/server/0012-Fix-tests-by-removing-them.patch rename to patches/server/0013-Fix-tests-by-removing-them.patch diff --git a/patches/server/0013-Work-around-https-github.com-PaperMC-paperweight-iss.patch b/patches/server/0014-Work-around-https-github.com-PaperMC-paperweight-iss.patch similarity index 100% rename from patches/server/0013-Work-around-https-github.com-PaperMC-paperweight-iss.patch rename to patches/server/0014-Work-around-https-github.com-PaperMC-paperweight-iss.patch diff --git a/patches/server/0014-Require-plugins-to-be-explicitly-marked-as-Folia-sup.patch b/patches/server/0015-Require-plugins-to-be-explicitly-marked-as-Folia-sup.patch similarity index 100% rename from patches/server/0014-Require-plugins-to-be-explicitly-marked-as-Folia-sup.patch rename to patches/server/0015-Require-plugins-to-be-explicitly-marked-as-Folia-sup.patch