3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00

Ignore Missing Recipes in RecipeBook to avoid data errors

This code was causing NPE's in saving player data, potentially related to reloads.
Dieser Commit ist enthalten in:
Aikar 2018-06-16 16:30:29 -04:00
Ursprung 1ae07ecf52
Commit 708d52ca03
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 401ADFC9891FAAFE
3 geänderte Dateien mit 46 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -1,4 +1,4 @@
From 26b6ff3f923bd7ff541cfc78312596986fdee0c1 Mon Sep 17 00:00:00 2001
From a6ab787c5dd9cc0681087bfb35ae3b837dc4683a Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sat, 16 Jun 2018 01:17:39 -0500
Subject: [PATCH] Make shield blocking delay configurable
@ -29,5 +29,5 @@ index 42cf95e1..5921c952 100644
// Paper end
}
--
2.11.0
2.17.1

Datei anzeigen

@ -0,0 +1,43 @@
From 4d65cc39ce63e647fa1d79567a7b44c5666b8fca 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 7eecdc9da..c7b947d2f 100644
--- a/src/main/java/net/minecraft/server/RecipeBookServer.java
+++ b/src/main/java/net/minecraft/server/RecipeBookServer.java
@@ -63,7 +63,11 @@ 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);
@@ -71,9 +75,13 @@ 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);
--
2.17.1

Datei anzeigen

@ -101,6 +101,7 @@ import PlayerConnectionUtils
import RegionFile
import RegistryBlockID
import RemoteControlListener
import RecipeBookServer
import ServerPing
import StructureBoundingBox
import StructurePiece