9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-27 02:49:19 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0267-Replace-EntitySelectorOptions-map-with-optimized-col.patch
Dreeam 3c25377465 Drop some unused patches
ClassInstanceMultiMap belongs to Minecraft vanilla entity storage.
And is unused, since replaced by spottedleaf's entity storage (rewrite chunk system).
However these patches might be useful for vanilla entity storage if is used.
2025-07-09 04:20:02 +08: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;