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
3 changes: 2 additions & 1 deletion src/main/java/com/minecrafttas/tasmod/TASmodClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public class TASmodClient implements ClientModInitializer, EventClientInit, Even
* The container where all inputs get stored during recording or stored and
* ready to be played back
*/
public static PlaybackControllerClient controller = new PlaybackControllerClient();
public static PlaybackControllerClient controller;

public static void createTASfileDir() {
try {
Expand Down Expand Up @@ -131,6 +131,7 @@ public void onInitializeClient() {
loadConfig(mc);

virtual = new VirtualInput(LOGGER);
controller = new PlaybackControllerClient(virtual, tasfiledirectory, LOGGER);

// Initialize InfoHud
hud = new InfoHud();
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/com/minecrafttas/tasmod/events/EventClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ public static interface EventDrawHotbarAlways extends EventBase {
public void onDrawHotbarAlways();
}

/**
* Fired at the beginning of a client tick
*/
@FunctionalInterface
public static interface EventClientTickPre extends EventBase {

/**
* Fired at the beginning of a client tick
*/
public void onClientTickPre(Minecraft mc);
}

/**
* Fired at the end of a client tick
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import com.minecrafttas.mctcommon.events.EventListenerRegistry;
import com.minecrafttas.tasmod.TASmodClient;
import com.minecrafttas.tasmod.events.EventClient;
import com.minecrafttas.tasmod.events.EventClient.EventClientTickPost;
import com.minecrafttas.tasmod.util.Ducks.SubtickDuck;

Expand Down Expand Up @@ -45,6 +46,7 @@ public void injectRunGameLoop(CallbackInfo ci) {

@Redirect(method = "runGameLoop", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;runTick()V"))
public void redirectRunTick(Minecraft mc) {
EventListenerRegistry.fireEvent(EventClient.EventClientTickPre.class, (Minecraft) (Object) this);
if (TASmodClient.tickratechanger.ticksPerSecond != 0) {
((SubtickDuck) this.entityRenderer).runUpdate(this.isGamePaused ? this.renderPartialTicksPaused : this.timer.renderPartialTicks);
}
Expand Down
Loading
Loading