diff --git a/Spigot-Server-Patches/Ignore-Missing-Recipes-in-RecipeBook-to-avoid-data-e.patch b/Spigot-Server-Patches/Ignore-Missing-Recipes-in-RecipeBook-to-avoid-data-e.patch new file mode 100644 index 0000000000..c8133b8a56 --- /dev/null +++ b/Spigot-Server-Patches/Ignore-Missing-Recipes-in-RecipeBook-to-avoid-data-e.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sat, 16 Jun 2018 16:23:38 -0400 +Subject: [PATCH] Ignore Missing Recipes in RecipeBook to avoid data errors + +This code was causing NPE's in saving player data, potentially related to reloads. + +diff --git a/src/main/java/net/minecraft/server/RecipeBookServer.java b/src/main/java/net/minecraft/server/RecipeBookServer.java +index 7eecdc9da..c7b947d2f 100644 +--- a/src/main/java/net/minecraft/server/RecipeBookServer.java ++++ b/src/main/java/net/minecraft/server/RecipeBookServer.java +@@ -0,0 +0,0 @@ public class RecipeBookServer extends RecipeBook { + while (iterator.hasNext()) { + IRecipe irecipe = (IRecipe) iterator.next(); + +- nbttaglist.add(new NBTTagString(((MinecraftKey) CraftingManager.recipes.b(irecipe)).toString())); ++ // Paper start - ignore missing recipes ++ MinecraftKey key = CraftingManager.recipes.b(irecipe); ++ if (key == null) continue; ++ nbttaglist.add(new NBTTagString(key.toString())); ++ // Paper end + } + + nbttagcompound.set("recipes", nbttaglist); +@@ -0,0 +0,0 @@ public class RecipeBookServer extends RecipeBook { + Iterator iterator1 = this.e().iterator(); + + while (iterator1.hasNext()) { +- IRecipe irecipe1 = (IRecipe) iterator1.next(); ++ // Paper start - ignore missing recipes ++ IRecipe irecipe = (IRecipe) iterator1.next(); + +- nbttaglist1.add(new NBTTagString(((MinecraftKey) CraftingManager.recipes.b(irecipe1)).toString())); ++ MinecraftKey key = CraftingManager.recipes.b(irecipe); ++ if (key == null) continue; ++ nbttaglist.add(new NBTTagString(key.toString())); ++ // Paper end + } + + nbttagcompound.set("toBeDisplayed", nbttaglist1); +-- \ No newline at end of file diff --git a/scripts/importmcdev.sh b/scripts/importmcdev.sh index 3094773bbf..089e2cdedb 100755 --- a/scripts/importmcdev.sh +++ b/scripts/importmcdev.sh @@ -101,6 +101,7 @@ import PlayerConnectionUtils import RegionFile import RegistryBlockID import RemoteControlListener +import RecipeBookServer import ServerPing import StructureBoundingBox import StructurePiece