diff --git a/src/main/java/com/github/hhhzzzsss/songplayer/mixin/MinecraftClientMixin.java b/src/main/java/com/github/hhhzzzsss/songplayer/mixin/MinecraftClientMixin.java index e8026bf..3d5f2c2 100644 --- a/src/main/java/com/github/hhhzzzsss/songplayer/mixin/MinecraftClientMixin.java +++ b/src/main/java/com/github/hhhzzzsss/songplayer/mixin/MinecraftClientMixin.java @@ -16,7 +16,7 @@ public class MinecraftClientMixin { @Inject(at = @At("HEAD"), method = "render(Z)V") public void onRender(boolean tick, CallbackInfo ci) { if (SongPlayer.MC.world != null && SongPlayer.MC.player != null && SongPlayer.MC.interactionManager != null) { - SongHandler.getInstance().onRenderIngame(tick); + SongHandler.getInstance().onUpdate(false); } else { SongHandler.getInstance().onNotIngame(); } @@ -24,6 +24,9 @@ public class MinecraftClientMixin { @Inject(at = @At("HEAD"), method = "tick()V") public void onTick(CallbackInfo ci) { + if (SongPlayer.MC.world != null && SongPlayer.MC.player != null && SongPlayer.MC.interactionManager != null) { + SongHandler.getInstance().onUpdate(true); + } ProgressDisplay.getInstance().onTick(); } } diff --git a/src/main/java/com/github/hhhzzzsss/songplayer/playing/SongHandler.java b/src/main/java/com/github/hhhzzzsss/songplayer/playing/SongHandler.java index 39e1083..6fba02f 100644 --- a/src/main/java/com/github/hhhzzzsss/songplayer/playing/SongHandler.java +++ b/src/main/java/com/github/hhhzzzsss/songplayer/playing/SongHandler.java @@ -38,7 +38,7 @@ public class SongHandler { public Stage stage = null; public boolean building = false; - public void onRenderIngame(boolean tick) { + public void onUpdate(boolean tick) { if (currentSong == null && songQueue.size() > 0) { setSong(songQueue.poll()); } @@ -85,7 +85,6 @@ public class SongHandler { handleBuilding(); } } else { - // Check if stage was broken handlePlaying(tick); } } @@ -153,7 +152,7 @@ public class SongHandler { BlockPos bp = stage.requiredBreaks.poll(); SongPlayer.MC.interactionManager.attackBlock(bp, Direction.UP); } - buildEndDelay = 40; + buildEndDelay = 20; return; } else if (!stage.missingNotes.isEmpty()) { int desiredNoteId = stage.missingNotes.pollFirst(); @@ -170,8 +169,8 @@ public class SongHandler { } placeBlock(bp); } - buildCooldown = 4; - buildEndDelay = 40; + buildCooldown = 0; // No cooldown, so it places a block every tick + buildEndDelay = 20; } else { building = false; setSurvivalIfNeeded();