11package de .hysky .skyblocker .mixins ;
22
33import com .llamalad7 .mixinextras .injector .ModifyExpressionValue ;
4- import com .llamalad7 .mixinextras .injector .v2 .WrapWithCondition ;
54import com .llamalad7 .mixinextras .injector .wrapoperation .Operation ;
65import com .llamalad7 .mixinextras .injector .wrapoperation .WrapOperation ;
76import com .llamalad7 .mixinextras .sugar .Local ;
87import de .hysky .skyblocker .config .SkyblockerConfigManager ;
9- import de .hysky .skyblocker .skyblock .fancybars .FancyStatusBars ;
108import de .hysky .skyblocker .skyblock .item .HotbarSlotLock ;
119import de .hysky .skyblocker .skyblock .item .ItemCooldowns ;
1210import de .hysky .skyblocker .skyblock .item .ItemProtection ;
1311import de .hysky .skyblocker .skyblock .item .background .ItemBackgroundManager ;
14- import de .hysky .skyblocker .skyblock .tabhud .TabHud ;
15- import de .hysky .skyblocker .skyblock .tabhud .config .WidgetsConfigurationScreen ;
1612import de .hysky .skyblocker .utils .Formatters ;
1713import de .hysky .skyblocker .utils .ItemUtils ;
1814import de .hysky .skyblocker .utils .Utils ;
1915import net .fabricmc .api .EnvType ;
2016import net .fabricmc .api .Environment ;
21- import net .minecraft .client .DeltaTracker ;
2217import net .minecraft .client .Minecraft ;
2318import net .minecraft .client .gui .Font ;
2419import net .minecraft .client .gui .Gui ;
2520import net .minecraft .client .gui .GuiGraphics ;
26- import net .minecraft .client .gui .components .PlayerTabOverlay ;
27- import net .minecraft .client .gui .contextualbar .ContextualBarRenderer ;
2821import net .minecraft .client .renderer .RenderPipelines ;
2922import net .minecraft .core .component .DataComponents ;
3023import net .minecraft .nbt .CompoundTag ;
3427import net .minecraft .world .entity .player .Player ;
3528import net .minecraft .world .item .ItemStack ;
3629import net .minecraft .world .item .component .CustomData ;
37- import net .minecraft .world .scores .Objective ;
38- import net .minecraft .world .scores .Scoreboard ;
3930import org .spongepowered .asm .mixin .Final ;
4031import org .spongepowered .asm .mixin .Mixin ;
4132import org .spongepowered .asm .mixin .Shadow ;
@@ -128,56 +119,6 @@ private static boolean isQuiverItem(ItemStack stack) {
128119 }
129120 }
130121
131- @ WrapWithCondition (method = "renderHotbarAndDecorations" , at = {
132- @ At (value = "INVOKE" , target = "Lnet/minecraft/client/gui/contextualbar/ContextualBarRenderer;renderBackground(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/DeltaTracker;)V" ),
133- @ At (value = "INVOKE" , target = "Lnet/minecraft/client/gui/contextualbar/ContextualBarRenderer;render(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/DeltaTracker;)V" )
134- }, require = 2 )
135- private boolean skyblocker$renderExperienceBar (ContextualBarRenderer bar , GuiGraphics context , DeltaTracker tickCounter ) {
136- return shouldShowExperienceBar ();
137- }
138-
139- @ WrapWithCondition (method = "renderHotbarAndDecorations" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/gui/contextualbar/ContextualBarRenderer;renderExperienceLevel(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/gui/Font;I)V" ))
140- private boolean skyblocker$renderExperienceLevel (GuiGraphics context , Font textRenderer , int level ) {
141- return shouldShowExperienceBar ();
142- }
143-
144- @ Unique
145- private static boolean shouldShowExperienceBar () {
146- return !(Utils .isOnSkyblock () && FancyStatusBars .isEnabled () && FancyStatusBars .isExperienceFancyBarEnabled ());
147- }
148-
149- @ Inject (method = "renderPlayerHealth" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/gui/Gui;renderHearts(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/world/entity/player/Player;IIIIFIIIZ)V" , shift = At .Shift .AFTER ), cancellable = true )
150- private void skyblocker$renderStatusBars (GuiGraphics context , CallbackInfo ci ) {
151- if (Utils .isOnSkyblock () && FancyStatusBars .render (context , minecraft )) ci .cancel ();
152- }
153-
154- @ Inject (method = "renderHearts" , at = @ At (value = "HEAD" ), cancellable = true )
155- private void skyblocker$renderHealthBar (GuiGraphics context , Player player , int x , int y , int lines , int regeneratingHeartIndex , float maxHealth , int lastHealth , int health , int absorption , boolean blinking , CallbackInfo ci ) {
156- if (!Utils .isOnSkyblock ()) return ;
157- if (FancyStatusBars .isEnabled () && FancyStatusBars .isHealthFancyBarEnabled ()) ci .cancel ();
158- }
159-
160- @ ModifyExpressionValue (method = "renderPlayerHealth" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/gui/GuiGraphics;guiHeight()I" ))
161- private int skyblocker$moveHealthDown (int original ) {
162- return Utils .isOnSkyblock () && FancyStatusBars .isEnabled () && !FancyStatusBars .isHealthFancyBarEnabled () && FancyStatusBars .isExperienceFancyBarEnabled () ? original + 6 : original ;
163- }
164-
165- @ Inject (method = "renderArmor" , at = @ At ("HEAD" ), cancellable = true )
166- private static void skyblocker$renderStatusBars (GuiGraphics context , Player player , int i , int j , int k , int x , CallbackInfo ci ) {
167- if (Utils .isOnSkyblock () && FancyStatusBars .isEnabled ()) ci .cancel ();
168- }
169-
170- @ Inject (method = "renderVehicleHealth" , at = @ At ("HEAD" ), cancellable = true )
171- private void skyblocker$renderMountHealth (CallbackInfo ci ) {
172- if (Utils .isOnSkyblock () && FancyStatusBars .isEnabled ())
173- ci .cancel ();
174- }
175-
176- @ Inject (method = "renderEffects" , at = @ At ("HEAD" ), cancellable = true )
177- private void skyblocker$dontRenderStatusEffects (CallbackInfo ci ) {
178- if (Utils .isOnSkyblock () && SkyblockerConfigManager .get ().uiAndVisuals .hideStatusEffectOverlay ) ci .cancel ();
179- }
180-
181122 @ ModifyExpressionValue (method = "renderCrosshair" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/player/LocalPlayer;getAttackStrengthScale(F)F" ))
182123 private float skyblocker$modifyAttackIndicatorCooldown (float cooldownProgress ) {
183124 if (Utils .isOnSkyblock () && minecraft .player != null ) {
@@ -196,9 +137,4 @@ private static boolean shouldShowExperienceBar() {
196137 ci .cancel ();
197138 }
198139 }
199-
200- @ WrapWithCondition (method = "renderTabList" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/gui/components/PlayerTabOverlay;render(Lnet/minecraft/client/gui/GuiGraphics;ILnet/minecraft/world/scores/Scoreboard;Lnet/minecraft/world/scores/Objective;)V" ))
201- private boolean skyblocker$shouldRenderHud (PlayerTabOverlay playerListHud , GuiGraphics context , int scaledWindowWidth , Scoreboard scoreboard , Objective objective ) {
202- return !Utils .isOnSkyblock () || !SkyblockerConfigManager .get ().uiAndVisuals .tabHud .tabHudEnabled || TabHud .shouldRenderVanilla () || Minecraft .getInstance ().screen instanceof WidgetsConfigurationScreen ;
203- }
204140}
0 commit comments