2019-08-05 16:35:40 +00:00
|
|
|
From 26aaafb89179c1b8d19ed21a8ebe9cd913b1fd15 Mon Sep 17 00:00:00 2001
|
2019-04-05 01:13:49 +00:00
|
|
|
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
|
2019-07-20 04:01:24 +00:00
|
|
|
index 45d5675adf..58b3d0ec93 100644
|
2019-04-05 01:13:49 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/GameRules.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/GameRules.java
|
2019-06-25 01:47:58 +00:00
|
|
|
@@ -21,9 +21,7 @@ import org.apache.logging.log4j.Logger;
|
2019-04-05 01:13:49 +00:00
|
|
|
public class GameRules {
|
|
|
|
|
2019-06-25 01:47:58 +00:00
|
|
|
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));
|
2019-04-05 01:13:49 +00:00
|
|
|
--
|
2019-06-25 01:47:58 +00:00
|
|
|
2.22.0
|
2019-04-05 01:13:49 +00:00
|
|
|
|