Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public class ActionProcessor {
private int staminaSyncCoolTimeTick = 0;


@SubscribeEvent
public void onTick(PlayerTickEvent.Post event) {
var player = event.getEntity();
Parkourability parkourability = Parkourability.get(player);
Expand Down Expand Up @@ -99,6 +98,7 @@ public void onTick(PlayerTickEvent.Post event) {
animation.tick(clientPlayer, parkourability);
}

@OnlyIn(Dist.CLIENT)
private void onTick$doPostProcessInClient(PlayerTickEvent event, Parkourability parkourability) {
if (!(event.getEntity() instanceof LocalPlayer player)) return;
staminaSyncCoolTimeTick++;
Expand Down Expand Up @@ -251,6 +251,7 @@ private void saveSynchronizationState(Action action, ByteBuffer buffer) {
buffer.flip();
}

@OnlyIn(Dist.CLIENT)
private void consumeStamina(Player player, int value) {
if (player instanceof LocalPlayer localPlayer) {
LocalStamina.get(localPlayer).consume(localPlayer, value);
Expand All @@ -260,7 +261,6 @@ private void consumeStamina(Player player, int value) {
// ====

@OnlyIn(Dist.CLIENT)
@SubscribeEvent
public void onRenderTick(RenderFrameEvent.Pre event) {
Player clientPlayer = Minecraft.getInstance().player;
if (clientPlayer == null) return;
Expand All @@ -278,7 +278,6 @@ public void onRenderTick(RenderFrameEvent.Pre event) {
}

@OnlyIn(Dist.CLIENT)
@SubscribeEvent
public void onViewRender(ViewportEvent.ComputeCameraAngles event) {
LocalPlayer player = Minecraft.getInstance().player;
if (player == null) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@
import net.neoforged.bus.api.IEventBus;

public class EventBusForgeRegistry {
private static final ActionProcessor ACTION_PROCESSOR = new ActionProcessor();

public static void register(IEventBus bus) {
bus.register(ParCoolBrewingRecipe.class);
bus.register(PlayerJumpHandler.class);
bus.register(LoginLogoutHandler.class);
bus.register(PlayerVisibilityHandler.class);
bus.register(PlayerDamageHandler.class);
bus.register(PlayerCloneHandler.class);
bus.register(new ActionProcessor());

bus.addListener(ACTION_PROCESSOR::onTick);
}

public static void registerClient(IEventBus bus) {
Expand All @@ -25,5 +28,8 @@ public static void registerClient(IEventBus bus) {
bus.register(PlayerJoinHandler.class);
bus.register(HUDManager.getInstance());
bus.register(InputHandler.class);

bus.addListener(ACTION_PROCESSOR::onRenderTick);
bus.addListener(ACTION_PROCESSOR::onViewRender);
}
}