20
20
public class WerewolfFormDurationOverlay implements IGuiOverlay {
21
21
22
22
private final Minecraft mc = Minecraft .getInstance ();
23
- public static final ResourceLocation ICONS = new ResourceLocation ("textures/gui/icons.png" );
23
+ protected static final ResourceLocation EXPERIENCE_BAR_BACKGROUND_SPRITE = new ResourceLocation ("hud/experience_bar_background" );
24
+ protected static final ResourceLocation EXPERIENCE_BAR_PROGRESS_SPRITE = new ResourceLocation ("hud/experience_bar_progress" );
24
25
25
26
@ Override
26
27
public void render (@ NotNull ExtendedGui gui , @ NotNull GuiGraphics graphics , float partialTicks , int width , int height ) {
27
28
Player player = this .mc .player ;
28
29
if (Helper .isWerewolf (player )) {
29
30
WerewolfPlayer werewolf = WerewolfPlayer .get (player );
30
- if (werewolf .getSpecialAttributes ().transformationTime > 0 ) {
31
+ WerewolfFormAction lastFormAction = werewolf .getLastFormAction ();
32
+ if (werewolf .getSpecialAttributes ().transformationTime > 0 && lastFormAction != null && lastFormAction .consumesWerewolfTime (werewolf )) {
31
33
double perc = 1 - werewolf .getSpecialAttributes ().transformationTime ;
32
34
float trans = FormHelper .getActiveFormAction (werewolf ).map (werewolfFormAction -> werewolfFormAction .consumesWerewolfTime (werewolf )).orElse (false ) ? 1f : 0.7f ;
33
35
renderExpBar (graphics , perc , trans );
@@ -41,10 +43,17 @@ private void renderExpBar(GuiGraphics graphics, double perc, float transparency)
41
43
int x = scaledWidth / 2 - 91 ;
42
44
43
45
graphics .setColor (1f , 0.1f , 0f , transparency );
46
+ RenderSystem .disableBlend ();
44
47
45
- int k = (int ) ((1 - perc ) * 183.0F );
46
- int l = scaledHeight - 32 + 3 ;
47
- graphics .blit (ICONS , x , l , 0 , 64 , 182 , 5 );
48
- graphics .blit (ICONS , x + k , l , k , 69 , 182 - k , 5 );
48
+ int j = 182 ;
49
+ int k = (int )((1 -perc ) * 183.0F );
50
+ int l = scaledHeight - 32 + 3 ;
51
+ graphics .blitSprite (EXPERIENCE_BAR_BACKGROUND_SPRITE , x , l , j , 5 );
52
+ if (k > 0 ) {
53
+ graphics .blitSprite (EXPERIENCE_BAR_PROGRESS_SPRITE , j , 5 , k , 0 , x +k , l , k , 5 );
54
+ }
55
+
56
+ RenderSystem .enableBlend ();
57
+ graphics .setColor (1.0F , 1.0F , 1.0F , 1.0F );
49
58
}
50
59
}
0 commit comments