Include ModernFix itself in time calculations for dynamic resources
This commit is contained in:
parent
6df33005a7
commit
af526b9113
|
|
@ -33,14 +33,18 @@ public class ForgeHooksClientMixin {
|
||||||
if(!ModLoader.isLoadingStateValid())
|
if(!ModLoader.isLoadingStateValid())
|
||||||
return;
|
return;
|
||||||
ModelEvent.ModifyBakingResult bakeEvent = ((ModelEvent.ModifyBakingResult)event);
|
ModelEvent.ModifyBakingResult bakeEvent = ((ModelEvent.ModifyBakingResult)event);
|
||||||
ModelBakeEventHelper helper = new ModelBakeEventHelper(bakeEvent.getModels());
|
|
||||||
Method acceptEv = ObfuscationReflectionHelper.findMethod(ModContainer.class, "acceptEvent", Event.class);
|
|
||||||
Stopwatch globalTimer = Stopwatch.createStarted();
|
Stopwatch globalTimer = Stopwatch.createStarted();
|
||||||
|
Stopwatch selfTimer = Stopwatch.createStarted();
|
||||||
|
ModelBakeEventHelper helper = new ModelBakeEventHelper(bakeEvent.getModels());
|
||||||
|
selfTimer.stop();
|
||||||
|
Method acceptEv = ObfuscationReflectionHelper.findMethod(ModContainer.class, "acceptEvent", Event.class);
|
||||||
Map<String, Stopwatch> times = new Object2ObjectOpenHashMap<>();
|
Map<String, Stopwatch> times = new Object2ObjectOpenHashMap<>();
|
||||||
|
times.put("modernfix", selfTimer);
|
||||||
ModList.get().forEachModContainer((id, mc) -> {
|
ModList.get().forEachModContainer((id, mc) -> {
|
||||||
Map<ResourceLocation, BakedModel> newRegistry = helper.wrapRegistry(id);
|
Map<ResourceLocation, BakedModel> newRegistry = helper.wrapRegistry(id);
|
||||||
ModelEvent.ModifyBakingResult postedEvent = new ModelEvent.ModifyBakingResult(newRegistry, bakeEvent.getModelBakery());
|
ModelEvent.ModifyBakingResult postedEvent = new ModelEvent.ModifyBakingResult(newRegistry, bakeEvent.getModelBakery());
|
||||||
Stopwatch timer = times.computeIfAbsent(id, $ -> Stopwatch.createStarted());
|
Stopwatch timer = times.computeIfAbsent(id, $ -> Stopwatch.createUnstarted());
|
||||||
|
timer.start();
|
||||||
try {
|
try {
|
||||||
acceptEv.invoke(mc, postedEvent);
|
acceptEv.invoke(mc, postedEvent);
|
||||||
} catch(ReflectiveOperationException e) {
|
} catch(ReflectiveOperationException e) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user