aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorShane Freeder <[email protected]>2021-04-21 20:05:50 +0100
committerShane Freeder <[email protected]>2021-04-21 20:05:58 +0100
commitdbfa833ec5344f22a64c39df4ff94cfa986a6672 (patch)
tree1d7474b03e604c2e27e54a90db58b749195965cd
parenta9525a6f71e4efedaac60a27dc302b7f82fdff0e (diff)
downloadPaper-dbfa833ec5344f22a64c39df4ff94cfa986a6672.tar.gz
Paper-dbfa833ec5344f22a64c39df4ff94cfa986a6672.zip
don't throw when loading TE with invalid keys
-rw-r--r--Spigot-Server-Patches/0704-don-t-throw-when-loading-invalid-TEs.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0704-don-t-throw-when-loading-invalid-TEs.patch b/Spigot-Server-Patches/0704-don-t-throw-when-loading-invalid-TEs.patch
new file mode 100644
index 0000000000..eb77500117
--- /dev/null
+++ b/Spigot-Server-Patches/0704-don-t-throw-when-loading-invalid-TEs.patch
@@ -0,0 +1,33 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Shane Freeder <[email protected]>
+Date: Tue, 20 Apr 2021 01:15:04 +0100
+Subject: [PATCH] don't throw when loading invalid TEs
+
+
+diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
+index f1e586754396439dfb70a4d63e3b8b34fb36ebf4..93d02ccb87c17404c55884f52ae40c7b7ddfb103 100644
+--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
+@@ -2,6 +2,7 @@ package net.minecraft.world.level.block.entity;
+
+ import javax.annotation.Nullable;
+ import net.minecraft.CrashReportSystemDetails;
++import net.minecraft.ResourceKeyInvalidException;
+ import net.minecraft.core.BlockPosition;
+ import net.minecraft.core.IRegistry;
+ import net.minecraft.nbt.NBTTagCompound;
+@@ -133,7 +134,13 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
+ public static TileEntity create(IBlockData iblockdata, NBTTagCompound nbttagcompound) {
+ String s = nbttagcompound.getString("id");
+
+- return (TileEntity) IRegistry.BLOCK_ENTITY_TYPE.getOptional(new MinecraftKey(s)).map((tileentitytypes) -> {
++ // Paper
++ MinecraftKey minecraftKey = null;
++ try {
++ minecraftKey = new MinecraftKey(s);
++ } catch (ResourceKeyInvalidException ex) {}
++ // Paper end
++ return (TileEntity) IRegistry.BLOCK_ENTITY_TYPE.getOptional(minecraftKey).map((tileentitytypes) -> {
+ try {
+ return tileentitytypes.a();
+ } catch (Throwable throwable) {