9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-21 16:09:19 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0260-Replace-EntitySelectorOptions-map-with-optimized-col.patch
hayanesuru 23b7b02eee optimize chunk map (#438)
* rebase

* optimize LivingEntity#travel

* cleanup

* Replace fluid height map

* reuse array list in Entity#collide

* cleanup

* fix fire and liquid collision shape

* fix checkInside

* inline betweenClosed

* cleanup

* optimize getOnPos

* optimize equals in getOnPos

* update mainSupportingBlockPos on dirty

* cleanup

* rename

* merge same patch

* rebase and remove properly

* [ci skip] cleanup

* rebase and rebuild

* fix async locator

* remove async locator

* cleanup

* rebase

---------

Co-authored-by: Taiyou06 <kaandindar21@gmail.com>
2025-08-19 20:48:26 +02:00

29 lines
1.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
Date: Tue, 9 Nov 2077 00:00:00 +0800
Subject: [PATCH] Replace EntitySelectorOptions map with optimized collection
diff --git a/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java b/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java
index 3b945ac061f192b09dd86e8627dacf11b190d2d9..9e2fd3684260fad1d94a795cb5617c5ccc231adc 100644
--- a/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java
+++ b/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java
@@ -357,7 +357,7 @@ public class EntitySelectorOptions {
}, entitySelectorParser -> true, Component.translatable("argument.entity.options.nbt.description"));
register("scores", parser -> {
StringReader reader = parser.getReader();
- Map<String, MinMaxBounds.Ints> map = Maps.newHashMap();
+ it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<String, MinMaxBounds.Ints> map = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(); // Leaf - Replace options map with optimized collection
reader.expect('{');
reader.skipWhitespace();
@@ -380,7 +380,7 @@ public class EntitySelectorOptions {
parser.addPredicate(entity -> {
Scoreboard scoreboard = entity.getServer().getScoreboard();
- for (Entry<String, MinMaxBounds.Ints> entry : map.entrySet()) {
+ for (Entry<String, MinMaxBounds.Ints> entry : map.object2ObjectEntrySet()) { // Leaf - Replace options map with optimized collection
Objective objective = scoreboard.getObjective(entry.getKey());
if (objective == null) {
return false;