PaperMC/patches/server-remapped/don-t-throw-when-loading-invalid-TEs.patch
MiniDigger | Martin 95d25d98e8 Move patches around
2021-06-11 14:02:28 +02:00

33 lines
1.6 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ 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) {