Skip to content

Commit

Permalink
Fix MixinMinecraft
Browse files Browse the repository at this point in the history
  • Loading branch information
Currypan1229 committed Jan 5, 2024
1 parent b002a9c commit 2e6bbc8
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public abstract class MixinMinecraft {
private boolean fullscreen;
@Shadow
public int leftClickCounter;
private long lastFrame = getTime();
private long lastFrame = Minecraft.getSystemTime();

@Shadow
public abstract IResourceManager getResourceManager();
Expand All @@ -102,9 +102,9 @@ public void startVia(GameConfiguration p_i45547_1_, CallbackInfo ci) {
ProtocolBase.init(ProtocolMod.PLATFORM);
}

@Inject(method = "createDisplay", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/Display;setTitle(Ljava/lang/String;)V", shift = At.Shift.AFTER))
private void createDisplay(CallbackInfo callbackInfo) {
Display.setTitle(Client.CLIENT_BEST + " Client | " + Client.CLIENT_VERSION);
@ModifyArg(method = "createDisplay", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/Display;setTitle(Ljava/lang/String;)V", remap = false))
private String setTitle(String newTitle) {
return Client.CLIENT_BEST + " Client | " + Client.CLIENT_VERSION;
}

@Inject(method = "loadWorld(Lnet/minecraft/client/multiplayer/WorldClient;Ljava/lang/String;)V", at = @At("HEAD"))
Expand Down Expand Up @@ -157,17 +157,13 @@ private void displayGuiScreen(CallbackInfo callbackInfo) {

@Inject(method = "runGameLoop", at = @At("HEAD"))
private void runGameLoop(final CallbackInfo callbackInfo) {
final long currentTime = getTime();
final long currentTime = Minecraft.getSystemTime();
final int deltaTime = (int) (currentTime - lastFrame);
lastFrame = currentTime;

RenderUtils.deltaTime = deltaTime;
}

public long getTime() {
return (Sys.getTime() * 1000) / Sys.getTimerResolution();
}

@Inject(method = "runTick", at = @At(value = "FIELD", target = "Lnet/minecraft/client/Minecraft;joinPlayerCounter:I", shift = At.Shift.BEFORE))
private void onTick(final CallbackInfo callbackInfo) {
Client.eventManager.callEvent(new TickEvent());
Expand Down

0 comments on commit 2e6bbc8

Please sign in to comment.