3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 19:10:09 +01:00
Paper/patches/server-remapped/0706-don-t-throw-when-loading-invalid-TEs.patch
Mariell Hoversholm a207d14a0e
Rename all patches to correct numbering scheme
Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com>
2021-06-11 15:46:44 +02:00

34 Zeilen
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
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/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
index 05fa76c02ce61e26891ad995fe89e925ea086557..b7ebb213efd759253f0042f77e11f2a8102ea6ca 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -2,6 +2,7 @@ package net.minecraft.world.level.block.entity;
import javax.annotation.Nullable;
import net.minecraft.CrashReportCategory;
+import net.minecraft.ResourceLocationException;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Registry;
import net.minecraft.nbt.CompoundTag;
@@ -133,7 +134,13 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject {
public static BlockEntity loadStatic(BlockState state, CompoundTag tag) {
String s = tag.getString("id");
- return (BlockEntity) Registry.BLOCK_ENTITY_TYPE.getOptional(new ResourceLocation(s)).map((tileentitytypes) -> {
+ // Paper
+ ResourceLocation minecraftKey = null;
+ try {
+ minecraftKey = new ResourceLocation(s);
+ } catch (ResourceLocationException ex) {}
+ // Paper end
+ return (BlockEntity) Registry.BLOCK_ENTITY_TYPE.getOptional(minecraftKey).map((tileentitytypes) -> {
try {
return tileentitytypes.create();
} catch (Throwable throwable) {