1414import net .fabricmc .fabric .api .client .networking .v1 .ClientPlayNetworking ;
1515import net .fabricmc .loader .api .FabricLoader ;
1616import net .fabricmc .loader .api .ModContainer ;
17+ import net .minecraft .client .MinecraftClient ;
1718import net .minecraft .client .gui .DrawContext ;
1819import net .minecraft .client .texture .NativeImageBackedTexture ;
20+ import net .minecraft .client .texture .Sprite ;
1921import net .minecraft .text .Text ;
2022import net .minecraft .util .Formatting ;
2123import net .minecraft .util .Identifier ;
@@ -47,15 +49,14 @@ public class VotingScreen extends SpruceScreen {
4749 "community"
4850 );
4951
50- public static final Identifier LOCKUP_TEXTURE = Identifier .of ("modfest" , "textures/art/graphics/lockup-transparent.png" );
51- public static final int LOCKUP_TEXTURE_WIDTH = 1101 ;
52- public static final int LOCKUP_TEXTURE_HEIGHT = 256 ;
52+ public static final Identifier LOCKUP_TEXTURE = Identifier .of (BallotBox .ID , "emblem" );
5353
5454 protected final Multimap <String , String > previousSelections = HashMultimap .create ();
5555 protected final Multimap <String , String > selections = HashMultimap .create ();
5656 protected List <VotingCategory > categories = new ArrayList <>();
5757 protected List <VotingOption > options = new ArrayList <>();
5858 protected boolean loaded = false ;
59+ protected Sprite lockupSprite = null ;
5960
6061 protected int sidePanelWidth ;
6162 protected int sidePanelVerticalPadding ;
@@ -70,6 +71,7 @@ public VotingScreen() {
7071 @ Override
7172 protected void init () {
7273 super .init ();
74+ this .lockupSprite = MinecraftClient .getInstance ().getGuiAtlasManager ().getSprite (LOCKUP_TEXTURE );
7375 if (loaded ) {
7476 initLoaded ();
7577 }
@@ -109,9 +111,12 @@ public void renderBackground(DrawContext context, int mouseX, int mouseY, float
109111 }
110112
111113 public void renderLockup (DrawContext context ) {
114+ if (lockupSprite == null ) return ;
112115 RenderSystem .enableBlend ();
113- int drawHeight = sidePanelWidth * LOCKUP_TEXTURE_HEIGHT / LOCKUP_TEXTURE_WIDTH ;
114- context .drawTexture (LOCKUP_TEXTURE , 0 , (sidePanelVerticalPadding - drawHeight ) / 2 , sidePanelWidth , drawHeight , 0 , 0 , LOCKUP_TEXTURE_WIDTH , LOCKUP_TEXTURE_HEIGHT , LOCKUP_TEXTURE_WIDTH , LOCKUP_TEXTURE_HEIGHT );
116+ int texHeight = lockupSprite .getContents ().getHeight ();
117+ int texWidth = lockupSprite .getContents ().getWidth ();
118+ int drawHeight = sidePanelWidth * texHeight / texWidth ;
119+ context .drawGuiTexture (LOCKUP_TEXTURE , 0 , (sidePanelVerticalPadding - drawHeight ) / 2 , sidePanelWidth , drawHeight );
115120 RenderSystem .disableBlend ();
116121 }
117122
0 commit comments