From 61d00dd05f918acf77dcfa96464a4d103bc243f2 Mon Sep 17 00:00:00 2001 From: mezz Date: Sat, 6 May 2017 12:19:51 -0700 Subject: [PATCH] Fix MC-117087, prevent calling Class.getSimpleName on TEs unnecessarily (#3873) --- .../net/minecraft/profiler/Profiler.java.patch | 18 ++++++++++++++++++ .../net/minecraft/world/World.java.patch | 7 ++++++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 patches/minecraft/net/minecraft/profiler/Profiler.java.patch diff --git a/patches/minecraft/net/minecraft/profiler/Profiler.java.patch b/patches/minecraft/net/minecraft/profiler/Profiler.java.patch new file mode 100644 index 00000000000..4023fecc55a --- /dev/null +++ b/patches/minecraft/net/minecraft/profiler/Profiler.java.patch @@ -0,0 +1,18 @@ +--- ../src-base/minecraft/net/minecraft/profiler/Profiler.java ++++ ../src-work/minecraft/net/minecraft/profiler/Profiler.java +@@ -170,4 +170,15 @@ + return (this.field_76331_c.hashCode() & 11184810) + 4473924; + } + } ++ ++ /** ++ * Forge: Fix for MC-117087, World.updateEntities is wasting time calling Class.getSimpleName() when the profiler is not active ++ */ ++ public void startSection(Class profiledClass) ++ { ++ if (this.field_76327_a) ++ { ++ func_76320_a(profiledClass.getSimpleName()); ++ } ++ } + } diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index 7e17a9aba9e..4b773568e55 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -405,7 +405,7 @@ throw new ReportedException(crashreport1); } } -@@ -1678,7 +1794,7 @@ +@@ -1678,11 +1794,11 @@ { BlockPos blockpos = tileentity.func_174877_v(); @@ -414,6 +414,11 @@ { try { +- this.field_72984_F.func_76320_a(tileentity.getClass().getSimpleName()); ++ this.field_72984_F.startSection(tileentity.getClass()); // Fix for MC-117087 + ((ITickable)tileentity).func_73660_a(); + this.field_72984_F.func_76319_b(); + } @@ -1691,6 +1807,13 @@ CrashReport crashreport2 = CrashReport.func_85055_a(throwable, "Ticking block entity"); CrashReportCategory crashreportcategory2 = crashreport2.func_85058_a("Block entity being ticked");