Skip to content

Commit

Permalink
Fix hide loading overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
dima-dencep committed May 29, 2024
1 parent caee431 commit e2aaedd
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ private static int replaceAlpha(int color, int alpha) {
)
)
private void rrls$init(Minecraft client, ReloadInstance reload, Consumer<Optional<Throwable>> onFinish, boolean fadeIn, CallbackInfo ci) {
if (client.screen == null && ConfigExpectPlatform.forceClose()) {
client.setScreen(null); // set TitleScreen
}

rrls$setState(OverlayHelper.lookupState(client.screen, fadeIn));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

package org.redlance.dima_dencep.mods.rrls.mixins;

import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import net.minecraft.client.ResourceLoadStateTracker;
import net.minecraft.client.multiplayer.MultiPlayerGameMode;
import net.minecraft.client.player.LocalPlayer;
import org.redlance.dima_dencep.mods.rrls.config.DoubleLoad;
import org.redlance.dima_dencep.mods.rrls.ConfigExpectPlatform;
import org.redlance.dima_dencep.mods.rrls.Rrls;
Expand Down Expand Up @@ -139,4 +142,35 @@ public abstract class MinecraftClientMixin {

return original;
}

@WrapOperation(
method = {
"handleKeybinds",
"continueAttack"
},
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/player/LocalPlayer;isUsingItem()Z"
)
)
public boolean rrls$fixIsUsingItemNPE(LocalPlayer instance, Operation<Boolean> original) {
if (instance == null) {
return false;
}

return original.call(instance);
}

@WrapWithCondition(
method = {
"continueAttack"
},
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/multiplayer/MultiPlayerGameMode;stopDestroyBlock()V"
)
)
public boolean rrls$fixStopDestroyBlockNPE(MultiPlayerGameMode instance) {
return instance != null;
}
}

0 comments on commit e2aaedd

Please sign in to comment.