3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 04:50:05 +01:00
Paper/Spigot-Server-Patches/0273-Ignore-Missing-Recipes-in-RecipeBook-to-avoid-data-e.patch

37 Zeilen
1.5 KiB
Diff

From a1d6c6d4804c230258877a959278864f477778a6 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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 b0c726be19..34e34b7855 100644
--- a/src/main/java/net/minecraft/server/RecipeBookServer.java
+++ b/src/main/java/net/minecraft/server/RecipeBookServer.java
@@ -65,6 +65,10 @@ public class RecipeBookServer extends RecipeBook {
NBTTagList nbttaglist = new NBTTagList();
for(MinecraftKey minecraftkey : this.a) {
+ // Paper start - ignore missing recipes
+ IRecipe recipe = this.h.a(minecraftkey);
+ if (recipe == null) continue;
+ // Paper end
nbttaglist.add((NBTBase)(new NBTTagString(minecraftkey.toString())));
}
@@ -72,6 +76,10 @@ public class RecipeBookServer extends RecipeBook {
NBTTagList nbttaglist1 = new NBTTagList();
for(MinecraftKey minecraftkey1 : this.b) {
+ // Paper start - ignore missing recipes
+ IRecipe recipe = this.h.a(minecraftkey1);
+ if (recipe == null) continue;
+ // Paper end
nbttaglist1.add((NBTBase)(new NBTTagString(minecraftkey1.toString())));
}
--
2.18.0