mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 08:17:35 +00:00
Use ClassValue to store tileentity names for profiler in lazy cache. (#4021)
This commit is contained in:
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;
|
||||
|
||||
Reference in new issue
Block a user