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
Aikar d089acb3bd
Switch to using ForgeFlower for Paper Only mc-dev imports
ForgeFlower is better than Spigots FernFlower at decompiling the source.

However, in order to maintain the CraftBukkit patches, we must keep
using spigots for the primary.

However, for any file that we import on top of Spigots imported files
there is nothing stopping us from using better decompiled files.

So these changes will use ForgeFlower to maintain a better set of
decomped files, so anything we add on top of Paper can start off
in a better spot.
2018-08-31 23:47:57 -04:00

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