-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add a config option for showing the sleep vignette
Thank you to [EnragedPotato](https://github.com/EnragedPotato) for the suggestion in #68.
- Loading branch information
1 parent
24fb35a
commit adcabf2
Showing
5 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...ain/java/io/github/steveplays28/stevesrealisticsleep/mixin/client/gui/InGameHudMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.github.steveplays28.stevesrealisticsleep.mixin.client.gui; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import io.github.steveplays28.stevesrealisticsleep.StevesRealisticSleep; | ||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.minecraft.client.gui.hud.InGameHud; | ||
import net.minecraft.client.network.ClientPlayerEntity; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Environment(EnvType.CLIENT) | ||
@Mixin(InGameHud.class) | ||
public class InGameHudMixin { | ||
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getSleepTimer()I")) | ||
private int stevesrealisticsleep$cancelSleepVignetteIfDisabled(ClientPlayerEntity instance, @NotNull Operation<Integer> original) { | ||
if (StevesRealisticSleep.config.showSleepVignette) { | ||
return original.call(instance); | ||
} | ||
|
||
return -1; | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
common/src/main/resources/assets/steves_realistic_sleep/lang/en_us.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
common/src/main/resources/data/steves_realistic_sleep/lang/en_us.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,8 @@ | |
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
}, | ||
"client": [ | ||
"client.gui.InGameHudMixin" | ||
] | ||
} |