Fix MC-117087, prevent calling Class.getSimpleName on TEs unnecessarily (#3873)

This commit is contained in:
mezz authored and LexManos committed 2017-05-06 12:19:51 -07:00
1 parent 2df36137c2
commit 61d00dd05f
2 files changed
+24 -1

No files matched your search

@@ -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());
+ }
+ }
}
@@ -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");