From 40cbae42b17df685e2d59a6ef33d0011455bd278 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 26 Feb 2019 11:17:42 +1100 Subject: [PATCH] SPIGOT-4638: Give last registered recipe priority --- nms-patches/CraftingManager.patch | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/nms-patches/CraftingManager.patch b/nms-patches/CraftingManager.patch index d0100d23b5..d4aa226253 100644 --- a/nms-patches/CraftingManager.patch +++ b/nms-patches/CraftingManager.patch @@ -1,5 +1,23 @@ --- a/net/minecraft/server/CraftingManager.java +++ b/net/minecraft/server/CraftingManager.java +@@ -20,7 +20,7 @@ + private static final Logger c = LogManager.getLogger(); + public static final int a = "recipes/".length(); + public static final int b = ".json".length(); +- public Map recipes = Maps.newHashMap(); ++ public it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap recipes = new it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap<>(); // CraftBukkit + private boolean e; + + public CraftingManager() {} +@@ -84,7 +84,7 @@ + if (this.recipes.containsKey(irecipe.getKey())) { + throw new IllegalStateException("Duplicate recipe ignored with ID " + irecipe.getKey()); + } else { +- this.recipes.put(irecipe.getKey(), irecipe); ++ this.recipes.putAndMoveToFirst(irecipe.getKey(), irecipe); // CraftBukkit - SPIGOT-4638: last recipe gets priority + } + } + @@ -95,12 +95,14 @@ do {