Listen carefully

- Actually have MeshTree listen to ecrr event
- Fixes bug where cows explode after a resource reload
This commit is contained in:
Jozufozu 2024-07-24 22:18:40 -07:00
parent f5a6e5af0c
commit 9e4f55b72a
2 changed files with 4 additions and 0 deletions

View file

@ -13,6 +13,7 @@ import dev.engine_room.flywheel.impl.visualization.VisualizationEventHandler;
import dev.engine_room.flywheel.lib.model.ModelCache;
import dev.engine_room.flywheel.lib.model.ModelHolder;
import dev.engine_room.flywheel.lib.model.baked.PartialModelEventHandler;
import dev.engine_room.flywheel.lib.model.part.MeshTree;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientEntityEvents;
@ -73,6 +74,7 @@ public final class FlywheelFabric implements ClientModInitializer {
ModelCache.onEndClientResourceReload());
EndClientResourceReloadCallback.EVENT.register((minecraft, resourceManager, initialReload, error) ->
ModelHolder.onEndClientResourceReload());
EndClientResourceReloadCallback.EVENT.register((minecraft, resourceManager, initialReload, error) -> MeshTree.onEndClientResourceReload());
ModelLoadingPlugin.register(ctx -> {
ctx.addModels(PartialModelEventHandler.onRegisterAdditional());

View file

@ -14,6 +14,7 @@ import dev.engine_room.flywheel.impl.visualization.VisualizationEventHandler;
import dev.engine_room.flywheel.lib.model.ModelCache;
import dev.engine_room.flywheel.lib.model.ModelHolder;
import dev.engine_room.flywheel.lib.model.baked.PartialModelEventHandler;
import dev.engine_room.flywheel.lib.model.part.MeshTree;
import dev.engine_room.flywheel.lib.util.LevelAttached;
import net.minecraft.client.Minecraft;
import net.minecraft.commands.synchronization.ArgumentTypeInfos;
@ -112,6 +113,7 @@ public final class FlywheelForge {
modEventBus.addListener((EndClientResourceReloadEvent e) -> ModelCache.onEndClientResourceReload());
modEventBus.addListener((EndClientResourceReloadEvent e) -> ModelHolder.onEndClientResourceReload());
modEventBus.addListener((EndClientResourceReloadEvent e) -> MeshTree.onEndClientResourceReload());
modEventBus.addListener(PartialModelEventHandler::onRegisterAdditional);
modEventBus.addListener(PartialModelEventHandler::onBakingCompleted);