Skip to content

Commit

Permalink
Fix MC-117087, prevent calling Class.getSimpleName on TEs unnecessari…
Browse files Browse the repository at this point in the history
…ly (#3873)
  • Loading branch information
mezz authored and LexManos committed May 6, 2017
1 parent 2df3613 commit 61d00dd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
18 changes: 18 additions & 0 deletions 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());
+ }
+ }
}
7 changes: 6 additions & 1 deletion patches/minecraft/net/minecraft/world/World.java.patch
Expand Up @@ -405,7 +405,7 @@
throw new ReportedException(crashreport1);
}
}
@@ -1678,7 +1794,7 @@
@@ -1678,11 +1794,11 @@
{
BlockPos blockpos = tileentity.func_174877_v();

Expand All @@ -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");
Expand Down

0 comments on commit 61d00dd

Please sign in to comment.