mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-01 15:04:06 +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.
This commit is contained in:
parent
1ae07ecf52
commit
708d52ca03
@ -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>
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||||
Date: Sat, 16 Jun 2018 01:17:39 -0500
|
Date: Sat, 16 Jun 2018 01:17:39 -0500
|
||||||
Subject: [PATCH] Make shield blocking delay configurable
|
Subject: [PATCH] Make shield blocking delay configurable
|
||||||
@ -29,5 +29,5 @@ index 42cf95e1..5921c952 100644
|
|||||||
// Paper end
|
// Paper end
|
||||||
}
|
}
|
||||||
--
|
--
|
||||||
2.11.0
|
2.17.1
|
||||||
|
|
@ -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
|
||||||
|
|
@ -101,6 +101,7 @@ import PlayerConnectionUtils
|
|||||||
import RegionFile
|
import RegionFile
|
||||||
import RegistryBlockID
|
import RegistryBlockID
|
||||||
import RemoteControlListener
|
import RemoteControlListener
|
||||||
|
import RecipeBookServer
|
||||||
import ServerPing
|
import ServerPing
|
||||||
import StructureBoundingBox
|
import StructureBoundingBox
|
||||||
import StructurePiece
|
import StructurePiece
|
||||||
|
Loading…
Reference in New Issue
Block a user