diff --git a/patches/server/0069-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch b/patches/server/0069-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch new file mode 100644 index 0000000..f1f7de0 --- /dev/null +++ b/patches/server/0069-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MartijnMuijsers +Date: Wed, 30 Nov 2022 21:15:33 +0100 +Subject: [PATCH] Avoid Class#isAssignableFrom call in ClassInstanceMultiMap + +License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) + +This patch is based on the following mixin: +"me/jellysquid/mods/lithium/mixin/collections/entity_filtering/TypeFilterableListMixin.java" +By: Angeline +As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric) +Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.nl.html) + +diff --git a/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java b/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java +index f9a7617f4c6c19c798d7fe40491690c8f5de14a9..d5c8fc37ae53835290c8fa731fef974734182ebe 100644 +--- a/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java ++++ b/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java +@@ -57,14 +57,33 @@ public class ClassInstanceMultiMap extends AbstractCollection { + } + + public Collection find(Class type) { +- if (!this.baseClass.isAssignableFrom(type)) { +- throw new IllegalArgumentException("Don't know how to search for " + type); +- } else { +- List list = this.byClass.computeIfAbsent(type, (typeClass) -> { // Gale - dev import deobfuscation fixes +- return this.allInstances.stream().filter(typeClass::isInstance).collect(Collectors.toList()); +- }); +- return Collections.unmodifiableCollection(list); ++ // Gale start - Lithium - avoid Class#isAssignableFrom call in ClassInstanceMultiMap ++ /* ++ Only perform the slow Class#isAssignableFrom(Class) if a list doesn't exist for the type, otherwise ++ we can assume it's already valid. The slow-path code is moved to a separate method to help the JVM inline this. ++ */ ++ Collection collection = this.byClass.get(type); ++ ++ if (collection == null) { ++ collection = this.createAllOfType(type); + } ++ ++ return (Collection) Collections.unmodifiableCollection(collection); ++ } ++ ++ private Collection createAllOfType(Class type) { ++ List list = new java.util.ArrayList<>(1); ++ ++ for (T allElement : this.allInstances) { ++ if (type.isInstance(allElement)) { ++ list.add(allElement); ++ } ++ } ++ ++ this.byClass.put(type, list); ++ ++ return list; ++ // Gale end - Lithium - avoid Class#isAssignableFrom call in ClassInstanceMultiMap + } + + @Override diff --git a/patches/server/0069-Cache-BlockStatePairKey-hash.patch b/patches/server/0070-Cache-BlockStatePairKey-hash.patch similarity index 100% rename from patches/server/0069-Cache-BlockStatePairKey-hash.patch rename to patches/server/0070-Cache-BlockStatePairKey-hash.patch diff --git a/patches/server/0070-Cache-CubeVoxelShape-shape-array.patch b/patches/server/0071-Cache-CubeVoxelShape-shape-array.patch similarity index 100% rename from patches/server/0070-Cache-CubeVoxelShape-shape-array.patch rename to patches/server/0071-Cache-CubeVoxelShape-shape-array.patch diff --git a/patches/server/0071-Replace-division-by-multiplication-in-CubePointRange.patch b/patches/server/0072-Replace-division-by-multiplication-in-CubePointRange.patch similarity index 100% rename from patches/server/0071-Replace-division-by-multiplication-in-CubePointRange.patch rename to patches/server/0072-Replace-division-by-multiplication-in-CubePointRange.patch diff --git a/patches/server/0072-Replace-parts-by-size-in-CubePointRange.patch b/patches/server/0073-Replace-parts-by-size-in-CubePointRange.patch similarity index 100% rename from patches/server/0072-Replace-parts-by-size-in-CubePointRange.patch rename to patches/server/0073-Replace-parts-by-size-in-CubePointRange.patch diff --git a/patches/server/0073-Check-frozen-ticks-before-landing-block.patch b/patches/server/0074-Check-frozen-ticks-before-landing-block.patch similarity index 100% rename from patches/server/0073-Check-frozen-ticks-before-landing-block.patch rename to patches/server/0074-Check-frozen-ticks-before-landing-block.patch diff --git a/patches/server/0074-Skip-entity-move-if-movement-is-zero.patch b/patches/server/0075-Skip-entity-move-if-movement-is-zero.patch similarity index 100% rename from patches/server/0074-Skip-entity-move-if-movement-is-zero.patch rename to patches/server/0075-Skip-entity-move-if-movement-is-zero.patch diff --git a/patches/server/0075-Store-mob-counts-in-an-array.patch b/patches/server/0076-Store-mob-counts-in-an-array.patch similarity index 100% rename from patches/server/0075-Store-mob-counts-in-an-array.patch rename to patches/server/0076-Store-mob-counts-in-an-array.patch diff --git a/patches/server/0076-Optimize-noise-generation.patch b/patches/server/0077-Optimize-noise-generation.patch similarity index 100% rename from patches/server/0076-Optimize-noise-generation.patch rename to patches/server/0077-Optimize-noise-generation.patch diff --git a/patches/server/0077-Ignore-durability-change-equipment-updates.patch b/patches/server/0078-Ignore-durability-change-equipment-updates.patch similarity index 100% rename from patches/server/0077-Ignore-durability-change-equipment-updates.patch rename to patches/server/0078-Ignore-durability-change-equipment-updates.patch diff --git a/patches/server/0078-Hide-flames-on-entities-with-fire-resistance.patch b/patches/server/0079-Hide-flames-on-entities-with-fire-resistance.patch similarity index 100% rename from patches/server/0078-Hide-flames-on-entities-with-fire-resistance.patch rename to patches/server/0079-Hide-flames-on-entities-with-fire-resistance.patch diff --git a/patches/server/0079-Skip-cloning-advancement-criteria.patch b/patches/server/0080-Skip-cloning-advancement-criteria.patch similarity index 100% rename from patches/server/0079-Skip-cloning-advancement-criteria.patch rename to patches/server/0080-Skip-cloning-advancement-criteria.patch diff --git a/patches/server/0080-Player-canSee-by-entity-UUID.patch b/patches/server/0081-Player-canSee-by-entity-UUID.patch similarity index 100% rename from patches/server/0080-Player-canSee-by-entity-UUID.patch rename to patches/server/0081-Player-canSee-by-entity-UUID.patch diff --git a/patches/server/0081-Spread-out-sending-all-player-info.patch b/patches/server/0082-Spread-out-sending-all-player-info.patch similarity index 100% rename from patches/server/0081-Spread-out-sending-all-player-info.patch rename to patches/server/0082-Spread-out-sending-all-player-info.patch diff --git a/patches/server/0082-Optimize-player-list-for-sending-player-info.patch b/patches/server/0083-Optimize-player-list-for-sending-player-info.patch similarity index 100% rename from patches/server/0082-Optimize-player-list-for-sending-player-info.patch rename to patches/server/0083-Optimize-player-list-for-sending-player-info.patch diff --git a/patches/server/0083-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch b/patches/server/0084-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch similarity index 100% rename from patches/server/0083-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch rename to patches/server/0084-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch diff --git a/patches/server/0084-Send-multiple-keep-alive-packets.patch b/patches/server/0085-Send-multiple-keep-alive-packets.patch similarity index 100% rename from patches/server/0084-Send-multiple-keep-alive-packets.patch rename to patches/server/0085-Send-multiple-keep-alive-packets.patch diff --git a/patches/server/0085-Prevent-random-strolling-into-non-ticking-chunks.patch b/patches/server/0086-Prevent-random-strolling-into-non-ticking-chunks.patch similarity index 100% rename from patches/server/0085-Prevent-random-strolling-into-non-ticking-chunks.patch rename to patches/server/0086-Prevent-random-strolling-into-non-ticking-chunks.patch diff --git a/patches/server/0086-Specific-interval-TPS-API.patch b/patches/server/0087-Specific-interval-TPS-API.patch similarity index 100% rename from patches/server/0086-Specific-interval-TPS-API.patch rename to patches/server/0087-Specific-interval-TPS-API.patch diff --git a/patches/server/0087-5-second-TPS-average.patch b/patches/server/0088-5-second-TPS-average.patch similarity index 100% rename from patches/server/0087-5-second-TPS-average.patch rename to patches/server/0088-5-second-TPS-average.patch diff --git a/patches/server/0088-Measure-last-tick-time.patch b/patches/server/0089-Measure-last-tick-time.patch similarity index 100% rename from patches/server/0088-Measure-last-tick-time.patch rename to patches/server/0089-Measure-last-tick-time.patch diff --git a/patches/server/0089-Last-tick-time-API.patch b/patches/server/0090-Last-tick-time-API.patch similarity index 100% rename from patches/server/0089-Last-tick-time-API.patch rename to patches/server/0090-Last-tick-time-API.patch diff --git a/patches/server/0090-Show-last-tick-time-in-tps-command.patch b/patches/server/0091-Show-last-tick-time-in-tps-command.patch similarity index 100% rename from patches/server/0090-Show-last-tick-time-in-tps-command.patch rename to patches/server/0091-Show-last-tick-time-in-tps-command.patch diff --git a/patches/server/0091-For-collision-check-has-physics-before-same-vehicle.patch b/patches/server/0092-For-collision-check-has-physics-before-same-vehicle.patch similarity index 100% rename from patches/server/0091-For-collision-check-has-physics-before-same-vehicle.patch rename to patches/server/0092-For-collision-check-has-physics-before-same-vehicle.patch diff --git a/patches/server/0092-Variable-main-thread-task-delay.patch b/patches/server/0093-Variable-main-thread-task-delay.patch similarity index 100% rename from patches/server/0092-Variable-main-thread-task-delay.patch rename to patches/server/0093-Variable-main-thread-task-delay.patch diff --git a/patches/server/0093-Reduce-RandomSource-instances.patch b/patches/server/0094-Reduce-RandomSource-instances.patch similarity index 100% rename from patches/server/0093-Reduce-RandomSource-instances.patch rename to patches/server/0094-Reduce-RandomSource-instances.patch diff --git a/patches/server/0094-CPU-cores-estimation.patch b/patches/server/0095-CPU-cores-estimation.patch similarity index 100% rename from patches/server/0094-CPU-cores-estimation.patch rename to patches/server/0095-CPU-cores-estimation.patch diff --git a/patches/server/0095-Add-centralized-AsyncExecutor.patch b/patches/server/0096-Add-centralized-AsyncExecutor.patch similarity index 100% rename from patches/server/0095-Add-centralized-AsyncExecutor.patch rename to patches/server/0096-Add-centralized-AsyncExecutor.patch diff --git a/patches/server/0096-Remove-Paper-async-executor.patch b/patches/server/0097-Remove-Paper-async-executor.patch similarity index 100% rename from patches/server/0096-Remove-Paper-async-executor.patch rename to patches/server/0097-Remove-Paper-async-executor.patch diff --git a/patches/server/0097-Remove-Paper-cleaner-executor.patch b/patches/server/0098-Remove-Paper-cleaner-executor.patch similarity index 100% rename from patches/server/0097-Remove-Paper-cleaner-executor.patch rename to patches/server/0098-Remove-Paper-cleaner-executor.patch diff --git a/patches/server/0098-Remove-background-executor.patch b/patches/server/0099-Remove-background-executor.patch similarity index 100% rename from patches/server/0098-Remove-background-executor.patch rename to patches/server/0099-Remove-background-executor.patch diff --git a/patches/server/0099-Remove-bootstrap-executor.patch b/patches/server/0100-Remove-bootstrap-executor.patch similarity index 100% rename from patches/server/0099-Remove-bootstrap-executor.patch rename to patches/server/0100-Remove-bootstrap-executor.patch diff --git a/patches/server/0100-Remove-world-upgrade-executors.patch b/patches/server/0101-Remove-world-upgrade-executors.patch similarity index 100% rename from patches/server/0100-Remove-world-upgrade-executors.patch rename to patches/server/0101-Remove-world-upgrade-executors.patch diff --git a/patches/server/0101-Remove-tab-complete-executor.patch b/patches/server/0102-Remove-tab-complete-executor.patch similarity index 100% rename from patches/server/0101-Remove-tab-complete-executor.patch rename to patches/server/0102-Remove-tab-complete-executor.patch diff --git a/patches/server/0102-Remove-text-filter-executor.patch b/patches/server/0103-Remove-text-filter-executor.patch similarity index 100% rename from patches/server/0102-Remove-text-filter-executor.patch rename to patches/server/0103-Remove-text-filter-executor.patch