Skip to content

Commit

Permalink
Update tick events
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrbysco committed Apr 29, 2024
1 parent d8097ec commit 8228d3c
Showing 1 changed file with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
import net.neoforged.neoforge.client.event.ClientPlayerNetworkEvent;
import net.neoforged.neoforge.client.event.ClientTickEvent;
import net.neoforged.neoforge.client.event.ModelEvent;
import net.neoforged.neoforge.client.event.RegisterClientReloadListenersEvent;
import net.neoforged.neoforge.client.event.RegisterGuiLayersEvent;
import net.neoforged.neoforge.client.event.RenderFrameEvent;
import net.neoforged.neoforge.client.event.RenderTooltipEvent;
import net.neoforged.neoforge.client.gui.VanillaGuiLayers;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.event.TickEvent;
import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent;

import vazkii.patchouli.api.PatchouliAPI;
Expand Down Expand Up @@ -116,10 +117,8 @@ public static void registerOverlays(RegisterGuiLayersEvent evt) {
public static void onInitializeClient(FMLClientSetupEvent evt) {
ClientBookRegistry.INSTANCE.init();
PersistentData.setup();
NeoForge.EVENT_BUS.addListener((TickEvent.ClientTickEvent e) -> {
if (e.phase == TickEvent.Phase.END) {
ClientTicker.endClientTick(Minecraft.getInstance());
}
NeoForge.EVENT_BUS.addListener((ClientTickEvent.Post e) -> {
ClientTicker.endClientTick(Minecraft.getInstance());
});
NeoForge.EVENT_BUS.addListener((PlayerInteractEvent.RightClickBlock e) -> BookRightClickHandler.onRightClick(e.getEntity(), e.getLevel(), e.getHand(), e.getHitVec()));
NeoForge.EVENT_BUS.addListener((PlayerInteractEvent.RightClickBlock e) -> {
Expand All @@ -129,18 +128,15 @@ public static void onInitializeClient(FMLClientSetupEvent evt) {
e.setCancellationResult(result);
}
});
NeoForge.EVENT_BUS.addListener((TickEvent.ClientTickEvent e) -> {
if (e.phase == TickEvent.Phase.END) {
MultiblockVisualizationHandler.onClientTick(Minecraft.getInstance());
}
NeoForge.EVENT_BUS.addListener((ClientTickEvent.Post e) -> {
MultiblockVisualizationHandler.onClientTick(Minecraft.getInstance());
});

NeoForge.EVENT_BUS.addListener((TickEvent.RenderTickEvent e) -> {
if (e.phase == TickEvent.Phase.START) {
ClientTicker.renderTickStart(e.renderTickTime);
} else {
ClientTicker.renderTickEnd();
}
NeoForge.EVENT_BUS.addListener((RenderFrameEvent.Pre e) -> {
ClientTicker.renderTickStart(e.getPartialTick());
});
NeoForge.EVENT_BUS.addListener((RenderFrameEvent.Post e) -> {
ClientTicker.renderTickEnd();
});

NeoForge.EVENT_BUS.addListener((ClientPlayerNetworkEvent.LoggingOut e) -> {
Expand Down

0 comments on commit 8228d3c

Please sign in to comment.