Paper/Spigot-Server-Patches/0378-Optimize-GameRules-to-use-LinkedHashMap.patch
Shane Freeder 6048122e23
Revert "Optimize Pathfinding"
This patch appears to be causing some issues with 1.14.3 entity AI
2019-06-25 20:18:50 +01:00

26 lines
1.4 KiB
Diff

From efc767ace0707d871f995b3968bb25840757c5d8 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Thu, 4 Apr 2019 17:55:05 -0700
Subject: [PATCH] Optimize GameRules to use LinkedHashMap
Previously TreeMap was used which has poor get(K) performance.
diff --git a/src/main/java/net/minecraft/server/GameRules.java b/src/main/java/net/minecraft/server/GameRules.java
index 2880de7c58..d567f35bde 100644
--- a/src/main/java/net/minecraft/server/GameRules.java
+++ b/src/main/java/net/minecraft/server/GameRules.java
@@ -21,9 +21,7 @@ import org.apache.logging.log4j.Logger;
public class GameRules {
private static final Logger LOGGER = LogManager.getLogger();
- private static final Map<GameRules.GameRuleKey<?>, GameRules.GameRuleDefinition<?>> z = Maps.newTreeMap(Comparator.comparing((gamerules_gamerulekey) -> {
- return gamerules_gamerulekey.a;
- }));
+ private static final Map<GameRules.GameRuleKey<?>, GameRules.GameRuleDefinition<?>> z = Maps.newLinkedHashMap(); // Paper
public static final GameRules.GameRuleKey<GameRules.GameRuleBoolean> DO_FIRE_TICK = a("doFireTick", GameRules.GameRuleBoolean.b(true));
public static final GameRules.GameRuleKey<GameRules.GameRuleBoolean> MOB_GRIEFING = a("mobGriefing", GameRules.GameRuleBoolean.b(true));
public static final GameRules.GameRuleKey<GameRules.GameRuleBoolean> KEEP_INVENTORY = a("keepInventory", GameRules.GameRuleBoolean.b(false));
--
2.22.0