Skip to content

Commit

Permalink
merged Renderer events class into ClientEvents
Browse files Browse the repository at this point in the history
  • Loading branch information
JR1811 committed Sep 17, 2024
1 parent de49bdd commit f901bc3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 31 deletions.
2 changes: 0 additions & 2 deletions src/main/java/io/fabricatedatelier/mayor/MayorClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import io.fabricatedatelier.mayor.init.ClientEvents;
import io.fabricatedatelier.mayor.init.BlockEntities;
import io.fabricatedatelier.mayor.init.KeyBindings;
import io.fabricatedatelier.mayor.init.Renderer;
import io.fabricatedatelier.mayor.network.CustomS2CNetworking;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.EnvType;
Expand All @@ -17,7 +16,6 @@ public class MayorClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
CustomS2CNetworking.initialize();
Renderer.initialize();
KeyBindings.initialize();
ClientEvents.initialize();

Expand Down
16 changes: 16 additions & 0 deletions src/main/java/io/fabricatedatelier/mayor/init/ClientEvents.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package io.fabricatedatelier.mayor.init;

import io.fabricatedatelier.mayor.camera.CameraHandler;
import io.fabricatedatelier.mayor.manager.MayorManager;
import io.fabricatedatelier.mayor.util.RenderUtil;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;

@Environment(EnvType.CLIENT)
public class ClientEvents {
Expand All @@ -14,6 +18,18 @@ public static void initialize() {
MayorManager.mayorStructureMap.clear();
}
});
WorldRenderEvents.AFTER_ENTITIES.register(RenderUtil::renderVillageStructure);
HudRenderCallback.EVENT.register((drawContext, tickCounter) -> {
RenderUtil.renderMayorHud(drawContext);
CameraHandler camera = CameraHandler.getInstance();
if (!camera.hasTarget()) return;
if (camera.getStartTransition().isRunning()) {
camera.getStartTransition().renderOverlay(drawContext);
}
if (camera.getEndTransition().isRunning()) {
camera.getEndTransition().renderOverlay(drawContext);
}
});
}

}
29 changes: 0 additions & 29 deletions src/main/java/io/fabricatedatelier/mayor/init/Renderer.java

This file was deleted.

0 comments on commit f901bc3

Please sign in to comment.