From 37e61be6c27a1d583d228fcf29c222e28e3ac46f Mon Sep 17 00:00:00 2001 From: Ivan Pekov Date: Fri, 20 Nov 2020 09:14:39 +0200 Subject: [PATCH] Updated upstream and sidestream (Tuinity/Purpur) Closes #289 Also dropped some patches which are useless. Changes in Purpur: Paper upstream updates Changes in Tuinity: Paper updated --- PATCHES.md | 7 - Purpur | 2 +- Tuinity | 2 +- .../server/0001-Yatopia-Server-Fixes.patch | 17 +- .../server/0011-Modify-default-configs.patch | 2 +- ...me.patch => 0016-lithium-MixinBiome.patch} | 0 .../0016-lithium-MixinLandPathNodeMaker.patch | 92 -- ...tch => 0017-Item-stuck-sleep-config.patch} | 0 ...> 0018-Option-for-simpler-Villagers.patch} | 0 ...ze-furnance-fuel-and-recipe-lookups.patch} | 0 ...GlueList.patch => 0020-Add-GlueList.patch} | 0 ...021-Optimize-TileEntity-load-unload.patch} | 2 +- ...file.patch => 0022-Global-Eula-file.patch} | 0 ...figs.patch => 0023-Redirect-Configs.patch} | 0 ...h => 0024-Add-JsonList-save-timings.patch} | 0 ...ch => 0025-lithium-MixinDataWatcher.patch} | 0 ...ch => 0026-Fix-lead-fall-dmg-config.patch} | 0 ...-lithium-MixinChunkGeneratorAbstract.patch | 189 --- ...e-some-stuff-in-WorldServer-ticking.patch} | 0 ...=> 0028-Optimize-BehaviorController.patch} | 0 ... => 0029-Add-timings-for-Pathfinder.patch} | 0 ... 0030-Send-more-packets-immediately.patch} | 0 ...031-Use-offline-uuids-if-we-need-to.patch} | 0 ...ch => 0032-lithium-VoxelShapesMixin.patch} | 6 +- ...hly-optimize-VillagePlace-filtering.patch} | 82 +- ...tals.patch => 0034-Optimise-portals.patch} | 0 ...0034-lithium-collision-optimizations.patch | 1199 ----------------- ...0035-Nuke-streams-off-BlockPosition.patch} | 6 +- ...36-Nuke-streams-off-SectionPosition.patch} | 0 .../0036-lithium-MixinChunkSection.patch | 83 -- ...p-wasting-resources-on-JsonList-get.patch} | 0 ...patch => 0038-ProxyForwardDataEvent.patch} | 0 ...Fix-LightEngineThreaded-memory-leak.patch} | 4 +- ...espect-PlayerKickEvent-leaveMessage.patch} | 0 ...0041-Shutdown-Bootstrap-thread-pool.patch} | 0 ...rs.patch => 0042-Optimize-Villagers.patch} | 0 .../0043-Fix-Unable-to-save-chunk-error.patch | 19 - ...t-command-for-multiple-additions-re.patch} | 0 ...tch => 0044-PlayerAttackEntityEvent.patch} | 0 ...-Ensure-pools-create-daemon-threads.patch} | 0 ...ch => 0046-Add-StructureLocateEvent.patch} | 0 ... => 0047-Add-IntelliJ-IDEA-runnable.patch} | 0 ...PaperPR-Fix-merging-spawning-values.patch} | 0 ... 0049-Use-Glue-List-in-WeightedList.patch} | 0 ...ndsException-when-sending-too-many-.patch} | 0 ...mand.patch => 0051-Add-nspt-command.patch} | 0 ... => 0052-Configurable-flight-checks.patch} | 0 ...ue-List-as-delegate-for-NonNullList.patch} | 0 ...e-recipe-lookups-in-CraftingManager.patch} | 0 ...ch => 0055-Improve-task-performance.patch} | 0 ...> 0056-Optimize-advancement-loading.patch} | 0 ...-collision-check-for-entity-suffocat.patch | 70 - ...some-list-initialisations-in-packet.patch} | 0 ...058-PaperPR-Fix-harming-potion-dupe.patch} | 0 ...059-lithium-PerlinNoiseSamplerMixin.patch} | 0 ...lithium-VoronoiBiomeAccessTypeMixin.patch} | 0 ...61-lithium-NoiseChunkGeneratorMixin.patch} | 14 +- ... => 0062-lithium-reduce-allocations.patch} | 0 ... => 0063-Smarter-statistics-ticking.patch} | 0 ...064-Configurable-criterion-triggers.patch} | 0 ...0065-Configurable-BlockPhysicsEvent.patch} | 0 ...ws.patch => 0066-Infinity-No-Arrows.patch} | 0 ...patch => 0067-Custom-Locale-Support.patch} | 0 ...> 0068-Configurable-movement-checks.patch} | 0 ...-block-is-cauldron-before-proceeding.patch | 19 - 65 files changed, 106 insertions(+), 1709 deletions(-) rename patches/server/{0017-lithium-MixinBiome.patch => 0016-lithium-MixinBiome.patch} (100%) delete mode 100644 patches/server/0016-lithium-MixinLandPathNodeMaker.patch rename patches/server/{0018-Item-stuck-sleep-config.patch => 0017-Item-stuck-sleep-config.patch} (100%) rename patches/server/{0019-Option-for-simpler-Villagers.patch => 0018-Option-for-simpler-Villagers.patch} (100%) rename patches/server/{0020-Heavily-optimize-furnance-fuel-and-recipe-lookups.patch => 0019-Heavily-optimize-furnance-fuel-and-recipe-lookups.patch} (100%) rename patches/server/{0021-Add-GlueList.patch => 0020-Add-GlueList.patch} (100%) rename patches/server/{0022-Optimize-TileEntity-load-unload.patch => 0021-Optimize-TileEntity-load-unload.patch} (94%) rename patches/server/{0023-Global-Eula-file.patch => 0022-Global-Eula-file.patch} (100%) rename patches/server/{0024-Redirect-Configs.patch => 0023-Redirect-Configs.patch} (100%) rename patches/server/{0025-Add-JsonList-save-timings.patch => 0024-Add-JsonList-save-timings.patch} (100%) rename patches/server/{0027-lithium-MixinDataWatcher.patch => 0025-lithium-MixinDataWatcher.patch} (100%) rename patches/server/{0028-Fix-lead-fall-dmg-config.patch => 0026-Fix-lead-fall-dmg-config.patch} (100%) delete mode 100644 patches/server/0026-lithium-MixinChunkGeneratorAbstract.patch rename patches/server/{0029-Optimize-some-stuff-in-WorldServer-ticking.patch => 0027-Optimize-some-stuff-in-WorldServer-ticking.patch} (100%) rename patches/server/{0030-Optimize-BehaviorController.patch => 0028-Optimize-BehaviorController.patch} (100%) rename patches/server/{0031-Add-timings-for-Pathfinder.patch => 0029-Add-timings-for-Pathfinder.patch} (100%) rename patches/server/{0032-Send-more-packets-immediately.patch => 0030-Send-more-packets-immediately.patch} (100%) rename patches/server/{0033-Use-offline-uuids-if-we-need-to.patch => 0031-Use-offline-uuids-if-we-need-to.patch} (100%) rename patches/server/{0035-lithium-VoxelShapesMixin.patch => 0032-lithium-VoxelShapesMixin.patch} (93%) rename patches/server/{0037-Highly-optimize-VillagePlace-filtering.patch => 0033-Highly-optimize-VillagePlace-filtering.patch} (91%) rename patches/server/{0038-Optimise-portals.patch => 0034-Optimise-portals.patch} (100%) delete mode 100644 patches/server/0034-lithium-collision-optimizations.patch rename patches/server/{0039-Nuke-streams-off-BlockPosition.patch => 0035-Nuke-streams-off-BlockPosition.patch} (91%) rename patches/server/{0040-Nuke-streams-off-SectionPosition.patch => 0036-Nuke-streams-off-SectionPosition.patch} (100%) delete mode 100644 patches/server/0036-lithium-MixinChunkSection.patch rename patches/server/{0041-Stop-wasting-resources-on-JsonList-get.patch => 0037-Stop-wasting-resources-on-JsonList-get.patch} (100%) rename patches/server/{0042-ProxyForwardDataEvent.patch => 0038-ProxyForwardDataEvent.patch} (100%) rename patches/server/{0044-Fix-LightEngineThreaded-memory-leak.patch => 0039-Fix-LightEngineThreaded-memory-leak.patch} (89%) rename patches/server/{0045-Respect-PlayerKickEvent-leaveMessage.patch => 0040-Respect-PlayerKickEvent-leaveMessage.patch} (100%) rename patches/server/{0046-Shutdown-Bootstrap-thread-pool.patch => 0041-Shutdown-Bootstrap-thread-pool.patch} (100%) rename patches/server/{0047-Optimize-Villagers.patch => 0042-Optimize-Villagers.patch} (100%) delete mode 100644 patches/server/0043-Fix-Unable-to-save-chunk-error.patch rename patches/server/{0048-Optimize-whitelist-command-for-multiple-additions-re.patch => 0043-Optimize-whitelist-command-for-multiple-additions-re.patch} (100%) rename patches/server/{0049-PlayerAttackEntityEvent.patch => 0044-PlayerAttackEntityEvent.patch} (100%) rename patches/server/{0050-Ensure-pools-create-daemon-threads.patch => 0045-Ensure-pools-create-daemon-threads.patch} (100%) rename patches/server/{0051-Add-StructureLocateEvent.patch => 0046-Add-StructureLocateEvent.patch} (100%) rename patches/server/{0052-Add-IntelliJ-IDEA-runnable.patch => 0047-Add-IntelliJ-IDEA-runnable.patch} (100%) rename patches/server/{0053-PaperPR-Fix-merging-spawning-values.patch => 0048-PaperPR-Fix-merging-spawning-values.patch} (100%) rename patches/server/{0054-Use-Glue-List-in-WeightedList.patch => 0049-Use-Glue-List-in-WeightedList.patch} (100%) rename patches/server/{0055-Fix-IndexOutOfBoundsException-when-sending-too-many-.patch => 0050-Fix-IndexOutOfBoundsException-when-sending-too-many-.patch} (100%) rename patches/server/{0057-Add-nspt-command.patch => 0051-Add-nspt-command.patch} (100%) rename patches/server/{0058-Configurable-flight-checks.patch => 0052-Configurable-flight-checks.patch} (100%) rename patches/server/{0059-Use-Glue-List-as-delegate-for-NonNullList.patch => 0053-Use-Glue-List-as-delegate-for-NonNullList.patch} (100%) rename patches/server/{0060-Heavily-optimize-recipe-lookups-in-CraftingManager.patch => 0054-Heavily-optimize-recipe-lookups-in-CraftingManager.patch} (100%) rename patches/server/{0061-Improve-task-performance.patch => 0055-Improve-task-performance.patch} (100%) rename patches/server/{0062-Optimize-advancement-loading.patch => 0056-Optimize-advancement-loading.patch} (100%) delete mode 100644 patches/server/0056-Use-faster-block-collision-check-for-entity-suffocat.patch rename patches/server/{0063-Use-GlueList-for-some-list-initialisations-in-packet.patch => 0057-Use-GlueList-for-some-list-initialisations-in-packet.patch} (100%) rename patches/server/{0064-PaperPR-Fix-harming-potion-dupe.patch => 0058-PaperPR-Fix-harming-potion-dupe.patch} (100%) rename patches/server/{0065-lithium-PerlinNoiseSamplerMixin.patch => 0059-lithium-PerlinNoiseSamplerMixin.patch} (100%) rename patches/server/{0066-lithium-VoronoiBiomeAccessTypeMixin.patch => 0060-lithium-VoronoiBiomeAccessTypeMixin.patch} (100%) rename patches/server/{0067-lithium-NoiseChunkGeneratorMixin.patch => 0061-lithium-NoiseChunkGeneratorMixin.patch} (94%) rename patches/server/{0068-lithium-reduce-allocations.patch => 0062-lithium-reduce-allocations.patch} (100%) rename patches/server/{0069-Smarter-statistics-ticking.patch => 0063-Smarter-statistics-ticking.patch} (100%) rename patches/server/{0070-Configurable-criterion-triggers.patch => 0064-Configurable-criterion-triggers.patch} (100%) rename patches/server/{0071-Configurable-BlockPhysicsEvent.patch => 0065-Configurable-BlockPhysicsEvent.patch} (100%) rename patches/server/{0072-Infinity-No-Arrows.patch => 0066-Infinity-No-Arrows.patch} (100%) rename patches/server/{0073-Custom-Locale-Support.patch => 0067-Custom-Locale-Support.patch} (100%) rename patches/server/{0075-Configurable-movement-checks.patch => 0068-Configurable-movement-checks.patch} (100%) delete mode 100644 patches/server/0074-Make-sure-the-block-is-cauldron-before-proceeding.patch diff --git a/PATCHES.md b/PATCHES.md index d4d99089..20b7af27 100644 --- a/PATCHES.md +++ b/PATCHES.md @@ -56,7 +56,6 @@ # Patches | server | Dont send useless entity packets | William Blake Galbreath | | | server | Ensure pools create daemon threads | Ivan Pekov | | | server | Entity lifespan | William Blake Galbreath | | -| server | Fix "Unable to save chunk" error | Ivan Pekov | | | server | Fix 'outdated server' showing in ping before server fully | William Blake Galbreath | | | server | Fix Bukkit.createInventory() with type LECTERN | willies952002 | | | server | Fix IndexOutOfBoundsException when sending too many changes | Ivan Pekov | | @@ -77,7 +76,6 @@ # Patches | server | Lagging threshold | William Blake Galbreath | | | server | MC-168772 Fix - Add turtle egg block options | William Blake Galbreath | | | server | MC-4 Fix - Item position desync | William Blake Galbreath | | -| server | Make sure the block is cauldron before proceeding | Ivan Pekov | | | api | Modify POM | YatopiaMC | | | server | Modify POM | YatopiaMC | | | server | Modify default configs | tr7zw | | @@ -121,7 +119,6 @@ # Patches | server | Use Glue List as delegate for NonNullList | Mykyta Komarn | | | server | Use Glue List in WeightedList | Ivan Pekov | | | server | Use GlueList for some list initialisations in packets | Ivan Pekov | | -| server | Use faster block collision check for entity suffocation check | Mykyta Komarn | | | server | Use offline uuids if we need to | Ivan Pekov | | | server | Utilities | YatopiaMC | Mykyta Komarnytskyy, Ivan Pekov | | api | Yatopia API Bundle | YatopiaMC | | @@ -130,16 +127,12 @@ # Patches | server | dont load chunks for physics | Aikar | | | server | lithium MixinBiome | JellySquid | | | server | lithium MixinBox | JellySquid | | -| server | lithium MixinChunkSection | JellySquid | | | server | lithium MixinDirection | JellySquid | | | server | lithium MixinGoalSelector | JellySquid | | -| server | lithium MixinLandPathNodeMaker | JellySquid | | | server | lithium NoiseChunkGeneratorMixin | JellySquid | | | server | lithium PerlinNoiseSamplerMixin | JellySquid | Bud Gidiere | | server | lithium VoronoiBiomeAccessTypeMixin | JellySquid | | | server | lithium VoxelShapesMixin | JellySquid | Ivan Pekov | -| server | lithium collision optimizations | JellySquid | Ivan Pekov | | server | lithium enum_values | JellySquid | | | server | lithium reduce allocations | JellySquid | Mykyta Komarnytskyy | -| server | lithium-MixinChunkGeneratorAbstract | JellySquid | tr7zw | | server | lithium-MixinDataWatcher | JellySquid | tr7zw | diff --git a/Purpur b/Purpur index 56569681..b8fb7ff5 160000 --- a/Purpur +++ b/Purpur @@ -1 +1 @@ -Subproject commit 56569681b43e3fec3426cca43271b04eaf93f100 +Subproject commit b8fb7ff5b5de02aa0c46d76d65f6f481f2fd6929 diff --git a/Tuinity b/Tuinity index 47a29f84..ecc046e8 160000 --- a/Tuinity +++ b/Tuinity @@ -1 +1 @@ -Subproject commit 47a29f8434891ecac58dced9716aa8ba11dadbc4 +Subproject commit ecc046e8a9b6d606b1359fe714ebec7bde3e6f75 diff --git a/patches/server/0001-Yatopia-Server-Fixes.patch b/patches/server/0001-Yatopia-Server-Fixes.patch index 35da9120..99b2eea3 100644 --- a/patches/server/0001-Yatopia-Server-Fixes.patch +++ b/patches/server/0001-Yatopia-Server-Fixes.patch @@ -1044,6 +1044,19 @@ index f5c0ccfcbfeda191e3a077bb4313a8c8b8b4178d..00000000000000000000000000000000 - // CraftBukkit start - PlayerTeleportEvent - PlayerTeleportEvent tpEvent = new PlayerTeleportEvent(this.getBukkitEntity(), enter, exit, cause); - Bukkit.getServer().getPluginManager().callEvent(tpEvent); +diff --git a/src/main/java/net/minecraft/server/EntitySlice.java b/src/main/java/net/minecraft/server/EntitySlice.java +index 1250c3cbe915815939627701c153ba6254fc05f0..ac7b5bc179a3e174ae09b3444b3ba89b5627a174 100644 +--- a/src/main/java/net/minecraft/server/EntitySlice.java ++++ b/src/main/java/net/minecraft/server/EntitySlice.java +@@ -65,7 +65,7 @@ public class EntitySlice extends AbstractCollection { + if (!this.b.isAssignableFrom(oclass)) { + throw new IllegalArgumentException("Don't know how to search for " + oclass); + } else { +- List list = (List) this.a.computeIfAbsent(oclass, (oclass1) -> { ++ List list = (List) this.a.computeIfAbsent(oclass, (oclass1) -> { // Yatopia - decompile fix - why is this still being here? + Stream stream = this.c.stream(); + + oclass1.getClass(); diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java index a02f54ab3ac721a5697f8efea474d2999a0fd7bd..9dc054e2e189f8c65a9d12f70e180e7ded79a997 100644 --- a/src/main/java/net/minecraft/server/EntityVillager.java @@ -1244,7 +1257,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 bb7ae7deb67172776e702b80c5f66b526a36a8e6..9626f736353249ceb219ee565efc022fd2a32a93 100644 +index cf43f47c27992b119e07d38a7a79ecc183e12844..50eedfe5a0fe897f1e3b748bcae5c1d0c53b1467 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 { @@ -1256,7 +1269,7 @@ index bb7ae7deb67172776e702b80c5f66b526a36a8e6..9626f736353249ceb219ee565efc022f public final co.aikar.timings.WorldTimingsHandler timings; // Paper public static BlockPosition lastPhysicsProblem; // Spigot @@ -157,6 +158,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - 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.tuinityConfig = new com.tuinity.tuinity.config.TuinityConfig.WorldConfig(((WorldDataServer)worlddatamutable).getName()); // Tuinity - Server Config this.purpurConfig = new net.pl3x.purpur.PurpurWorldConfig((((WorldDataServer)worlddatamutable).getName())); // Purpur + this.origamiConfig = new de.minebench.origami.OrigamiConfig.WorldConfig(((WorldDataServer)worlddatamutable).getName()); // Origami diff --git a/patches/server/0011-Modify-default-configs.patch b/patches/server/0011-Modify-default-configs.patch index df4705be..1258c241 100644 --- a/patches/server/0011-Modify-default-configs.patch +++ b/patches/server/0011-Modify-default-configs.patch @@ -18,7 +18,7 @@ index 6ab0a51b421dc696aec292f2db955311c9cc31e3..82591dcebdbf34649728b60b22d8f78a TimingsManager.privacy = getBoolean("timings.server-name-privacy", false); TimingsManager.hiddenConfigs = getList("timings.hidden-config-entries", Lists.newArrayList("database", "settings.bungeecord-addresses")); diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index ff0e4447b6574e91bf8815de4e04ce881ed7026d..590fd78ec0751a561305a4ad2190b343fe6d5280 100644 +index 80b0c08cef9a5326492b1faec020929fca59ff77..f0354d591f8efe10c5fc8cb91345f6d467902cf6 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -598,7 +598,7 @@ public class PaperWorldConfig { diff --git a/patches/server/0017-lithium-MixinBiome.patch b/patches/server/0016-lithium-MixinBiome.patch similarity index 100% rename from patches/server/0017-lithium-MixinBiome.patch rename to patches/server/0016-lithium-MixinBiome.patch diff --git a/patches/server/0016-lithium-MixinLandPathNodeMaker.patch b/patches/server/0016-lithium-MixinLandPathNodeMaker.patch deleted file mode 100644 index 5dd30a7d..00000000 --- a/patches/server/0016-lithium-MixinLandPathNodeMaker.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: JellySquid -Date: Mon, 11 May 2020 22:56:27 +0200 -Subject: [PATCH] lithium MixinLandPathNodeMaker - -Original code by JellySquid, licensed under GNU Lesser General Public License v3.0 -you can find the original code on https://github.com/jellysquid3/lithium-fabric/tree/1.16.x/fabric (Yarn mappings) - -diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java -index 33804e68931e8b4145b896eedeab79bde78779f2..5954fa5e2b1d4f18df13f6de738d4f3662d7f028 100644 ---- a/src/main/java/net/minecraft/server/PathfinderNormal.java -+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java -@@ -7,9 +7,15 @@ import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; - import java.util.EnumSet; - import java.util.Iterator; - import javax.annotation.Nullable; -+import it.unimi.dsi.fastutil.objects.Reference2ReferenceMap; // Yatopia -+import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; // Yatopia - - public class PathfinderNormal extends PathfinderAbstract { - -+ // Yatopia start - this is not thread safe! -+ private static final Reference2ReferenceMap commonTypes = new Reference2ReferenceOpenHashMap<>(); -+ // Yatopia end -+ - protected float j; - private final Long2ObjectMap k = new Long2ObjectOpenHashMap(); - private final Object2BooleanMap l = new Object2BooleanOpenHashMap(); -@@ -518,8 +524,22 @@ public class PathfinderNormal extends PathfinderAbstract { - } - protected static PathType getStaticTypeSlow(IBlockAccess iblockaccess, BlockPosition blockposition, IBlockData iblockdata) { - // Tuinity end - reduce pathfinder branches -- Block block = iblockdata.getBlock(); -- Material material = iblockdata.getMaterial(); -+ // Yatopia start - replaced logic -+ //Block block = iblockdata.getBlock(); -+ //Material material = iblockdata.getMaterial(); -+ if (iblockdata.isAir()) return PathType.OPEN; -+ PathType type = commonTypes.get(iblockdata); -+ if (type == null) { -+ commonTypes.put(iblockdata, type = getPathType(iblockdata)); -+ } -+ -+ if (type == PathType.OPEN) { -+ if (!iblockdata.a(iblockaccess, blockposition, PathMode.LAND)) { -+ return PathType.BLOCKED; -+ } -+ } -+ -+ /* - - if (iblockdata.isAir()) { - return PathType.OPEN; -@@ -540,7 +560,38 @@ public class PathfinderNormal extends PathfinderAbstract { - } else { - return PathType.TRAPDOOR; - } -+ */ -+ return type; -+ // Yatopia end -+ } -+ -+ // Yatopia start -+ private static PathType getPathType(IBlockData iblockdata) { -+ Block block = iblockdata.getBlock(); -+ if (!block.a(TagsBlock.TRAPDOORS) && block != Blocks.LILY_PAD) { -+ if (block == Blocks.FIRE) { -+ return PathType.DAMAGE_FIRE; -+ } else if (block == Blocks.CACTUS) { -+ return PathType.DAMAGE_CACTUS; -+ } else if (iblockdata.a(Blocks.SWEET_BERRY_BUSH)) { -+ return PathType.DAMAGE_OTHER; -+ } else if (iblockdata.a(Blocks.HONEY_BLOCK)) { -+ return PathType.STICKY_HONEY; -+ } else if (iblockdata.a(Blocks.COCOA)) { -+ return PathType.COCOA; -+ } else { -+ Fluid fluid = iblockdata.getFluid(); // Tuinity - remove another get type call -+ -+ if (fluid.a(TagsFluid.WATER)) return PathType.WATER; -+ if (fluid.a(TagsFluid.LAVA)) return PathType.LAVA; -+ -+ return PathType.OPEN; -+ } -+ } else { -+ return PathType.TRAPDOOR; -+ } - } -+ // Yatopia end - - private static boolean a(IBlockData iblockdata) { - return iblockdata.a((Tag) TagsBlock.FIRE) || iblockdata.a(Blocks.LAVA) || iblockdata.a(Blocks.MAGMA_BLOCK) || BlockCampfire.g(iblockdata); diff --git a/patches/server/0018-Item-stuck-sleep-config.patch b/patches/server/0017-Item-stuck-sleep-config.patch similarity index 100% rename from patches/server/0018-Item-stuck-sleep-config.patch rename to patches/server/0017-Item-stuck-sleep-config.patch diff --git a/patches/server/0019-Option-for-simpler-Villagers.patch b/patches/server/0018-Option-for-simpler-Villagers.patch similarity index 100% rename from patches/server/0019-Option-for-simpler-Villagers.patch rename to patches/server/0018-Option-for-simpler-Villagers.patch diff --git a/patches/server/0020-Heavily-optimize-furnance-fuel-and-recipe-lookups.patch b/patches/server/0019-Heavily-optimize-furnance-fuel-and-recipe-lookups.patch similarity index 100% rename from patches/server/0020-Heavily-optimize-furnance-fuel-and-recipe-lookups.patch rename to patches/server/0019-Heavily-optimize-furnance-fuel-and-recipe-lookups.patch diff --git a/patches/server/0021-Add-GlueList.patch b/patches/server/0020-Add-GlueList.patch similarity index 100% rename from patches/server/0021-Add-GlueList.patch rename to patches/server/0020-Add-GlueList.patch diff --git a/patches/server/0022-Optimize-TileEntity-load-unload.patch b/patches/server/0021-Optimize-TileEntity-load-unload.patch similarity index 94% rename from patches/server/0022-Optimize-TileEntity-load-unload.patch rename to patches/server/0021-Optimize-TileEntity-load-unload.patch index 59d94a99..7caa9fd8 100644 --- a/patches/server/0022-Optimize-TileEntity-load-unload.patch +++ b/patches/server/0021-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 9626f736353249ceb219ee565efc022fd2a32a93..6422cd2a84203f893fe19e866c02207784b043c8 100644 +index 50eedfe5a0fe897f1e3b748bcae5c1d0c53b1467..1742399920cf6420082760049d5b8f2835704273 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -42,9 +42,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable { diff --git a/patches/server/0023-Global-Eula-file.patch b/patches/server/0022-Global-Eula-file.patch similarity index 100% rename from patches/server/0023-Global-Eula-file.patch rename to patches/server/0022-Global-Eula-file.patch diff --git a/patches/server/0024-Redirect-Configs.patch b/patches/server/0023-Redirect-Configs.patch similarity index 100% rename from patches/server/0024-Redirect-Configs.patch rename to patches/server/0023-Redirect-Configs.patch diff --git a/patches/server/0025-Add-JsonList-save-timings.patch b/patches/server/0024-Add-JsonList-save-timings.patch similarity index 100% rename from patches/server/0025-Add-JsonList-save-timings.patch rename to patches/server/0024-Add-JsonList-save-timings.patch diff --git a/patches/server/0027-lithium-MixinDataWatcher.patch b/patches/server/0025-lithium-MixinDataWatcher.patch similarity index 100% rename from patches/server/0027-lithium-MixinDataWatcher.patch rename to patches/server/0025-lithium-MixinDataWatcher.patch diff --git a/patches/server/0028-Fix-lead-fall-dmg-config.patch b/patches/server/0026-Fix-lead-fall-dmg-config.patch similarity index 100% rename from patches/server/0028-Fix-lead-fall-dmg-config.patch rename to patches/server/0026-Fix-lead-fall-dmg-config.patch diff --git a/patches/server/0026-lithium-MixinChunkGeneratorAbstract.patch b/patches/server/0026-lithium-MixinChunkGeneratorAbstract.patch deleted file mode 100644 index 52fc27bf..00000000 --- a/patches/server/0026-lithium-MixinChunkGeneratorAbstract.patch +++ /dev/null @@ -1,189 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: JellySquid -Date: Tue, 4 Aug 2020 21:06:02 +0200 -Subject: [PATCH] lithium-MixinChunkGeneratorAbstract - -Original code by JellySquid, licensed under GNU Lesser General Public License v3.0 -you can find the original code on https://github.com/jellysquid3/lithium-fabric/tree/1.16.x/fabric (Yarn mappings) - -Co-authored-by: tr7zw - -diff --git a/src/main/java/me/jellysquid/mods/lithium/common/world/noise/SimplexNoiseCache.java b/src/main/java/me/jellysquid/mods/lithium/common/world/noise/SimplexNoiseCache.java -new file mode 100644 -index 0000000000000000000000000000000000000000..e6cd19e75a88f4dbf38d3cc63883068d95aa67d4 ---- /dev/null -+++ b/src/main/java/me/jellysquid/mods/lithium/common/world/noise/SimplexNoiseCache.java -@@ -0,0 +1,135 @@ -+package me.jellysquid.mods.lithium.common.world.noise; -+ -+import it.unimi.dsi.fastutil.HashCommon; -+ -+import net.minecraft.server.ChunkCoordIntPair; -+import net.minecraft.server.MathHelper; -+import net.minecraft.server.NoiseGenerator3Handler; -+ -+import java.util.Arrays; -+ -+/** -+ * A cache for the End's noise generator that caches computed values. Through the caching, we can eliminate a large -+ * amount of overhead in computing the noise values several hundred thousand times per chunk. This code uses the same -+ * array backed lossy cache as FastCachingLayerSampler. -+ */ -+public class SimplexNoiseCache { -+ private static final int GRID_SIZE = 2; -+ private static final float MIN = -100.0F; -+ private static final float MAX = 80.0F; -+ private static final float ISLAND_RADIUS = 100.0F; -+ // The smallest encompassing power of two that can store all of the noise values in a chunk. -+ private static final int CACHE_SIZE = 8192; -+ -+ private final int mask; -+ private final long[] keys; -+ private final float[] values; -+ -+ private final NoiseGenerator3Handler sampler; -+ -+ public SimplexNoiseCache(NoiseGenerator3Handler sampler) { -+ this.sampler = sampler; -+ -+ this.mask = CACHE_SIZE - 1; -+ -+ // Initialize default values -+ this.keys = new long[CACHE_SIZE]; -+ Arrays.fill(this.keys, Long.MIN_VALUE); -+ this.values = new float[CACHE_SIZE]; -+ } -+ -+ /** -+ * Attempt to get the cached distance factor, saving computation time. -+ */ -+ private float getDistanceFactor(int x, int z) { -+ // Hash key and get index -+ long key = ChunkCoordIntPair.pair(x, z); -+ int idx = (int) HashCommon.mix(key) & this.mask; -+ -+ if (this.keys[idx] == key) { -+ // Cache hit, return cached value -+ return this.values[idx]; -+ } -+ -+ // Cache miss, compute and store value -+ -+ // A marker for no value. -+ float value = -1.0F; -+ -+ long lx = x; -+ long lz = z; -+ long distanceFromOriginSq = lx * lx + lz * lz; -+ -+ // Ensure we are 64 grid cells away from the origin. -+ if (distanceFromOriginSq > 64 * 64) { -+ // Reduce the number of island-forming grid cells by sampling noise with a threshold -+ if (this.sampler.a(x, z) < -0.9) { -+ // Generate a pseudo-random value from 9 to 21 -+ value = (Math.abs(x) * 3439.0F + Math.abs(z) * 147.0F) %13.0F + 9.0F; -+ } -+ } -+ -+ // Store values in cache -+ this.keys[idx] = key; -+ this.values[idx] = value; -+ -+ return value; -+ } -+ -+ /** -+ * Mapped and cleaned up implementation of the End biome source's sampler. Tries to use cached values wherever -+ * possible. -+ */ -+ public float getNoiseAt(int x, int z) { -+ // [VanillaCopy] TheEndBiomeSource#getNoiseAt -+ -+ int gridX = x / GRID_SIZE; -+ int gridZ = z / GRID_SIZE; -+ -+ // This is the "center point", offset to center around the current grid cell -+ int gridOriginX = x % GRID_SIZE; -+ int gridOriginZ = z % GRID_SIZE; -+ -+ // Initialize density for the central island -+ float density = ISLAND_RADIUS - MathHelper.sqrt(x * x + z * z) * 8.0F; -+ if (density >= MAX) { -+ return MAX; -+ } -+ -+ // Iterate through 25x25 grid cells -+ for (int offsetX = -12; offsetX <= 12; offsetX++) { -+ for (int offsetZ = -12; offsetZ <= 12; offsetZ++) { -+ int globalGridX = gridX + offsetX; -+ int globalGridZ = gridZ + offsetZ; -+ -+ // Try to retrieve values from cache -+ float distanceFactor = getDistanceFactor(globalGridX, globalGridZ); -+ if (distanceFactor != -1.0F) { -+ // Compute the distance to the origin -+ float deltaX = gridOriginX - offsetX * GRID_SIZE; -+ float deltaZ = gridOriginZ - offsetZ * GRID_SIZE; -+ -+ // Calculate the density at this grid cell -+ float scaledDistance = MathHelper.sqrt(deltaX * deltaX + deltaZ * deltaZ) * distanceFactor; -+ float densityHere = ISLAND_RADIUS - scaledDistance; -+ -+ // Try to return early if we're over the max -+ if (densityHere > density) { -+ if (densityHere >= MAX) { -+ return MAX; -+ } -+ -+ density = densityHere; -+ } -+ } -+ } -+ } -+ -+ // Avoid a call to Math.max because the density cannot be bigger than the max. -+ if (density < MIN) { -+ return MIN; -+ } -+ -+ return density; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -index 321ebe8891defb46f3ad3dfea37c9bb6e2025ad7..119804e5c12aca3f4fbfeaf424f46152f43b3941 100644 ---- a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -+++ b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -@@ -57,12 +57,13 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { - private final NoiseGenerator t; - private final NoiseGeneratorOctaves u; - @Nullable -- private final NoiseGenerator3Handler v; -+ private final NoiseGenerator3Handler v; // Yatopia - yarn "SimplexNoiseSampler" - protected final IBlockData f; - protected final IBlockData g; - private final long w; - protected final Supplier h; - private final int x; -+ private ThreadLocal tlCache; // Yatopia - - public ChunkGeneratorAbstract(WorldChunkManager worldchunkmanager, long i, Supplier supplier) { - this(worldchunkmanager, worldchunkmanager, i, supplier); -@@ -99,7 +100,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { - } else { - this.v = null; - } -- -+ this.tlCache = ThreadLocal.withInitial(() -> new me.jellysquid.mods.lithium.common.world.noise.SimplexNoiseCache(v)); // Yatopia - } - - @Override -@@ -164,7 +165,8 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { - double d3; - - if (this.v != null) { -- d0 = (double) (WorldChunkManagerTheEnd.a(this.v, i, j) - 8.0F); -+ //d0 = (double) (WorldChunkManagerTheEnd.a(this.v, i, j) - 8.0F); // Yatopia -+ d0 = tlCache.get().getNoiseAt(i, j) - 8.0F; // Yatopia - if (d0 > 0.0D) { - d1 = 0.25D; - } else { diff --git a/patches/server/0029-Optimize-some-stuff-in-WorldServer-ticking.patch b/patches/server/0027-Optimize-some-stuff-in-WorldServer-ticking.patch similarity index 100% rename from patches/server/0029-Optimize-some-stuff-in-WorldServer-ticking.patch rename to patches/server/0027-Optimize-some-stuff-in-WorldServer-ticking.patch diff --git a/patches/server/0030-Optimize-BehaviorController.patch b/patches/server/0028-Optimize-BehaviorController.patch similarity index 100% rename from patches/server/0030-Optimize-BehaviorController.patch rename to patches/server/0028-Optimize-BehaviorController.patch diff --git a/patches/server/0031-Add-timings-for-Pathfinder.patch b/patches/server/0029-Add-timings-for-Pathfinder.patch similarity index 100% rename from patches/server/0031-Add-timings-for-Pathfinder.patch rename to patches/server/0029-Add-timings-for-Pathfinder.patch diff --git a/patches/server/0032-Send-more-packets-immediately.patch b/patches/server/0030-Send-more-packets-immediately.patch similarity index 100% rename from patches/server/0032-Send-more-packets-immediately.patch rename to patches/server/0030-Send-more-packets-immediately.patch diff --git a/patches/server/0033-Use-offline-uuids-if-we-need-to.patch b/patches/server/0031-Use-offline-uuids-if-we-need-to.patch similarity index 100% rename from patches/server/0033-Use-offline-uuids-if-we-need-to.patch rename to patches/server/0031-Use-offline-uuids-if-we-need-to.patch diff --git a/patches/server/0035-lithium-VoxelShapesMixin.patch b/patches/server/0032-lithium-VoxelShapesMixin.patch similarity index 93% rename from patches/server/0035-lithium-VoxelShapesMixin.patch rename to patches/server/0032-lithium-VoxelShapesMixin.patch index e991bf21..0fa4b9c6 100644 --- a/patches/server/0035-lithium-VoxelShapesMixin.patch +++ b/patches/server/0032-lithium-VoxelShapesMixin.patch @@ -21,7 +21,7 @@ index 92ab79532d29341e8840341ff5ee8f5203cb4aad..bc7b9d0b4d9e3f7519bb013054eeec51 public abstract EnumAxisCycle a(); diff --git a/src/main/java/net/minecraft/server/VoxelShape.java b/src/main/java/net/minecraft/server/VoxelShape.java -index 98f9ded42264cb88cff701a85d22d99e203ef7cf..b94f08dcc911cd632a9c4fb93dcbc4d47aceca94 100644 +index 700660dd93b3090334bb3033d5f5fdd6ab684744..fd34dffa63995c1fc277eac28eb1cd23e3a5e105 100644 --- a/src/main/java/net/minecraft/server/VoxelShape.java +++ b/src/main/java/net/minecraft/server/VoxelShape.java @@ -148,6 +148,7 @@ public abstract class VoxelShape { @@ -33,10 +33,10 @@ index 98f9ded42264cb88cff701a85d22d99e203ef7cf..b94f08dcc911cd632a9c4fb93dcbc4d4 return this.a(EnumAxisCycle.a(enumdirection_enumaxis, EnumDirection.EnumAxis.X), axisalignedbb, d0); } diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java -index 877ef81bd8285167ce11c116b8ad803fda63c6c9..1bf27c47c8fcc2fb0a712b7d10a8c50cea677926 100644 +index db735e29d427cc8f4bd4ba54c7a44daf9fed9e61..641e40dd24082cfe1450e5a3a29312bd07ad2155 100644 --- a/src/main/java/net/minecraft/server/VoxelShapes.java +++ b/src/main/java/net/minecraft/server/VoxelShapes.java -@@ -279,6 +279,21 @@ public final class VoxelShapes { +@@ -272,6 +272,21 @@ public final class VoxelShapes { return 0.0D; } else { EnumAxisCycle enumaxiscycle1 = enumaxiscycle.a(); diff --git a/patches/server/0037-Highly-optimize-VillagePlace-filtering.patch b/patches/server/0033-Highly-optimize-VillagePlace-filtering.patch similarity index 91% rename from patches/server/0037-Highly-optimize-VillagePlace-filtering.patch rename to patches/server/0033-Highly-optimize-VillagePlace-filtering.patch index 421ec2d7..d5af860d 100644 --- a/patches/server/0037-Highly-optimize-VillagePlace-filtering.patch +++ b/patches/server/0033-Highly-optimize-VillagePlace-filtering.patch @@ -8,14 +8,49 @@ major release and reimplemented again if mojang changes stuff with villagers again. diff --git a/src/main/java/me/jellysquid/mods/lithium/common/util/Producer.java b/src/main/java/me/jellysquid/mods/lithium/common/util/Producer.java -index f3224ea636fef95d368b934ed4b3e9060c4b10a2..f2d5878d235fdbfc11c74f87b95f029330c70309 100644 ---- a/src/main/java/me/jellysquid/mods/lithium/common/util/Producer.java +new file mode 100644 +index 0000000000000000000000000000000000000000..18666522e08153093bc5457b2524622a4b619233 +--- /dev/null +++ b/src/main/java/me/jellysquid/mods/lithium/common/util/Producer.java -@@ -46,6 +46,16 @@ public interface Producer { - } - } - -+ // also checks contains and is thus only 1 generic +@@ -0,0 +1,54 @@ ++package me.jellysquid.mods.lithium.common.util; ++ ++import java.util.List; ++import java.util.Spliterator; ++import java.util.Spliterators; ++import java.util.function.BiConsumer; ++import java.util.function.Consumer; ++import java.util.function.Function; ++import java.util.stream.Stream; ++import java.util.stream.StreamSupport; ++import net.yatopia.server.HoldingConsumer; ++ ++public interface Producer { ++ /** ++ * Computes the next sequence of values in a collection. If a null value is passed for {@param consumer}, then ++ * the producer will only return whether or not elements existed. ++ * ++ * @param consumer The (nullable) consumer which will accept the computed values during this run. ++ * @return True if the producer produced any values, otherwise false ++ */ ++ boolean computeNext(Consumer consumer); ++ ++ default Producer map(Function mapper) { ++ return consumer -> { ++ Consumer con = (t) -> consumer.accept(mapper.apply(t)); ++ return Producer.this.computeNext(con); ++ }; ++ } ++ ++ static Stream asStream(Producer producer) { ++ return StreamSupport.stream(new Spliterators.AbstractSpliterator(Long.MAX_VALUE, Spliterator.ORDERED | Spliterator.NONNULL) { ++ @Override ++ public boolean tryAdvance(Consumer action) { ++ return producer.computeNext(action); ++ } ++ }, false); ++ } ++ + static void fillList(Producer producer, List list) { + HoldingConsumer consumer = new HoldingConsumer<>(); + while (producer.computeNext(consumer)) { @@ -25,9 +60,13 @@ index f3224ea636fef95d368b934ed4b3e9060c4b10a2..f2d5878d235fdbfc11c74f87b95f0293 + } + } + - Producer EMPTY_PRODUCER = consumer -> false; - - @SuppressWarnings("unchecked") ++ Producer EMPTY_PRODUCER = consumer -> false; ++ ++ @SuppressWarnings("unchecked") ++ static Producer empty() { ++ return (Producer) EMPTY_PRODUCER; ++ } ++} diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java index 6fcc7ed7c129e6a33386d65b37cbba4a44e96f0f..dbe6f7d555e8c851faba5cafee8831c516256c09 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java @@ -383,6 +422,29 @@ index f43bc1f7d693d63c6bbdba976c048d2d0c8767b1..8b9f5797a6bee47ff16ee713777b5220 })).add(villageplacerecord); return true; } +diff --git a/src/main/java/net/yatopia/server/HoldingConsumer.java b/src/main/java/net/yatopia/server/HoldingConsumer.java +new file mode 100644 +index 0000000000000000000000000000000000000000..fca24201a721f0ac6c962e79119c4613734e8108 +--- /dev/null ++++ b/src/main/java/net/yatopia/server/HoldingConsumer.java +@@ -0,0 +1,17 @@ ++package net.yatopia.server; ++ ++import java.util.function.Consumer; ++ ++public class HoldingConsumer implements Consumer { ++ ++ private T value; ++ ++ @Override ++ public void accept(T t) { ++ this.value = t; ++ } ++ ++ public T getValue() { ++ return value; ++ } ++} diff --git a/src/main/java/net/yatopia/server/YatopiaChunkPos.java b/src/main/java/net/yatopia/server/YatopiaChunkPos.java new file mode 100644 index 0000000000000000000000000000000000000000..871e305356103f87c2c1ad1487c804b60e13c076 diff --git a/patches/server/0038-Optimise-portals.patch b/patches/server/0034-Optimise-portals.patch similarity index 100% rename from patches/server/0038-Optimise-portals.patch rename to patches/server/0034-Optimise-portals.patch diff --git a/patches/server/0034-lithium-collision-optimizations.patch b/patches/server/0034-lithium-collision-optimizations.patch deleted file mode 100644 index 4986447a..00000000 --- a/patches/server/0034-lithium-collision-optimizations.patch +++ /dev/null @@ -1,1199 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: JellySquid -Date: Thu, 20 Aug 2020 15:26:53 +0300 -Subject: [PATCH] lithium collision optimizations - -Original code by JellySquid, licensed under LGPLv3 -you can find the original code on https://github.com/jellysquid3/lithium-fabric/ (Yarn mappings) - -Co-authored-by: Ivan Pekov - -diff --git a/src/main/java/me/jellysquid/mods/lithium/common/entity/EntityClassGroup.java b/src/main/java/me/jellysquid/mods/lithium/common/entity/EntityClassGroup.java -new file mode 100644 -index 0000000000000000000000000000000000000000..91608928dc5cd2f600f1ce57ef7931078f354ea6 ---- /dev/null -+++ b/src/main/java/me/jellysquid/mods/lithium/common/entity/EntityClassGroup.java -@@ -0,0 +1,101 @@ -+package me.jellysquid.mods.lithium.common.entity; -+ -+import java.util.ArrayList; -+import java.util.Collection; -+import java.util.List; -+import java.util.Map; -+import java.util.concurrent.ConcurrentHashMap; -+import java.util.function.Function; -+import net.minecraft.server.Entity; -+ -+/** -+ * Class for grouping Entity classes that meet some requirement for use in TypeFilterableList -+ * Designed to allow create groups of entity classes that are updated when mods add new entities that fit into the group. -+ * -+ * @author 2No2Name -+ */ -+public class EntityClassGroup { -+ //Keep a set of classes that were already added to matching class groups, so we only analyse them once. -+ private static final Map, Object> knownEntityClasses = new ConcurrentHashMap<>(); //value unused, no set variant available -+ //Keep track of available class groups for updating them in case an entity class is instantiated for the first time -+ private static final List entityClassGroups = new net.yatopia.server.list.GlueList<>(); // Yatopia - GlueList -+ -+ public static final EntityClassGroup COLLISION_BOX_OVERRIDE = new EntityClassGroup( -+ (entityClass) -> { -+ boolean overwritten; -+ while (entityClass != null && entityClass != Entity.class) { -+ try { -+ overwritten = true; -+ entityClass.getDeclaredMethod("aY"); -+ } catch (NoSuchMethodException e) { -+ overwritten = false; -+ entityClass = entityClass.getSuperclass(); -+ } -+ if (overwritten) { -+ return true; -+ } -+ } -+ return false; -+ } -+ ); -+ public static final EntityClassGroup HARD_COLLISION_BOX_OVERRIDE = new EntityClassGroup( -+ (entityClass) -> { -+ boolean overwritten; -+ while (entityClass != null && entityClass != Entity.class) { -+ try { -+ overwritten = true; -+ entityClass.getDeclaredMethod("j", Entity.class); -+ } catch (NoSuchMethodException e) { -+ overwritten = false; -+ entityClass = entityClass.getSuperclass(); -+ } -+ if (overwritten) -+ return true; -+ } -+ return false; -+ } -+ ); -+ -+ private final Map, Object> classGroup; //value unused, no set variant available -+ private final Function, Boolean> classFitEvaluator; -+ -+ public EntityClassGroup(Function, Boolean> classFitEvaluator) { -+ this.classGroup = new ConcurrentHashMap<>(); -+ EntityClassGroup.entityClassGroups.add(this); -+ this.classFitEvaluator = classFitEvaluator; -+ } -+ -+ public EntityClassGroup add(Class entityClass) { -+ this.classGroup.put(entityClass, entityClass); -+ return this; -+ } -+ -+ public boolean contains(Class entityClass) { -+ EntityClassGroup.analyseEntityClass(entityClass); -+ return this.classGroup.containsKey(entityClass); -+ } -+ -+ public Collection> getCollection() { -+ return this.classGroup.keySet(); -+ } -+ -+ public void addClassIfFitting(Class discoveredEntityClass) { -+ if (this.classGroup.containsKey(discoveredEntityClass)) { -+ return; -+ } -+ if (this.classFitEvaluator != null && this.classFitEvaluator.apply(discoveredEntityClass)) { -+ this.classGroup.put(discoveredEntityClass, discoveredEntityClass); -+ } -+ } -+ -+ public static void analyseEntityClass(Class entityClass) { -+ if (EntityClassGroup.knownEntityClasses.containsKey(entityClass)) { -+ return; -+ } -+ EntityClassGroup.knownEntityClasses.put(entityClass, entityClass); -+ -+ for (EntityClassGroup entityClassGroup : EntityClassGroup.entityClassGroups) { -+ entityClassGroup.addClassIfFitting(entityClass); -+ } -+ } -+} -diff --git a/src/main/java/me/jellysquid/mods/lithium/common/entity/EntityClassGroupHelper.java b/src/main/java/me/jellysquid/mods/lithium/common/entity/EntityClassGroupHelper.java -new file mode 100644 -index 0000000000000000000000000000000000000000..20f80ae80de91615ea02f0771f7c020c3e4c6d1e ---- /dev/null -+++ b/src/main/java/me/jellysquid/mods/lithium/common/entity/EntityClassGroupHelper.java -@@ -0,0 +1,32 @@ -+package me.jellysquid.mods.lithium.common.entity; -+ -+import java.util.List; -+import me.jellysquid.mods.lithium.common.world.WorldHelper; -+import net.minecraft.server.AxisAlignedBB; -+import net.minecraft.server.Entity; -+import net.minecraft.server.IEntityAccess; -+import net.minecraft.server.World; -+ -+public class EntityClassGroupHelper { -+ -+ /** -+ * Partial [VanillaCopy] Classes overriding Entity.getHardCollisionBox(Entity other) or Entity.getCollisionBox() -+ * The returned entity list is only used to call getCollisionBox and getHardCollisionBox. As most entities return null -+ * for both of these methods, getting those is not necessary. This is why we only get entities when they overwrite -+ * getCollisionBox -+ * -+ * @param entityView the world -+ * @param selection the box the entities have to collide with -+ * @param entity the entity that is searching for the colliding entities -+ * @return list of entities with collision boxes -+ */ -+ public static List getEntitiesWithCollisionBoxForEntity(IEntityAccess entityView, AxisAlignedBB selection, Entity entity, boolean loadChunks) { -+ if (entity != null && EntityClassGroup.HARD_COLLISION_BOX_OVERRIDE.contains(entity.getClass()) || !(entityView instanceof World)) { -+ //use vanilla code when method_30949 (previously getHardCollisionBox(Entity other)) is overwritten, as every entity could be relevant as argument of getHardCollisionBox -+ return entityView.getEntities(entity, selection); -+ } else { -+ //only get entities that overwrite method_30948 (previously getCollisionBox) -+ return WorldHelper.getEntitiesOfClassGroup((World) entityView, entity, EntityClassGroup.COLLISION_BOX_OVERRIDE, selection, loadChunks); -+ } -+ } -+} -diff --git a/src/main/java/me/jellysquid/mods/lithium/common/entity/LithiumEntityCollisions.java b/src/main/java/me/jellysquid/mods/lithium/common/entity/LithiumEntityCollisions.java -new file mode 100644 -index 0000000000000000000000000000000000000000..f2e08aafd31b3adbbbcc96df6aea7a647fb8bdf8 ---- /dev/null -+++ b/src/main/java/me/jellysquid/mods/lithium/common/entity/LithiumEntityCollisions.java -@@ -0,0 +1,188 @@ -+package me.jellysquid.mods.lithium.common.entity; -+ -+import java.util.Iterator; -+import java.util.List; -+import java.util.function.BiConsumer; -+import java.util.function.Consumer; -+import java.util.function.Predicate; -+import java.util.stream.Stream; -+import me.jellysquid.mods.lithium.common.entity.movement.ChunkAwareBlockCollisionSweeper; -+import me.jellysquid.mods.lithium.common.util.Producer; -+import net.minecraft.server.AxisAlignedBB; -+import net.minecraft.server.Entity; -+import net.minecraft.server.ICollisionAccess; -+import net.minecraft.server.IEntityAccess; -+import net.minecraft.server.VoxelShape; -+import net.minecraft.server.VoxelShapes; -+import net.minecraft.server.WorldBorder; -+import net.yatopia.server.EntityFilter; -+ -+public class LithiumEntityCollisions { -+ public static final double EPSILON = 1.0E-7D; -+ -+ /** -+ * [VanillaCopy] CollisionView#getBlockCollisions(Entity, Box) -+ * This is a much, much faster implementation which uses simple collision testing against full-cube block shapes. -+ * Checks against the world border are replaced with our own optimized functions which do not go through the -+ * VoxelShape system. -+ */ -+ public static Stream getBlockCollisions(ICollisionAccess world, Entity entity, AxisAlignedBB box) { -+ if (isBoxEmpty(box)) { -+ return Stream.empty(); -+ } -+ -+ return Producer.asStream(getBlockCollisionProducer(world, entity, box)); -+ } -+ -+ public static void fillBlockCollisionsList(ICollisionAccess world, List filled, Entity entity, AxisAlignedBB box) { -+ if (isBoxEmpty(box)) { -+ return; -+ } -+ -+ Producer.fillList( -+ getBlockCollisionProducer(world, entity, box), -+ filled, -+ (voxelShape, axisAlignedBBS) -> VoxelShapes.addBoxesToIfIntersects(voxelShape, box, axisAlignedBBS) -+ ); -+ } -+ -+ public static Producer getBlockCollisionProducer(ICollisionAccess world, Entity entity, AxisAlignedBB box) { -+ final ChunkAwareBlockCollisionSweeper sweeper = new ChunkAwareBlockCollisionSweeper(world, entity, box); -+ -+ return consumer -> { -+ VoxelShape shape = sweeper.getNextCollidedShape(); -+ if (shape != null) { -+ consumer.accept(shape); -+ return true; -+ } -+ return false; -+ }; -+ } -+ -+ /** -+ * See {@link LithiumEntityCollisions#getBlockCollisions(ICollisionAccess, Entity, AxisAlignedBB)} -+ * -+ * @return True if the box (possibly that of an entity's) collided with any blocks -+ */ -+ public static boolean doesBoxCollideWithBlocks(ICollisionAccess world, Entity entity, AxisAlignedBB box) { -+ if (isBoxEmpty(box)) { -+ return false; -+ } -+ -+ final ChunkAwareBlockCollisionSweeper sweeper = new ChunkAwareBlockCollisionSweeper(world, entity, box); -+ -+ VoxelShape shape = sweeper.getNextCollidedShape(); -+ return shape != null; -+ } -+ -+ /** -+ * See {@link LithiumEntityCollisions#getEntityCollisions(IEntityAccess, Entity, AxisAlignedBB, Predicate)} -+ * -+ * @return True if the box (possibly that of an entity's) collided with any other entities -+ */ -+ public static boolean doesBoxCollideWithEntities(IEntityAccess view, Entity entity, AxisAlignedBB box, Predicate predicate) { -+ if (isBoxEmpty(box)) { -+ return false; -+ } -+ -+ return getEntityCollisionProducer(view, entity, box.grow(EPSILON), predicate, false).computeNext(null); -+ } -+ -+ /** -+ * Returns a stream of entity collision boxes. -+ */ -+ public static Stream getEntityCollisions(IEntityAccess view, Entity entity, AxisAlignedBB box, Predicate predicate) { -+ if (isBoxEmpty(box)) { -+ return Stream.empty(); -+ } -+ -+ return Producer.asStream(getEntityCollisionProducer(view, entity, box.grow(EPSILON), predicate, false)); -+ } -+ -+ public static void fillEntityCollisionsList(IEntityAccess view, Entity entity, List filled, AxisAlignedBB box, boolean loadChunks) { -+ if (isBoxEmpty(box)) { -+ return; -+ } -+ -+ Producer.fillList( -+ getEntityCollisionProducer(view, entity, box.grow(EPSILON), EntityFilter.getFilter(entity), loadChunks), -+ filled, -+ (voxelShape, axisAlignedBBS) -> VoxelShapes.addBoxesToIfIntersects(voxelShape, box, axisAlignedBBS) -+ ); -+ } -+ -+ /** -+ * [VanillaCopy] EntityView#getEntityCollisions -+ * Re-implements the function named above without stream code or unnecessary allocations. This can provide a small -+ * boost in some situations (such as heavy entity crowding) and reduces the allocation rate significantly. -+ */ -+ public static Producer getEntityCollisionProducer(IEntityAccess view, Entity entity, AxisAlignedBB box, Predicate predicate, boolean loadChunks) { -+ return new Producer() { -+ private Iterator it; -+ -+ @Override -+ public boolean computeNext(Consumer consumer) { -+ if (it == null) { -+ /* -+ * In case entity's class is overriding method_30949, all types of entities may be (=> are assumed to be) required. -+ * Otherwise only get entities that override method_30948 are required, as other entities cannot collide. -+ */ -+ this.it = EntityClassGroupHelper.getEntitiesWithCollisionBoxForEntity(view, box, entity, loadChunks).iterator(); -+ } -+ -+ while (this.it.hasNext()) { -+ Entity otherEntity = this.it.next(); -+ -+ if (!predicate.test(otherEntity)) { -+ continue; -+ } -+ -+ if (entity == null) { -+ if (!otherEntity.collisionBoxIsHard()) { -+ continue; -+ } -+ } else if (!entity.hardCollidesWith(otherEntity)) { -+ continue; -+ } -+ -+ if (consumer != null) { -+ consumer.accept(VoxelShapes.of(otherEntity.getBoundingBox())); -+ } -+ return true; -+ } -+ -+ return false; -+ } -+ }; -+ } -+ -+ /** -+ * This provides a faster check for seeing if an entity is within the world border as it avoids going through -+ * the slower shape system. -+ * -+ * @return True if the {@param box} is fully within the {@param border}, otherwise false. -+ */ -+ public static boolean isWithinWorldBorder(WorldBorder border, AxisAlignedBB box) { -+ double wboxMinX = Math.floor(border.getMinX()); -+ double wboxMinZ = Math.floor(border.getMinZ()); -+ -+ double wboxMaxX = Math.ceil(border.getMaxX()); -+ double wboxMaxZ = Math.ceil(border.getMaxZ()); -+ -+ return box.minX >= wboxMinX && box.minX < wboxMaxX && box.minZ >= wboxMinZ && box.minZ < wboxMaxZ && -+ box.maxX >= wboxMinX && box.maxX < wboxMaxX && box.maxZ >= wboxMinZ && box.maxZ < wboxMaxZ; -+ } -+ -+ public static boolean canEntityCollideWithWorldBorder(ICollisionAccess world, Entity entity) { -+ WorldBorder border = world.getWorldBorder(); -+ -+ boolean isInsideBorder = isWithinWorldBorder(border, entity.getBoundingBox().shrink(EPSILON)); -+ boolean isCrossingBorder = isWithinWorldBorder(border, entity.getBoundingBox().grow(EPSILON)); -+ -+ return !isInsideBorder && isCrossingBorder; -+ } -+ -+ private static boolean isBoxEmpty(AxisAlignedBB box) { -+ return box.getAverageSideLength() <= EPSILON; -+ } -+} -diff --git a/src/main/java/me/jellysquid/mods/lithium/common/entity/movement/ChunkAwareBlockCollisionSweeper.java b/src/main/java/me/jellysquid/mods/lithium/common/entity/movement/ChunkAwareBlockCollisionSweeper.java -new file mode 100644 -index 0000000000000000000000000000000000000000..7ed343cfb3130446c85dab2ca04d60f91e2c94fb ---- /dev/null -+++ b/src/main/java/me/jellysquid/mods/lithium/common/entity/movement/ChunkAwareBlockCollisionSweeper.java -@@ -0,0 +1,278 @@ -+package me.jellysquid.mods.lithium.common.entity.movement; -+ -+import me.jellysquid.mods.lithium.common.entity.LithiumEntityCollisions; -+import net.minecraft.server.AxisAlignedBB; -+import net.minecraft.server.BlockPosition; -+import net.minecraft.server.Blocks; -+import net.minecraft.server.Chunk; -+import net.minecraft.server.ChunkSection; -+import net.minecraft.server.Entity; -+import net.minecraft.server.IBlockData; -+import net.minecraft.server.IChunkAccess; -+import net.minecraft.server.ICollisionAccess; -+import net.minecraft.server.MathHelper; -+import net.minecraft.server.OperatorBoolean; -+import net.minecraft.server.VoxelShape; -+import net.minecraft.server.VoxelShapeCollision; -+import net.minecraft.server.VoxelShapes; -+ -+import static me.jellysquid.mods.lithium.common.entity.LithiumEntityCollisions.EPSILON; -+ -+/** -+ * ChunkAwareBlockCollisionSweeper iterates over blocks in one chunk section at a time. Together with the chunk -+ * section keeping track of the amount of oversized blocks inside the number of iterations can often be reduced. -+ */ -+public class ChunkAwareBlockCollisionSweeper { -+ private static final boolean OVERSIZED_BLOCK_COUNTING_ENABLED = OversizedBlocksCounter.class.isAssignableFrom(ChunkSection.class); -+ -+ private final BlockPosition.MutableBlockPosition pos = new BlockPosition.MutableBlockPosition(); -+ -+ /** -+ * The collision box being swept through the world. -+ */ -+ private final AxisAlignedBB box; -+ -+ /** -+ * The VoxelShape of the collision box being swept through the world. -+ */ -+ private final VoxelShape shape; -+ -+ private final ICollisionAccess view; -+ private final VoxelShapeCollision context; -+ -+ private final Entity entity; -+ -+ //limits of the area without extension for oversized blocks -+ private final int minX, minY, minZ, maxX, maxY, maxZ; -+ -+ //variables prefixed with c refer to the iteration of the currently cached chunk section -+ private int chunkX, chunkY, chunkZ; -+ private int cStartX, cStartZ; -+ private int cEndX, cEndZ; -+ private int cX, cY, cZ; -+ -+ private int cTotalSize; -+ private int cIterated; -+ -+ private boolean sectionOversizedBlocks; -+ private IChunkAccess cachedChunk; -+ private ChunkSection cachedChunkSection; -+ private boolean needEntityCollisionCheck; -+ -+ public ChunkAwareBlockCollisionSweeper(ICollisionAccess view, Entity entity, AxisAlignedBB box) { -+ this.box = box; -+ this.shape = VoxelShapes.of(box); -+ this.context = entity == null ? VoxelShapeCollision.a() : VoxelShapeCollision.a(entity); -+ this.view = view; -+ this.entity = entity; -+ this.needEntityCollisionCheck = entity != null; -+ -+ this.minX = MathHelper.floor(box.minX - EPSILON); -+ this.maxX = MathHelper.floor(box.maxX + EPSILON); -+ this.minY = MathHelper.clamp((int) (box.minY - EPSILON), 0, 255); -+ this.maxY = MathHelper.clamp((int) (box.maxY + EPSILON), 0, 255); -+ this.minZ = MathHelper.floor(box.minZ - EPSILON); -+ this.maxZ = MathHelper.floor(box.maxZ + EPSILON); -+ -+ this.chunkX = (this.minX - 1) >> 4; -+ this.chunkZ = (this.minZ - 1) >> 4; -+ -+ this.cIterated = 0; -+ this.cTotalSize = 0; -+ -+ //decrement as first nextSection call will increment it again -+ this.chunkX--; -+ } -+ -+ private boolean nextSection() { -+ do { -+ do { -+ //find the coordinates of the next section inside the area expanded by 1 block on all sides -+ //note: this.minX, maxX etc are not expanded, so there are lots of +1 and -1 around. -+ if (this.cachedChunk != null && this.chunkY < 15 && this.chunkY < ((this.maxY + 1) >> 4)) { -+ this.chunkY++; -+ this.cachedChunkSection = this.cachedChunk.getSections()[this.chunkY]; -+ } else { -+ this.chunkY = MathHelper.clamp((this.minY - 1) >> 4, 0, 15); -+ -+ if ((this.chunkX < ((this.maxX + 1) >> 4))) { -+ //first initialization takes this branch -+ this.chunkX++; -+ } else { -+ this.chunkX = (this.minX - 1) >> 4; -+ -+ if (this.chunkZ < ((this.maxZ + 1) >> 4)) { -+ this.chunkZ++; -+ } else { -+ return false; //no more sections to iterate -+ } -+ } -+ //Casting to Chunk is not checked, together with other mods this could cause a ClassCastException -+ this.cachedChunk = (IChunkAccess) this.view.c(this.chunkX, this.chunkZ); -+ if (this.cachedChunk != null) { -+ this.cachedChunkSection = this.cachedChunk.getSections()[this.chunkY]; -+ } -+ } -+ //skip empty chunks and empty chunk sections -+ } while (this.cachedChunk == null || ChunkSection.isEmpty(this.cachedChunkSection)); -+ -+ this.sectionOversizedBlocks = hasChunkSectionOversizedBlocks(this.cachedChunk, this.chunkY); -+ -+ int sizeExtension = this.sectionOversizedBlocks ? 1 : 0; -+ -+ this.cEndX = Math.min(this.maxX + sizeExtension, 15 + (this.chunkX << 4)); -+ int cEndY = Math.min(this.maxY + sizeExtension, 15 + (this.chunkY << 4)); -+ this.cEndZ = Math.min(this.maxZ + sizeExtension, 15 + (this.chunkZ << 4)); -+ -+ this.cStartX = Math.max(this.minX - sizeExtension, this.chunkX << 4); -+ int cStartY = Math.max(this.minY - sizeExtension, this.chunkY << 4); -+ this.cStartZ = Math.max(this.minZ - sizeExtension, this.chunkZ << 4); -+ this.cX = this.cStartX; -+ this.cY = cStartY; -+ this.cZ = this.cStartZ; -+ -+ this.cTotalSize = (this.cEndX - this.cStartX + 1) * (cEndY - cStartY + 1) * (this.cEndZ - this.cStartZ + 1); -+ //skip completely empty section iterations -+ } while (this.cTotalSize == 0); -+ this.cIterated = 0; -+ -+ return true; -+ } -+ -+ public VoxelShape getNextCollidedShape() { -+ VoxelShape shape = null; -+ -+ if (this.needEntityCollisionCheck) { -+ shape = this.getNextEntityCollision(); -+ -+ this.needEntityCollisionCheck = false; -+ } -+ -+ if (shape == null) { -+ shape = this.getNextBlockCollision(); -+ } -+ -+ return shape; -+ } -+ -+ -+ /** -+ * Advances the sweep forward until finding a block with a box-colliding VoxelShape -+ * -+ * @return null if no VoxelShape is left in the area, otherwise the next VoxelShape -+ */ -+ private VoxelShape getNextBlockCollision() { -+ while (true) { -+ if (this.cIterated >= this.cTotalSize) { -+ if (!this.nextSection()) { -+ break; -+ } -+ } -+ this.cIterated++; -+ -+ -+ final int x = this.cX; -+ final int y = this.cY; -+ final int z = this.cZ; -+ -+ //The iteration order within a chunk section is chosen so that it causes a mostly linear array access in the storage. -+ //In net.minecraft.world.chunk.PalettedContainer.toIndex x gets the 4 least significant bits, z the 4 above, and y the 4 even higher ones. -+ //Linearly accessing arrays might be slightly faster than other access patterns. -+ //This code hasn't been benchmarked in comparison to another access order. -+ if (this.cX < this.cEndX) { -+ this.cX++; -+ } else if (this.cZ < this.cEndZ) { -+ this.cX = this.cStartX; -+ this.cZ++; -+ } else { -+ this.cX = this.cStartX; -+ this.cZ = this.cStartZ; -+ this.cY++; -+ //stop condition was already checked using this.cIterated at the start of the method -+ } -+ -+ //using < minX and > maxX instead of <= and >= in vanilla, because minX, maxX are the coordinates -+ //of the box that wasn't extended for oversized blocks yet. -+ final int edgesHit = this.sectionOversizedBlocks ? -+ (x < this.minX || x > this.maxX ? 1 : 0) + -+ (y < this.minY || y > this.maxY ? 1 : 0) + -+ (z < this.minZ || z > this.maxZ ? 1 : 0) : 0; -+ -+ if (edgesHit == 3) { -+ continue; -+ } -+ -+ final IBlockData state = this.cachedChunkSection.getType(x & 15, y & 15, z & 15); -+ -+ if (canInteractWithBlock(state, edgesHit)) { -+ this.pos.setValues(x, y, z); -+ VoxelShape collisionShape = state.getCollisionShape(this.view, this.pos, this.context); -+ -+ if (collisionShape != VoxelShapes.empty()) { -+ VoxelShape collidedShape = getCollidedShape(this.box, this.shape, collisionShape, x, y, z); -+ if (collidedShape != null) { -+ return collidedShape; -+ } -+ } -+ } -+ } -+ -+ return null; -+ } -+ -+ private VoxelShape getNextEntityCollision() { -+ if (LithiumEntityCollisions.canEntityCollideWithWorldBorder(this.view, this.entity)) { -+ return this.view.getWorldBorder().asVoxelShape(); -+ } -+ -+ return null; -+ } -+ -+ /** -+ * This is an artifact from vanilla which is used to avoid testing shapes in the extended portion of a volume -+ * unless they are a shape which exceeds their voxel. Pistons must be special-cased here. -+ * -+ * @return True if the shape can be interacted with at the given edge boundary -+ */ -+ private static boolean canInteractWithBlock(IBlockData state, int edgesHit) { -+ return (edgesHit != 1 || state.shapeExceedsCube()) && (edgesHit != 2 || state.getBlock() == Blocks.MOVING_PISTON); -+ } -+ -+ /** -+ * Checks if the {@param entityShape} or {@param entityBox} intersects the given {@param shape} which is translated -+ * to the given position. This is a very specialized implementation which tries to avoid going through VoxelShape -+ * for full-cube shapes. -+ * -+ * @return A {@link VoxelShape} which contains the shape representing that which was collided with, otherwise null -+ */ -+ private static VoxelShape getCollidedShape(AxisAlignedBB entityBox, VoxelShape entityShape, VoxelShape shape, int x, int y, int z) { -+ if (shape.intersects(entityBox)) { -+ return shape.offset(x, y, z); -+ } else { -+ shape = shape.offset(x, y, z); -+ -+ if (VoxelShapes.applyOperation(shape, entityShape, OperatorBoolean.AND)) { -+ return shape; -+ } -+ } -+ -+ return null; -+ } -+ -+ /** -+ * Checks the cached information whether the {@param chunkY} section of the {@param chunk} has oversized blocks. -+ * -+ * @return Whether there are any oversized blocks in the chunk section. -+ */ -+ private static boolean hasChunkSectionOversizedBlocks(IChunkAccess chunk, int chunkY) { -+ if (OVERSIZED_BLOCK_COUNTING_ENABLED) { -+ ChunkSection section = chunk.getSections()[chunkY]; -+ return section != null && ((OversizedBlocksCounter) section).hasOversizedBlocks(); -+ } -+ return true; //like vanilla, assume that a chunk section has oversized blocks, when the section mixin isn't loaded -+ } -+ -+ public interface OversizedBlocksCounter { -+ boolean hasOversizedBlocks(); -+ } -+} -diff --git a/src/main/java/me/jellysquid/mods/lithium/common/util/Producer.java b/src/main/java/me/jellysquid/mods/lithium/common/util/Producer.java -new file mode 100644 -index 0000000000000000000000000000000000000000..f3224ea636fef95d368b934ed4b3e9060c4b10a2 ---- /dev/null -+++ b/src/main/java/me/jellysquid/mods/lithium/common/util/Producer.java -@@ -0,0 +1,55 @@ -+package me.jellysquid.mods.lithium.common.util; -+ -+import java.util.List; -+import java.util.Spliterator; -+import java.util.Spliterators; -+import java.util.function.BiConsumer; -+import java.util.function.Consumer; -+import java.util.function.Function; -+import java.util.stream.Stream; -+import java.util.stream.StreamSupport; -+import net.yatopia.server.HoldingConsumer; -+ -+public interface Producer { -+ /** -+ * Computes the next sequence of values in a collection. If a null value is passed for {@param consumer}, then -+ * the producer will only return whether or not elements existed. -+ * -+ * @param consumer The (nullable) consumer which will accept the computed values during this run. -+ * @return True if the producer produced any values, otherwise false -+ */ -+ boolean computeNext(Consumer consumer); -+ -+ default Producer map(Function mapper) { -+ return consumer -> { -+ Consumer con = (t) -> consumer.accept(mapper.apply(t)); -+ return Producer.this.computeNext(con); -+ }; -+ } -+ -+ static Stream asStream(Producer producer) { -+ return StreamSupport.stream(new Spliterators.AbstractSpliterator(Long.MAX_VALUE, Spliterator.ORDERED | Spliterator.NONNULL) { -+ @Override -+ public boolean tryAdvance(Consumer action) { -+ return producer.computeNext(action); -+ } -+ }, false); -+ } -+ -+ // WARNING: does not check contains, you have to do that in the add function -+ static void fillList(Producer producer, List list, BiConsumer> addFunction) { -+ HoldingConsumer consumer = new HoldingConsumer<>(); -+ while (producer.computeNext(consumer)) { -+ T value = consumer.getValue(); -+ if (value == null) { continue; } -+ addFunction.accept(value, list); -+ } -+ } -+ -+ Producer EMPTY_PRODUCER = consumer -> false; -+ -+ @SuppressWarnings("unchecked") -+ static Producer empty() { -+ return (Producer) EMPTY_PRODUCER; -+ } -+} -diff --git a/src/main/java/me/jellysquid/mods/lithium/common/world/WorldHelper.java b/src/main/java/me/jellysquid/mods/lithium/common/world/WorldHelper.java -new file mode 100644 -index 0000000000000000000000000000000000000000..f858e5dcda60391fe869264f0c4a20bb14159e82 ---- /dev/null -+++ b/src/main/java/me/jellysquid/mods/lithium/common/world/WorldHelper.java -@@ -0,0 +1,59 @@ -+package me.jellysquid.mods.lithium.common.world; -+ -+import com.google.common.collect.Lists; -+import java.util.List; -+import me.jellysquid.mods.lithium.common.entity.EntityClassGroup; -+import me.jellysquid.mods.lithium.common.world.chunk.ClassGroupFilterableList; -+import net.minecraft.server.AxisAlignedBB; -+import net.minecraft.server.Chunk; -+import net.minecraft.server.Entity; -+import net.minecraft.server.EntitySlice; -+import net.minecraft.server.MathHelper; -+import net.minecraft.server.World; -+ -+public class WorldHelper { -+ -+ /** -+ * Method that allows getting entities of a class group. -+ * [VanillaCopy] but custom combination of: get class filtered entities together with excluding one entity -+ */ -+ public static List getEntitiesOfClassGroup(World world, Entity excluded, EntityClassGroup type, AxisAlignedBB box_1, boolean loadChunks) { -+ int int_1 = MathHelper.floor((box_1.minX - 2.0D) / 16.0D); -+ int int_2 = MathHelper.f((box_1.maxX + 2.0D) / 16.0D); -+ int int_3 = MathHelper.floor((box_1.minZ - 2.0D) / 16.0D); -+ int int_4 = MathHelper.f((box_1.maxZ + 2.0D) / 16.0D); -+ List list_1 = Lists.newArrayList(); -+ -+ for (int int_5 = int_1; int_5 < int_2; ++int_5) { -+ for (int int_6 = int_3; int_6 < int_4; ++int_6) { -+ Chunk worldChunk_1 = loadChunks ? world.getChunkAt(int_5, int_6) : world.getChunkIfLoaded(int_5, int_6); -+ if (worldChunk_1 != null) { -+ WorldHelper.getEntitiesOfClassGroup(worldChunk_1, excluded, type, box_1, list_1); -+ } -+ } -+ } -+ -+ return list_1; -+ } -+ -+ /** -+ * Method that allows getting entities of a class group. -+ * [VanillaCopy] but custom combination of: get class filtered entities together with excluding one entity -+ */ -+ public static void getEntitiesOfClassGroup(Chunk worldChunk, Entity excluded, EntityClassGroup type, AxisAlignedBB box_1, List list_1) { -+ EntitySlice[] entitySections = worldChunk.getAsSlices(); -+ int int_1 = MathHelper.floor((box_1.minY - 2.0D) / 16.0D); -+ int int_2 = MathHelper.floor((box_1.maxY + 2.0D) / 16.0D); -+ int_1 = MathHelper.clamp(int_1, 0, entitySections.length - 1); -+ int_2 = MathHelper.clamp(int_2, 0, entitySections.length - 1); -+ -+ for (int int_3 = int_1; int_3 <= int_2; ++int_3) { -+ //noinspection rawtypes -+ for (Object entity_1 : ((ClassGroupFilterableList) entitySections[int_3]).getAllOfGroupType(type)) { -+ if (entity_1 != excluded && ((Entity) entity_1).getBoundingBox().intersects(box_1)) { -+ list_1.add((Entity) entity_1); -+ } -+ } -+ } -+ } -+} -diff --git a/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/ClassGroupFilterableList.java b/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/ClassGroupFilterableList.java -new file mode 100644 -index 0000000000000000000000000000000000000000..493103d755c222f2c6031ffb8f5c0b7a2e3fde77 ---- /dev/null -+++ b/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/ClassGroupFilterableList.java -@@ -0,0 +1,8 @@ -+package me.jellysquid.mods.lithium.common.world.chunk; -+ -+import java.util.Collection; -+import me.jellysquid.mods.lithium.common.entity.EntityClassGroup; -+ -+public interface ClassGroupFilterableList { -+ Collection getAllOfGroupType(EntityClassGroup type); -+} -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index f3702ed75ebcd78075da947acf9bdc2ec0379180..cee9bd91d679a867610a88bec5b8180423d52c1e 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -36,7 +36,7 @@ public class Chunk implements IChunkAccess { - public final Map heightMap; - private final ChunkConverter i; - public final Map tileEntities; -- public final List[] entitySlices; // Spigot -+ public final EntitySlice[] entitySlices; // Spigot // Yatopia - md_5 is dumb - private final Map, StructureStart> l; - private final Map, LongSet> m; - private final ShortList[] n; -@@ -244,7 +244,7 @@ public class Chunk implements IChunkAccess { - this.l = Maps.newHashMap(); - this.m = Maps.newHashMap(); - this.n = new ShortList[16]; -- this.entitySlices = (List[]) (new List[16]); // Spigot -+ this.entitySlices = new EntitySlice[16]; // Spigot // Yatopia - md_5 is stupid - this.world = (WorldServer) world; // CraftBukkit - type - this.loc = chunkcoordintpair; this.coordinateKey = MCUtil.getCoordinateKey(chunkcoordintpair); // Paper - cache coordinate key - this.i = chunkconverter; -@@ -260,7 +260,7 @@ public class Chunk implements IChunkAccess { - } - - for (int l = 0; l < this.entitySlices.length; ++l) { -- this.entitySlices[l] = new org.bukkit.craftbukkit.util.UnsafeList(); // Spigot -+ this.entitySlices[l] = new EntitySlice<>(Entity.class); // Spigot // Yatopia - md_5 is stupid - } - - this.d = biomestorage; -@@ -713,8 +713,8 @@ public class Chunk implements IChunkAccess { - k = this.entitySlices.length - 1; - } - // Paper - remove from any old list if its in one -- List nextSlice = this.entitySlices[k]; // the next list to be added to -- List currentSlice = entity.entitySlice; -+ EntitySlice nextSlice = this.entitySlices[k]; // the next list to be added to // Yatopia - paper not stupid, md_5 is -+ EntitySlice currentSlice = entity.entitySlice; // Yatopia - paper not stupid, md_5 is - if (nextSlice == currentSlice) { - if (World.DEBUG_ENTITIES) MinecraftServer.LOGGER.warn("Entity was already in this chunk!" + entity, new Throwable()); - return; // ??? silly plugins -@@ -1028,12 +1028,12 @@ public class Chunk implements IChunkAccess { - j = MathHelper.clamp(j, 0, this.entitySlices.length - 1); - - for (int k = i; k <= j; ++k) { -- List entityslice = this.entitySlices[k]; // Spigot -- List list1 = entityslice; // Spigot -+ EntitySlice entityslice = this.entitySlices[k]; // Spigot // Yatopia - md_5 is stupid -+ EntitySlice list1 = entityslice; // Spigot // Yatopia - md_5 is stupid - int l = list1.size(); - -- for (int i1 = 0; i1 < l; ++i1) { -- Entity entity1 = (Entity) list1.get(i1); -+ for (Entity entity1 : list1) { // Yatopia -+ //Entity entity1 = (Entity) list1.get(i1); // Yatopia - if (entity1.shouldBeRemoved) continue; // Paper - - if (entity1.getBoundingBox().c(axisalignedbb) && entity1 != entity) { -@@ -1166,8 +1166,16 @@ public class Chunk implements IChunkAccess { - } - - public List[] getEntitySlices() { // Spigot -- return this.entitySlices; -+ // Yatopia start -+ List[] ret = new List[entitySlices.length]; -+ for (int i = 0, len = entitySlices.length; i < len; i++) { -+ EntitySlice slice = entitySlices[i]; -+ ret[i] = slice.toList(); -+ } -+ return ret; - } -+ public EntitySlice[] getAsSlices() { return entitySlices; } -+ // Yatopia end - - @Override - public NBTTagCompound i(BlockPosition blockposition) { -diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 1bc8b11d999e9af16a44fe1cb62f5785afa82462..30d4589c9cdad11809fc09cb51235d6da8e03195 100644 ---- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java -+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -503,8 +503,11 @@ public class ChunkRegionLoader { - - chunk.d(false); - -- for (int j = 0; j < chunk.getEntitySlices().length; ++j) { -- Iterator iterator1 = chunk.getEntitySlices()[j].iterator(); -+ // Yatopia start -+ EntitySlice[] entitySlices = chunk.getAsSlices(); -+ for (int j = 0; j < entitySlices.length; ++j) { -+ Iterator iterator1 = entitySlices[j].iterator(); -+ // Yatopia end - - while (iterator1.hasNext()) { - Entity entity = (Entity) iterator1.next(); -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 5beca7e82b3f2a44c376ab2fedac27ce8b7fbd3a..6b96c392fb3eadd20f87675b797337d6d30cc7be 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -73,7 +73,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - } - } - }; -- List entitySlice = null; -+ EntitySlice entitySlice = null; // Yatopia - change to EntitySlice - public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; - // Paper end - -diff --git a/src/main/java/net/minecraft/server/EntitySlice.java b/src/main/java/net/minecraft/server/EntitySlice.java -index 1250c3cbe915815939627701c153ba6254fc05f0..cdf54580a8275f40730f9cbdc1c0c4b4a3999a90 100644 ---- a/src/main/java/net/minecraft/server/EntitySlice.java -+++ b/src/main/java/net/minecraft/server/EntitySlice.java -@@ -14,18 +14,35 @@ import java.util.Map.Entry; - import java.util.stream.Collectors; - import java.util.stream.Stream; - --public class EntitySlice extends AbstractCollection { -+// Yatopia start -+import it.unimi.dsi.fastutil.objects.ReferenceLinkedOpenHashSet; -+import it.unimi.dsi.fastutil.objects.Reference2ReferenceArrayMap; -+import me.jellysquid.mods.lithium.common.entity.EntityClassGroup; -+// Yatopia end -+ -+public class EntitySlice extends AbstractCollection implements me.jellysquid.mods.lithium.common.world.chunk.ClassGroupFilterableList { // Yatopia - - private final Map, List> a = Maps.newHashMap(); - private final Class b; -- private final List c = Lists.newArrayList(); -+ private final List c = new net.yatopia.server.list.GlueList<>(); // Yatopia -+ -+ private final Reference2ReferenceArrayMap> entitiesByGroup; // Yatopia - - public EntitySlice(Class oclass) { - this.b = oclass; - this.a.put(oclass, this.c); -+ this.entitiesByGroup = new Reference2ReferenceArrayMap<>(); // Yatopia - } - - public boolean add(T t0) { -+ // Yatopia start -+ for (Map.Entry> entityGroupAndSet : this.entitiesByGroup.entrySet()) { -+ EntityClassGroup entityGroup = entityGroupAndSet.getKey(); -+ if (entityGroup.contains(((Entity)t0).getClass())) { -+ entityGroupAndSet.getValue().add((t0)); -+ } -+ } -+ // Yatopia end - boolean flag = false; - Iterator iterator = this.a.entrySet().iterator(); - -@@ -41,6 +58,11 @@ public class EntitySlice extends AbstractCollection { - } - - public boolean remove(Object object) { -+ // Yatopia start -+ for (Map.Entry> entityGroupAndSet : this.entitiesByGroup.entrySet()) { -+ entityGroupAndSet.getValue().remove(object); -+ } -+ // Yatopia end - boolean flag = false; - Iterator iterator = this.a.entrySet().iterator(); - -@@ -61,10 +83,13 @@ public class EntitySlice extends AbstractCollection { - return this.a(object.getClass()).contains(object); - } - -+ @SuppressWarnings("unchecked") // Yatopia - public Collection a(Class oclass) { - if (!this.b.isAssignableFrom(oclass)) { - throw new IllegalArgumentException("Don't know how to search for " + oclass); - } else { -+ // Yatopia start - replace this -+ /* - List list = (List) this.a.computeIfAbsent(oclass, (oclass1) -> { - Stream stream = this.c.stream(); - -@@ -73,6 +98,18 @@ public class EntitySlice extends AbstractCollection { - }); - - return Collections.unmodifiableCollection(list); -+ */ -+ if (a.containsKey(oclass)) { -+ return (Collection) Collections.unmodifiableCollection(a.get(oclass)); -+ } -+ List list = new net.yatopia.server.list.GlueList<>(); -+ for (T allElement : this.c) { -+ if (oclass.isInstance(allElement)) { -+ list.add(allElement); -+ } -+ } -+ a.put(oclass, list); -+ return (Collection) Collections.unmodifiableCollection(list); - } - } - -@@ -81,10 +118,44 @@ public class EntitySlice extends AbstractCollection { - } - - public List a() { -- return ImmutableList.copyOf(this.c); -+ return Collections.unmodifiableList(this.c); // Yatopia - avoid copying - } - - public int size() { - return this.c.size(); - } -+ -+ // Yatopia start -+ @Override -+ public Collection getAllOfGroupType(EntityClassGroup type) { -+ Collection collection = this.entitiesByGroup.get(type); -+ -+ if (collection == null) { -+ collection = this.createAllOfGroupType(type); -+ } -+ -+ return Collections.unmodifiableCollection(collection); -+ } -+ -+ private Collection createAllOfGroupType(EntityClassGroup type) { -+ ReferenceLinkedOpenHashSet allOfType = new ReferenceLinkedOpenHashSet<>(); -+ -+ for (T entity : this.c) { -+ if (type.contains(entity.getClass())) { -+ allOfType.add(entity); -+ } -+ } -+ this.entitiesByGroup.put(type, allOfType); -+ return allOfType; -+ } -+ -+ /** -+ * A workaround about md_5's dumb changes -+ * -+ * @return list representation of EntitySlice -+ */ -+ public List toList() { -+ return c; -+ } -+ // Yatopia end - } -diff --git a/src/main/java/net/minecraft/server/ICollisionAccess.java b/src/main/java/net/minecraft/server/ICollisionAccess.java -index b66c802d5e27518069bf42e577bcc9a26c4d873e..22728e5ba8b2dd6efc3164d06ea791693de50936 100644 ---- a/src/main/java/net/minecraft/server/ICollisionAccess.java -+++ b/src/main/java/net/minecraft/server/ICollisionAccess.java -@@ -52,7 +52,14 @@ public interface ICollisionAccess extends IBlockAccess { - default boolean getCubes(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate predicate) { - // Tuinity end - allow overriding in WorldServer - try { if (entity != null) entity.collisionLoadChunks = true; // Paper -- return this.d(entity, axisalignedbb, predicate).allMatch(VoxelShape::isEmpty); -+ // Yatopia start -+ //return this.d(entity, axisalignedbb, predicate).allMatch(VoxelShape::isEmpty); -+ boolean ret = !me.jellysquid.mods.lithium.common.entity.LithiumEntityCollisions.doesBoxCollideWithBlocks(this, entity, axisalignedbb); -+ if (ret && this instanceof IEntityAccess) { -+ ret = !me.jellysquid.mods.lithium.common.entity.LithiumEntityCollisions.doesBoxCollideWithEntities((IEntityAccess) this, entity, axisalignedbb, predicate); -+ } -+ return ret; -+ // Yatopia end - } finally { if (entity != null) entity.collisionLoadChunks = false; } // Paper - } - -@@ -63,7 +70,7 @@ public interface ICollisionAccess extends IBlockAccess { - } - - default Stream b(@Nullable Entity entity, AxisAlignedBB axisalignedbb) { -- return StreamSupport.stream(new VoxelShapeSpliterator(this, entity, axisalignedbb), false); -+ return me.jellysquid.mods.lithium.common.entity.LithiumEntityCollisions.getBlockCollisions(this, entity, axisalignedbb); // Yatopia - } - - default Stream b(@Nullable Entity entity, AxisAlignedBB axisalignedbb, BiPredicate bipredicate) { -diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java -index 40ca3364d462dc7b5a4c1f8f353c758a421656bf..7657d13dd7556e4c32088bbe5735df525c0b2922 100644 ---- a/src/main/java/net/minecraft/server/IEntityAccess.java -+++ b/src/main/java/net/minecraft/server/IEntityAccess.java -@@ -62,6 +62,10 @@ public interface IEntityAccess { - // Tuinity end - optimise hard collision - - default Stream c(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate predicate) { -+ // Yatopia start - replace this -+ if (predicate == null) predicate = (e) -> true; // Tuinity - allow nullable -+ return me.jellysquid.mods.lithium.common.entity.LithiumEntityCollisions.getEntityCollisions(this, entity, axisalignedbb, predicate); -+ /* - if (axisalignedbb.a() < 1.0E-7D) { - return Stream.empty(); - } else { -@@ -91,6 +95,7 @@ public interface IEntityAccess { - return flag; - }); return ((entity != null && entity.hardCollides()) ? this.getEntities(entity, axisalignedbb1, predicate) : this.getHardCollidingEntities(entity, axisalignedbb1, predicate)).stream().map(Entity::getBoundingBox).map(VoxelShapes::a); // Tuinity - optimise entity hard collisions - } -+ */ // Yatopia end - } - - default EntityHuman findNearbyPlayer(Entity entity, double d0, @Nullable Predicate predicate) { return this.findNearbyPlayer(entity.locX(), entity.locY(), entity.locZ(), d0, predicate); } // Paper -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index f10a135f87a2383fe10ff34bda685cf4784081e9..52e064b67d984930d778333c5e8977b5d17c3cab 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -1364,11 +1364,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - chunk.setLoaded(true); - this.world.a(chunk.getTileEntities().values()); - List list = null; -- List[] aentityslice = chunk.getEntitySlices(); // Spigot -+ EntitySlice[] aentityslice = chunk.getAsSlices(); // Spigot // Yatopia - md_5 is stupid - int i = aentityslice.length; - - for (int j = 0; j < i; ++j) { -- List entityslice = aentityslice[j]; // Spigot -+ EntitySlice entityslice = aentityslice[j]; // Spigot // Yatopia - md_5 is stupid - Iterator iterator = entityslice.iterator(); - - while (iterator.hasNext()) { -@@ -1649,7 +1649,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - - // CraftBukkit - decompile error - csvwriter.a(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(IChunkAccess::getChunkStatus).orElse(null), optional1.map(Chunk::getState).orElse(null), a(playerchunk.c()), a(playerchunk.a()), a(playerchunk.b()), this.chunkDistanceManager.c(entry.getLongKey()), !this.isOutsideOfRange(chunkcoordintpair), optional1.map((chunk) -> { -- return Stream.of(chunk.getEntitySlices()).mapToInt(List::size).sum(); // Spigot -+ return Stream.of(chunk.getAsSlices()).mapToInt(EntitySlice::size).sum(); // Spigot // Yatopia - }).orElse(0), optional1.map((chunk) -> { - return chunk.getTileEntities().size(); - }).orElse(0)); -diff --git a/src/main/java/net/minecraft/server/VoxelShape.java b/src/main/java/net/minecraft/server/VoxelShape.java -index 700660dd93b3090334bb3033d5f5fdd6ab684744..98f9ded42264cb88cff701a85d22d99e203ef7cf 100644 ---- a/src/main/java/net/minecraft/server/VoxelShape.java -+++ b/src/main/java/net/minecraft/server/VoxelShape.java -@@ -78,7 +78,7 @@ public abstract class VoxelShape { - - public final List getBoundingBoxesRepresentation() { return this.d(); } // Tuinity - OBFHELPER - public List d() { -- List list = Lists.newArrayList(); -+ List list = new net.yatopia.server.list.GlueList<>(); // Yatopia - - this.b((d0, d1, d2, d3, d4, d5) -> { - list.add(new AxisAlignedBB(d0, d1, d2, d3, d4, d5)); -diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java -index db735e29d427cc8f4bd4ba54c7a44daf9fed9e61..877ef81bd8285167ce11c116b8ad803fda63c6c9 100644 ---- a/src/main/java/net/minecraft/server/VoxelShapes.java -+++ b/src/main/java/net/minecraft/server/VoxelShapes.java -@@ -40,7 +40,9 @@ public final class VoxelShapes { - if (shape instanceof com.tuinity.tuinity.voxel.AABBVoxelShape) { - com.tuinity.tuinity.voxel.AABBVoxelShape shapeCasted = (com.tuinity.tuinity.voxel.AABBVoxelShape)shape; - if (shapeCasted.aabb.voxelShapeIntersect(aabb)) { -+ if (!list.contains(shapeCasted.aabb)) { // Yatopia start - make sure it doesn't contain already - list.add(shapeCasted.aabb); -+ } // Yatopia end - } - } else if (shape instanceof VoxelShapeArray) { - VoxelShapeArray shapeCasted = (VoxelShapeArray)shape; -@@ -54,14 +56,19 @@ public final class VoxelShapes { - double minX, minY, minZ, maxX, maxY, maxZ; - if (aabb.voxelShapeIntersect(minX = boundingBox.minX + offX, minY = boundingBox.minY + offY, minZ = boundingBox.minZ + offZ, - maxX = boundingBox.maxX + offX, maxY = boundingBox.maxY + offY, maxZ = boundingBox.maxZ + offZ)) { -- list.add(new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ, false)); -+ // Yatopia start - make sure it doesn't contain already -+ AxisAlignedBB addedBox = new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ, false); -+ if (!list.contains(addedBox)) { -+ list.add(addedBox); -+ } -+ // Yatopia end - } - } - } else { - java.util.List boxes = shape.getBoundingBoxesRepresentation(); - for (int i = 0, len = boxes.size(); i < len; ++i) { - AxisAlignedBB box = boxes.get(i); -- if (box.voxelShapeIntersect(aabb)) { -+ if (box.voxelShapeIntersect(aabb) && !list.contains(box)) { // Yatopia - make sure it doesn't contain already - list.add(box); - } - } -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 9417032aecb79916a9dbde71e2447d00018e3b28..a728b5a95a02e713c288e52dd6b8e309e55241e8 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -787,8 +787,14 @@ public class WorldServer extends World implements GeneratorAccessSeed { - } - - public final void getCollisions(@Nullable Entity entity, AxisAlignedBB axisalignedbb, List list, boolean loadChunks) { -+ // Yatopia start - jellysquid is better -+ /* - this.getCollisionsForBlocksOrWorldBorder(entity, axisalignedbb, list, loadChunks); - this.getEntityHardCollisions(entity, axisalignedbb, null, list); -+ */ -+ me.jellysquid.mods.lithium.common.entity.LithiumEntityCollisions.fillEntityCollisionsList(this, entity, list, axisalignedbb, loadChunks); -+ me.jellysquid.mods.lithium.common.entity.LithiumEntityCollisions.fillBlockCollisionsList(this, list, entity, axisalignedbb); -+ // Yatopia end - } - - @Override -@@ -1869,12 +1875,12 @@ public class WorldServer extends World implements GeneratorAccessSeed { - } - // Spigot End - this.tileEntityListUnload.addAll(chunk.getTileEntities().values()); -- List[] aentityslice = chunk.getEntitySlices(); // Spigot -+ EntitySlice[] aentityslice = chunk.getAsSlices(); // Spigot // Yatopia - md_5 is stupid - int i = aentityslice.length; - - java.util.List toMoveChunks = new java.util.ArrayList<>(); // Paper - for (int j = 0; j < i; ++j) { -- List entityslice = aentityslice[j]; // Spigot -+ EntitySlice entityslice = aentityslice[j]; // Spigot // Yatopia - md_5 is stupid - Iterator iterator = entityslice.iterator(); - - while (iterator.hasNext()) { -diff --git a/src/main/java/net/yatopia/server/HoldingConsumer.java b/src/main/java/net/yatopia/server/HoldingConsumer.java -new file mode 100644 -index 0000000000000000000000000000000000000000..44f39064fa52b8249887f83494b71699d653c4f8 ---- /dev/null -+++ b/src/main/java/net/yatopia/server/HoldingConsumer.java -@@ -0,0 +1,17 @@ -+package net.yatopia.server; -+ -+import java.util.function.Consumer; -+ -+public final class HoldingConsumer implements Consumer { -+ -+ private T value; -+ -+ @Override -+ public void accept(T t) { -+ this.value = t; -+ } -+ -+ public T getValue() { -+ return value; -+ } -+} diff --git a/patches/server/0039-Nuke-streams-off-BlockPosition.patch b/patches/server/0035-Nuke-streams-off-BlockPosition.patch similarity index 91% rename from patches/server/0039-Nuke-streams-off-BlockPosition.patch rename to patches/server/0035-Nuke-streams-off-BlockPosition.patch index 57a726e1..42463516 100644 --- a/patches/server/0039-Nuke-streams-off-BlockPosition.patch +++ b/patches/server/0035-Nuke-streams-off-BlockPosition.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Nuke streams off BlockPosition diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java -index a3ead1e695245aacde118daa12e21669f2064a00..7e59a5e620e8a2ccffd494d643a7d51a8944dec1 100644 +index fdfd955aad65b758696b72a71521ec74e9aa122a..7c3e792b53329c869fbd21e298961b3f254c6ef5 100644 --- a/src/main/java/net/minecraft/server/BlockBase.java +++ b/src/main/java/net/minecraft/server/BlockBase.java -@@ -641,6 +641,7 @@ public abstract class BlockBase { +@@ -639,6 +639,7 @@ public abstract class BlockBase { return this.getBlock().getInventory(this.p(), world, blockposition); } @@ -16,7 +16,7 @@ index a3ead1e695245aacde118daa12e21669f2064a00..7e59a5e620e8a2ccffd494d643a7d51a public boolean a(Tag tag) { return this.getBlock().a(tag); } -@@ -649,6 +650,7 @@ public abstract class BlockBase { +@@ -647,6 +648,7 @@ public abstract class BlockBase { return this.getBlock().a(tag) && predicate.test(this); } diff --git a/patches/server/0040-Nuke-streams-off-SectionPosition.patch b/patches/server/0036-Nuke-streams-off-SectionPosition.patch similarity index 100% rename from patches/server/0040-Nuke-streams-off-SectionPosition.patch rename to patches/server/0036-Nuke-streams-off-SectionPosition.patch diff --git a/patches/server/0036-lithium-MixinChunkSection.patch b/patches/server/0036-lithium-MixinChunkSection.patch deleted file mode 100644 index 8f11f043..00000000 --- a/patches/server/0036-lithium-MixinChunkSection.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: JellySquid -Date: Thu, 20 Aug 2020 17:25:11 +0300 -Subject: [PATCH] lithium MixinChunkSection - -Original code by JellySquid, licensed under LGPLv3 -you can find the original code on https://github.com/jellysquid3/lithium-fabric/ (Yarn mappings) - -diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java -index fdfd955aad65b758696b72a71521ec74e9aa122a..a3ead1e695245aacde118daa12e21669f2064a00 100644 ---- a/src/main/java/net/minecraft/server/BlockBase.java -+++ b/src/main/java/net/minecraft/server/BlockBase.java -@@ -352,6 +352,8 @@ public abstract class BlockBase { - } - // Tuinity end - -+ public final boolean shapeExceedsCubeUncached() { return this.a == null || this.a.c; } // Yatopia - uncached shapeExceedsCube due to collisions stuff -+ - public void a() { - this.fluid = this.getBlock().d(this.p()); // Paper - moved from getFluid() - this.isTicking = this.getBlock().isTicking(this.p()); // Paper - moved from isTicking() -diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index cebd808e273dbdb88feb16920dd7a2f60390b34f..d210ac3d5775491e9beb885dde608f5e8fda8eb2 100644 ---- a/src/main/java/net/minecraft/server/ChunkSection.java -+++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -4,7 +4,7 @@ import java.util.function.Predicate; - import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info - import javax.annotation.Nullable; - --public class ChunkSection { -+public class ChunkSection implements me.jellysquid.mods.lithium.common.entity.movement.ChunkAwareBlockCollisionSweeper.OversizedBlocksCounter { // Yatopia - - public static final DataPalette GLOBAL_PALETTE = new DataPaletteGlobal<>(Block.REGISTRY_ID, Blocks.AIR.getBlockData()); - final int yPos; // Paper - private -> package-private -@@ -12,6 +12,7 @@ public class ChunkSection { - short tickingBlockCount; // Paper - private -> package-private - private short e; - final DataPaletteBlock blockIds; // Paper - package-private -+ private short oversizedBlockCount = 0; // Yatopia - - final com.destroystokyo.paper.util.maplist.IBlockDataList tickingList = new com.destroystokyo.paper.util.maplist.IBlockDataList(); // Paper - -@@ -67,6 +68,7 @@ public class ChunkSection { - - if (!iblockdata1.isAir()) { - --this.nonEmptyBlockCount; -+ if (iblockdata1.shapeExceedsCubeUncached()) this.oversizedBlockCount--; // Yatopia - if (iblockdata1.isTicking()) { - --this.tickingBlockCount; - // Paper start -@@ -81,6 +83,7 @@ public class ChunkSection { - - if (!iblockdata.isAir()) { - ++this.nonEmptyBlockCount; -+ if (iblockdata.shapeExceedsCubeUncached()) this.oversizedBlockCount++; // Yatopia - if (iblockdata.isTicking()) { - ++this.tickingBlockCount; - // Paper start -@@ -126,10 +129,12 @@ public class ChunkSection { - // Paper start - this.tickingList.clear(); - // Paper end -+ this.oversizedBlockCount = 0; // Yatopia - this.nonEmptyBlockCount = 0; - this.tickingBlockCount = 0; - this.e = 0; - this.blockIds.forEachLocation((iblockdata, location) -> { // Paper -+ if (iblockdata.shapeExceedsCubeUncached()) this.oversizedBlockCount += location; // Yatopia - Fluid fluid = iblockdata.getFluid(); - - if (!iblockdata.isAir()) { -@@ -173,4 +178,11 @@ public class ChunkSection { - public boolean a(Predicate predicate) { - return this.blockIds.contains(predicate); - } -+ -+ // Yatopia start -+ @Override -+ public boolean hasOversizedBlocks() { -+ return this.oversizedBlockCount > 0; -+ } -+ // Yatopia end - } diff --git a/patches/server/0041-Stop-wasting-resources-on-JsonList-get.patch b/patches/server/0037-Stop-wasting-resources-on-JsonList-get.patch similarity index 100% rename from patches/server/0041-Stop-wasting-resources-on-JsonList-get.patch rename to patches/server/0037-Stop-wasting-resources-on-JsonList-get.patch diff --git a/patches/server/0042-ProxyForwardDataEvent.patch b/patches/server/0038-ProxyForwardDataEvent.patch similarity index 100% rename from patches/server/0042-ProxyForwardDataEvent.patch rename to patches/server/0038-ProxyForwardDataEvent.patch diff --git a/patches/server/0044-Fix-LightEngineThreaded-memory-leak.patch b/patches/server/0039-Fix-LightEngineThreaded-memory-leak.patch similarity index 89% rename from patches/server/0044-Fix-LightEngineThreaded-memory-leak.patch rename to patches/server/0039-Fix-LightEngineThreaded-memory-leak.patch index 74d37d6f..a01a8aec 100644 --- a/patches/server/0044-Fix-LightEngineThreaded-memory-leak.patch +++ b/patches/server/0039-Fix-LightEngineThreaded-memory-leak.patch @@ -18,10 +18,10 @@ index 2f9c97dd4e1d705a87772d18c7ab4883a876af08..f3494ac1ad659352ca5595adf9e6919b return this.size == 0 && this.pendingTasks.isEmpty(); } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index a728b5a95a02e713c288e52dd6b8e309e55241e8..d2e3cab67cdcb195747710ae719693dedc092038 100644 +index 9417032aecb79916a9dbde71e2447d00018e3b28..abc62fb1e95f75355871e06341d6687433d74e94 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1911,6 +1911,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1905,6 +1905,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } // Paper end diff --git a/patches/server/0045-Respect-PlayerKickEvent-leaveMessage.patch b/patches/server/0040-Respect-PlayerKickEvent-leaveMessage.patch similarity index 100% rename from patches/server/0045-Respect-PlayerKickEvent-leaveMessage.patch rename to patches/server/0040-Respect-PlayerKickEvent-leaveMessage.patch diff --git a/patches/server/0046-Shutdown-Bootstrap-thread-pool.patch b/patches/server/0041-Shutdown-Bootstrap-thread-pool.patch similarity index 100% rename from patches/server/0046-Shutdown-Bootstrap-thread-pool.patch rename to patches/server/0041-Shutdown-Bootstrap-thread-pool.patch diff --git a/patches/server/0047-Optimize-Villagers.patch b/patches/server/0042-Optimize-Villagers.patch similarity index 100% rename from patches/server/0047-Optimize-Villagers.patch rename to patches/server/0042-Optimize-Villagers.patch diff --git a/patches/server/0043-Fix-Unable-to-save-chunk-error.patch b/patches/server/0043-Fix-Unable-to-save-chunk-error.patch deleted file mode 100644 index 34a3d8da..00000000 --- a/patches/server/0043-Fix-Unable-to-save-chunk-error.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ivan Pekov -Date: Thu, 10 Sep 2020 10:36:21 +0300 -Subject: [PATCH] Fix "Unable to save chunk" error - - -diff --git a/src/main/java/net/minecraft/server/EntitySlice.java b/src/main/java/net/minecraft/server/EntitySlice.java -index cdf54580a8275f40730f9cbdc1c0c4b4a3999a90..cf4da23e790af36e450fb1ffee9cab84b1c5f508 100644 ---- a/src/main/java/net/minecraft/server/EntitySlice.java -+++ b/src/main/java/net/minecraft/server/EntitySlice.java -@@ -114,7 +114,7 @@ public class EntitySlice extends AbstractCollection implements me.jellysqu - } - - public Iterator iterator() { -- return (Iterator) (this.c.isEmpty() ? Collections.emptyIterator() : Iterators.unmodifiableIterator(this.c.iterator())); -+ return (this.c.isEmpty() ? Collections.emptyIterator() : this.c.iterator()); // Yatopia - fix unable to save chunk - } - - public List a() { diff --git a/patches/server/0048-Optimize-whitelist-command-for-multiple-additions-re.patch b/patches/server/0043-Optimize-whitelist-command-for-multiple-additions-re.patch similarity index 100% rename from patches/server/0048-Optimize-whitelist-command-for-multiple-additions-re.patch rename to patches/server/0043-Optimize-whitelist-command-for-multiple-additions-re.patch diff --git a/patches/server/0049-PlayerAttackEntityEvent.patch b/patches/server/0044-PlayerAttackEntityEvent.patch similarity index 100% rename from patches/server/0049-PlayerAttackEntityEvent.patch rename to patches/server/0044-PlayerAttackEntityEvent.patch diff --git a/patches/server/0050-Ensure-pools-create-daemon-threads.patch b/patches/server/0045-Ensure-pools-create-daemon-threads.patch similarity index 100% rename from patches/server/0050-Ensure-pools-create-daemon-threads.patch rename to patches/server/0045-Ensure-pools-create-daemon-threads.patch diff --git a/patches/server/0051-Add-StructureLocateEvent.patch b/patches/server/0046-Add-StructureLocateEvent.patch similarity index 100% rename from patches/server/0051-Add-StructureLocateEvent.patch rename to patches/server/0046-Add-StructureLocateEvent.patch diff --git a/patches/server/0052-Add-IntelliJ-IDEA-runnable.patch b/patches/server/0047-Add-IntelliJ-IDEA-runnable.patch similarity index 100% rename from patches/server/0052-Add-IntelliJ-IDEA-runnable.patch rename to patches/server/0047-Add-IntelliJ-IDEA-runnable.patch diff --git a/patches/server/0053-PaperPR-Fix-merging-spawning-values.patch b/patches/server/0048-PaperPR-Fix-merging-spawning-values.patch similarity index 100% rename from patches/server/0053-PaperPR-Fix-merging-spawning-values.patch rename to patches/server/0048-PaperPR-Fix-merging-spawning-values.patch diff --git a/patches/server/0054-Use-Glue-List-in-WeightedList.patch b/patches/server/0049-Use-Glue-List-in-WeightedList.patch similarity index 100% rename from patches/server/0054-Use-Glue-List-in-WeightedList.patch rename to patches/server/0049-Use-Glue-List-in-WeightedList.patch diff --git a/patches/server/0055-Fix-IndexOutOfBoundsException-when-sending-too-many-.patch b/patches/server/0050-Fix-IndexOutOfBoundsException-when-sending-too-many-.patch similarity index 100% rename from patches/server/0055-Fix-IndexOutOfBoundsException-when-sending-too-many-.patch rename to patches/server/0050-Fix-IndexOutOfBoundsException-when-sending-too-many-.patch diff --git a/patches/server/0057-Add-nspt-command.patch b/patches/server/0051-Add-nspt-command.patch similarity index 100% rename from patches/server/0057-Add-nspt-command.patch rename to patches/server/0051-Add-nspt-command.patch diff --git a/patches/server/0058-Configurable-flight-checks.patch b/patches/server/0052-Configurable-flight-checks.patch similarity index 100% rename from patches/server/0058-Configurable-flight-checks.patch rename to patches/server/0052-Configurable-flight-checks.patch diff --git a/patches/server/0059-Use-Glue-List-as-delegate-for-NonNullList.patch b/patches/server/0053-Use-Glue-List-as-delegate-for-NonNullList.patch similarity index 100% rename from patches/server/0059-Use-Glue-List-as-delegate-for-NonNullList.patch rename to patches/server/0053-Use-Glue-List-as-delegate-for-NonNullList.patch diff --git a/patches/server/0060-Heavily-optimize-recipe-lookups-in-CraftingManager.patch b/patches/server/0054-Heavily-optimize-recipe-lookups-in-CraftingManager.patch similarity index 100% rename from patches/server/0060-Heavily-optimize-recipe-lookups-in-CraftingManager.patch rename to patches/server/0054-Heavily-optimize-recipe-lookups-in-CraftingManager.patch diff --git a/patches/server/0061-Improve-task-performance.patch b/patches/server/0055-Improve-task-performance.patch similarity index 100% rename from patches/server/0061-Improve-task-performance.patch rename to patches/server/0055-Improve-task-performance.patch diff --git a/patches/server/0062-Optimize-advancement-loading.patch b/patches/server/0056-Optimize-advancement-loading.patch similarity index 100% rename from patches/server/0062-Optimize-advancement-loading.patch rename to patches/server/0056-Optimize-advancement-loading.patch diff --git a/patches/server/0056-Use-faster-block-collision-check-for-entity-suffocat.patch b/patches/server/0056-Use-faster-block-collision-check-for-entity-suffocat.patch deleted file mode 100644 index 561ef54e..00000000 --- a/patches/server/0056-Use-faster-block-collision-check-for-entity-suffocat.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mykyta Komarn -Date: Tue, 29 Sep 2020 17:27:30 -0700 -Subject: [PATCH] Use faster block collision check for entity suffocation check - -Improves the speed of checks by ~3,000ns per entity on average. - -diff --git a/src/main/java/me/jellysquid/mods/lithium/common/entity/movement/ChunkAwareBlockCollisionSweeper.java b/src/main/java/me/jellysquid/mods/lithium/common/entity/movement/ChunkAwareBlockCollisionSweeper.java -index 7ed343cfb3130446c85dab2ca04d60f91e2c94fb..194d2f177b05c594c7a27b6191860a3f89394f06 100644 ---- a/src/main/java/me/jellysquid/mods/lithium/common/entity/movement/ChunkAwareBlockCollisionSweeper.java -+++ b/src/main/java/me/jellysquid/mods/lithium/common/entity/movement/ChunkAwareBlockCollisionSweeper.java -@@ -16,6 +16,7 @@ import net.minecraft.server.VoxelShape; - import net.minecraft.server.VoxelShapeCollision; - import net.minecraft.server.VoxelShapes; - -+import java.util.function.BiPredicate; // Yatopia - import static me.jellysquid.mods.lithium.common.entity.LithiumEntityCollisions.EPSILON; - - /** -@@ -59,6 +60,21 @@ public class ChunkAwareBlockCollisionSweeper { - private ChunkSection cachedChunkSection; - private boolean needEntityCollisionCheck; - -+ // Yatopia start -+ private boolean checkSuffocation; -+ private final BiPredicate suffocationPredicate = new BiPredicate() { -+ @Override -+ public boolean test(IBlockData iBlockData, BlockPosition blockPosition) { -+ return iBlockData.o(view, blockPosition); -+ } -+ }; -+ -+ public ChunkAwareBlockCollisionSweeper(ICollisionAccess view, Entity entity, AxisAlignedBB box, boolean checkSuffocation) { -+ this(view, entity, box); -+ this.checkSuffocation = checkSuffocation; -+ } -+ // Yatopia end -+ - public ChunkAwareBlockCollisionSweeper(ICollisionAccess view, Entity entity, AxisAlignedBB box) { - this.box = box; - this.shape = VoxelShapes.of(box); -@@ -206,6 +222,11 @@ public class ChunkAwareBlockCollisionSweeper { - - if (canInteractWithBlock(state, edgesHit)) { - this.pos.setValues(x, y, z); -+ // Yatopia start -+ if (checkSuffocation && !suffocationPredicate.test(state, this.pos)) { -+ continue; -+ } -+ // Yatopia end - VoxelShape collisionShape = state.getCollisionShape(this.view, this.pos, this.context); - - if (collisionShape != VoxelShapes.empty()) { -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 6b96c392fb3eadd20f87675b797337d6d30cc7be..52d5f11edccd936eea85dc3610b91558e1409117 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2186,9 +2186,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - float f1 = this.size.width * 0.8F; - AxisAlignedBB axisalignedbb = AxisAlignedBB.g((double) f1, 0.10000000149011612D, (double) f1).d(this.locX(), this.getHeadY(), this.locZ()); - -+ /* TODO Tuinity optimized method overridden - return ((WorldServer)this.world).collidesWithAnyBlockOrWorldBorder(this, axisalignedbb, false, false, (iblockdata, blockposition) -> { // Tuinity - use optimised method - return iblockdata.o(this.world, blockposition); - }); // Tuinity - use optimised method -+ */ -+ return new me.jellysquid.mods.lithium.common.entity.movement.ChunkAwareBlockCollisionSweeper(this.world, this, axisalignedbb, true).getNextCollidedShape() != null; // Yatopia - fast suffocation check - } - } - diff --git a/patches/server/0063-Use-GlueList-for-some-list-initialisations-in-packet.patch b/patches/server/0057-Use-GlueList-for-some-list-initialisations-in-packet.patch similarity index 100% rename from patches/server/0063-Use-GlueList-for-some-list-initialisations-in-packet.patch rename to patches/server/0057-Use-GlueList-for-some-list-initialisations-in-packet.patch diff --git a/patches/server/0064-PaperPR-Fix-harming-potion-dupe.patch b/patches/server/0058-PaperPR-Fix-harming-potion-dupe.patch similarity index 100% rename from patches/server/0064-PaperPR-Fix-harming-potion-dupe.patch rename to patches/server/0058-PaperPR-Fix-harming-potion-dupe.patch diff --git a/patches/server/0065-lithium-PerlinNoiseSamplerMixin.patch b/patches/server/0059-lithium-PerlinNoiseSamplerMixin.patch similarity index 100% rename from patches/server/0065-lithium-PerlinNoiseSamplerMixin.patch rename to patches/server/0059-lithium-PerlinNoiseSamplerMixin.patch diff --git a/patches/server/0066-lithium-VoronoiBiomeAccessTypeMixin.patch b/patches/server/0060-lithium-VoronoiBiomeAccessTypeMixin.patch similarity index 100% rename from patches/server/0066-lithium-VoronoiBiomeAccessTypeMixin.patch rename to patches/server/0060-lithium-VoronoiBiomeAccessTypeMixin.patch diff --git a/patches/server/0067-lithium-NoiseChunkGeneratorMixin.patch b/patches/server/0061-lithium-NoiseChunkGeneratorMixin.patch similarity index 94% rename from patches/server/0067-lithium-NoiseChunkGeneratorMixin.patch rename to patches/server/0061-lithium-NoiseChunkGeneratorMixin.patch index f0786990..ad4db7ad 100644 --- a/patches/server/0067-lithium-NoiseChunkGeneratorMixin.patch +++ b/patches/server/0061-lithium-NoiseChunkGeneratorMixin.patch @@ -8,7 +8,7 @@ Original code by SuperCoder79, licensed under LGPLv3 you can find the original code on https://github.com/jellysquid3/lithium-fabric/ (Yarn mappings) diff --git a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -index 119804e5c12aca3f4fbfeaf424f46152f43b3941..e012510612a25fee850e583b3733ff49e8e41319 100644 +index 321ebe8891defb46f3ad3dfea37c9bb6e2025ad7..fa60285c0c48147ad09b9197bfe577f504dd34bd 100644 --- a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java +++ b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java @@ -5,6 +5,8 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; @@ -20,7 +20,7 @@ index 119804e5c12aca3f4fbfeaf424f46152f43b3941..e012510612a25fee850e583b3733ff49 import java.util.Iterator; import java.util.List; import java.util.Random; -@@ -112,7 +114,15 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { +@@ -111,7 +113,15 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { return this.w == i && ((GeneratorSettingBase) this.h.get()).a(resourcekey); } @@ -36,7 +36,7 @@ index 119804e5c12aca3f4fbfeaf424f46152f43b3941..e012510612a25fee850e583b3733ff49 double d4 = 0.0D; double d5 = 0.0D; double d6 = 0.0D; -@@ -148,7 +158,85 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { +@@ -147,7 +157,85 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { } return MathHelper.b(d4 / 512.0D, d5 / 512.0D, (d6 / 10.0D + 1.0D) / 2.0D); @@ -122,7 +122,7 @@ index 119804e5c12aca3f4fbfeaf424f46152f43b3941..e012510612a25fee850e583b3733ff49 private double[] b(int i, int j) { double[] adouble = new double[this.o + 1]; -@@ -275,7 +363,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { +@@ -273,7 +361,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { double d2 = d1 * 24.575625D - 2.0D; @@ -131,7 +131,7 @@ index 119804e5c12aca3f4fbfeaf424f46152f43b3941..e012510612a25fee850e583b3733ff49 } @Override -@@ -292,10 +380,10 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { +@@ -290,10 +378,10 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { } private int a(int i, int j, @Nullable IBlockData[] aiblockdata, @Nullable Predicate predicate) { @@ -146,7 +146,7 @@ index 119804e5c12aca3f4fbfeaf424f46152f43b3941..e012510612a25fee850e583b3733ff49 double d0 = (double) i1 / (double) this.m; double d1 = (double) j1 / (double) this.m; double[][] adouble = new double[][]{this.b(k, l), this.b(k, l + 1), this.b(k + 1, l), this.b(k + 1, l + 1)}; -@@ -534,9 +622,9 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { +@@ -532,9 +620,9 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { StructurePiece structurepiece = (StructurePiece) objectlistiterator.next(); StructureBoundingBox structureboundingbox = structurepiece.g(); @@ -158,7 +158,7 @@ index 119804e5c12aca3f4fbfeaf424f46152f43b3941..e012510612a25fee850e583b3733ff49 } objectlistiterator.back(objectlist.size()); -@@ -591,7 +679,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { +@@ -589,7 +677,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { double d0 = (double) (i * i + k * k); double d1 = (double) j + 0.5D; double d2 = d1 * d1; diff --git a/patches/server/0068-lithium-reduce-allocations.patch b/patches/server/0062-lithium-reduce-allocations.patch similarity index 100% rename from patches/server/0068-lithium-reduce-allocations.patch rename to patches/server/0062-lithium-reduce-allocations.patch diff --git a/patches/server/0069-Smarter-statistics-ticking.patch b/patches/server/0063-Smarter-statistics-ticking.patch similarity index 100% rename from patches/server/0069-Smarter-statistics-ticking.patch rename to patches/server/0063-Smarter-statistics-ticking.patch diff --git a/patches/server/0070-Configurable-criterion-triggers.patch b/patches/server/0064-Configurable-criterion-triggers.patch similarity index 100% rename from patches/server/0070-Configurable-criterion-triggers.patch rename to patches/server/0064-Configurable-criterion-triggers.patch diff --git a/patches/server/0071-Configurable-BlockPhysicsEvent.patch b/patches/server/0065-Configurable-BlockPhysicsEvent.patch similarity index 100% rename from patches/server/0071-Configurable-BlockPhysicsEvent.patch rename to patches/server/0065-Configurable-BlockPhysicsEvent.patch diff --git a/patches/server/0072-Infinity-No-Arrows.patch b/patches/server/0066-Infinity-No-Arrows.patch similarity index 100% rename from patches/server/0072-Infinity-No-Arrows.patch rename to patches/server/0066-Infinity-No-Arrows.patch diff --git a/patches/server/0073-Custom-Locale-Support.patch b/patches/server/0067-Custom-Locale-Support.patch similarity index 100% rename from patches/server/0073-Custom-Locale-Support.patch rename to patches/server/0067-Custom-Locale-Support.patch diff --git a/patches/server/0075-Configurable-movement-checks.patch b/patches/server/0068-Configurable-movement-checks.patch similarity index 100% rename from patches/server/0075-Configurable-movement-checks.patch rename to patches/server/0068-Configurable-movement-checks.patch diff --git a/patches/server/0074-Make-sure-the-block-is-cauldron-before-proceeding.patch b/patches/server/0074-Make-sure-the-block-is-cauldron-before-proceeding.patch deleted file mode 100644 index 0d79543b..00000000 --- a/patches/server/0074-Make-sure-the-block-is-cauldron-before-proceeding.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ivan Pekov -Date: Thu, 29 Oct 2020 09:19:32 +0200 -Subject: [PATCH] Make sure the block is cauldron before proceeding - -Bandaid fixes 272. We need a proper solution for that tho - -diff --git a/src/main/java/net/minecraft/server/BlockCauldron.java b/src/main/java/net/minecraft/server/BlockCauldron.java -index 9fed3883828e7d6ca917a5eca7a7a3e37582f983..0183efdcbdad89d24b658e0e72392cb29ea119ad 100644 ---- a/src/main/java/net/minecraft/server/BlockCauldron.java -+++ b/src/main/java/net/minecraft/server/BlockCauldron.java -@@ -235,6 +235,7 @@ public class BlockCauldron extends Block { - if (f >= 0.15F) { - IBlockData iblockdata = world.getType(blockposition); - -+ if (!iblockdata.isBlock(Blocks.CAULDRON)) return; // Yatopia - bandaid issue until we find what's actually going wrong - if ((Integer) iblockdata.get(BlockCauldron.LEVEL) < 3) { - this.a(world, blockposition, (IBlockData) iblockdata.a((IBlockState) BlockCauldron.LEVEL), 2); // CraftBukkit - }