From 727c7780b30c4e5ded10fd6689b9b968266ac224 Mon Sep 17 00:00:00 2001 From: DaemonUmbra Date: Mon, 23 May 2022 15:03:03 -0400 Subject: [PATCH] Added removeErroringEntities config option (#8627) Counterpart to removeErroringBlockEntities --- .../minecraft/net/minecraft/world/level/Level.java.patch | 6 +++++- src/main/java/net/minecraftforge/common/ForgeConfig.java | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/world/level/Level.java.patch b/patches/minecraft/net/minecraft/world/level/Level.java.patch index 87aa4eb566..de78cce4c5 100644 --- a/patches/minecraft/net/minecraft/world/level/Level.java.patch +++ b/patches/minecraft/net/minecraft/world/level/Level.java.patch @@ -140,7 +140,7 @@ if (!this.f_151503_.isEmpty()) { this.f_151512_.addAll(this.f_151503_); this.f_151503_.clear(); -@@ -427,12 +_,15 @@ +@@ -427,12 +_,19 @@ public void m_46653_(Consumer p_46654_, T p_46655_) { try { @@ -150,6 +150,10 @@ CrashReport crashreport = CrashReport.m_127521_(throwable, "Ticking entity"); CrashReportCategory crashreportcategory = crashreport.m_127514_("Entity being ticked"); p_46655_.m_7976_(crashreportcategory); ++ if (net.minecraftforge.common.ForgeConfig.SERVER.removeErroringEntities.get()) { ++ com.mojang.logging.LogUtils.getLogger().error("{}", crashreport.m_127526_()); ++ p_46655_.m_146870_(); ++ } else throw new ReportedException(crashreport); + } finally { + net.minecraftforge.server.timings.TimeTracker.ENTITY_UPDATE.trackEnd(p_46655_); diff --git a/src/main/java/net/minecraftforge/common/ForgeConfig.java b/src/main/java/net/minecraftforge/common/ForgeConfig.java index 5c246f90ca..fc9663d6dd 100644 --- a/src/main/java/net/minecraftforge/common/ForgeConfig.java +++ b/src/main/java/net/minecraftforge/common/ForgeConfig.java @@ -21,6 +21,8 @@ public class ForgeConfig { public static class Server { public final BooleanValue removeErroringBlockEntities; + public final BooleanValue removeErroringEntities; + public final BooleanValue fullBoundingBoxLadders; public final DoubleValue zombieBaseSummonChance; @@ -43,6 +45,12 @@ public class ForgeConfig { .worldRestart() .define("removeErroringBlockEntities", false); + removeErroringEntities = builder + .comment("Set this to true to remove any Entity (Note: Does not include BlockEntities) that throws an error in its tick method instead of closing the server and reporting a crash log. BE WARNED THIS COULD SCREW UP EVERYTHING USE SPARINGLY WE ARE NOT RESPONSIBLE FOR DAMAGES.") + .translation("forge.configgui.removeErroringEntities") + .worldRestart() + .define("removeErroringEntities", false); + fullBoundingBoxLadders = builder .comment("Set this to true to check the entire entity's collision bounding box for ladders instead of just the block they are in. Causes noticeable differences in mechanics so default is vanilla behavior. Default: false.") .translation("forge.configgui.fullBoundingBoxLadders")