Use ClassValue to store tileentity names for profiler in lazy cache. (#4021)

This commit is contained in:
Ben Staddon authored and LexManos committed 2017-08-01 14:42:18 -05:00
1 parent 2d97f05796
commit 2f7f2e7bc1
3 files changed
+18 -2

No files matched your search

@@ -1247,6 +1247,21 @@ public class ForgeHooks
MinecraftForge.EVENT_BUS.post(new BlockEvent.CropGrowEvent.Post(worldIn, pos, state, worldIn.getBlockState(pos)));
}
private static final ClassValue<String> registryNames = new ClassValue<String>()
{
@Override
@SuppressWarnings("unchecked")
protected String computeValue(Class<?> type)
{
return String.valueOf(TileEntity.getKey((Class<? extends TileEntity>) type));
}
};
public static String getRegistryName(Class<? extends TileEntity> type)
{
return registryNames.get(type);
}
public static boolean loadAdvancements(Map<ResourceLocation, Advancement.Builder> map)
{
boolean errored = false;