1
1
package dynamic_fps .impl .feature .battery ;
2
2
3
+ import com .mojang .blaze3d .systems .RenderSystem ;
4
+ import com .mojang .blaze3d .vertex .PoseStack ;
3
5
import dynamic_fps .impl .util .ResourceLocations ;
4
6
import net .minecraft .client .Minecraft ;
5
- import net .minecraft .client .gui .GuiGraphics ;
7
+ import net .minecraft .client .gui .GuiComponent ;
6
8
import net .minecraft .client .gui .components .toasts .Toast ;
7
9
import net .minecraft .client .gui .components .toasts .ToastComponent ;
8
10
import net .minecraft .network .chat .Component ;
@@ -43,7 +45,7 @@ public static void queueToast(Component title, ResourceLocation icon) {
43
45
}
44
46
45
47
@ Override
46
- public @ NotNull Visibility render (GuiGraphics graphics , ToastComponent toastComponent , long currentTime ) {
48
+ public @ NotNull Visibility render (PoseStack poseStack , ToastComponent toastComponent , long currentTime ) {
47
49
if (this .firstRender == 0 ) {
48
50
if (this == queuedToast ) {
49
51
queuedToast = null ;
@@ -54,15 +56,18 @@ public static void queueToast(Component title, ResourceLocation icon) {
54
56
this .description = localized ("toast" , "battery_charge" , BatteryTracker .charge ());
55
57
}
56
58
59
+ RenderSystem .setShaderTexture (0 , BACKGROUND_IMAGE );
57
60
// resource, x, y, z, ?, ?, width, height, width, height
58
- graphics .blit (BACKGROUND_IMAGE , 0 , 0 , 0 , 0.0f , 0.0f , this .width (), this .height (), this .width (), this .height ());
61
+ GuiComponent .blit (poseStack , 0 , 0 , 0 , 0.0f , 0.0f , this .width (), this .height (), this .width (), this .height ());
59
62
60
- graphics .blit (MOD_ICON , 2 , 2 , 0 , 0.0f , 0.0f , 8 , 8 , 8 , 8 );
61
- graphics .blit (this .icon , 8 , 8 , 0 , 0.0f , 0.0f , 16 , 16 , 16 , 16 );
63
+ RenderSystem .setShaderTexture (0 , MOD_ICON );
64
+ GuiComponent .blit (poseStack , 2 , 2 , 0 , 0.0f , 0.0f , 8 , 8 , 8 , 8 );
65
+ RenderSystem .setShaderTexture (0 , this .icon );
66
+ GuiComponent .blit (poseStack , 8 , 8 , 0 , 0.0f , 0.0f , 16 , 16 , 16 , 16 );
62
67
63
- graphics .drawString (toastComponent .getMinecraft ().font , this .title , 30 , 7 , 0x5f3315 , false );
64
- graphics .drawString (toastComponent .getMinecraft ().font , this .description , 30 , 18 , -16777216 , false );
68
+ GuiComponent .drawString (poseStack , toastComponent .getMinecraft ().font , this .title , 30 , 7 , 0x5f3315 );
69
+ GuiComponent .drawString (poseStack , toastComponent .getMinecraft ().font , this .description , 30 , 18 , -16777216 );
65
70
66
- return currentTime - this .firstRender >= 5000.0 * toastComponent . getNotificationDisplayTimeMultiplier () ? Toast .Visibility .HIDE : Toast .Visibility .SHOW ;
71
+ return currentTime - this .firstRender >= 5000.0 ? Toast .Visibility .HIDE : Toast .Visibility .SHOW ;
67
72
}
68
73
}
0 commit comments