Paper/patches/removed/1.17/No longer needed/0706-don-t-throw-when-loading-invalid-TEs.patch

35 Zeilen
1.7 KiB
Diff

2021-06-11 14:02:28 +02:00
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
2021-06-15 04:59:31 +02:00
1.17: Mojang catches the exception
2021-06-11 14:02:28 +02:00
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) {