19
19
import net .modfest .scatteredshards .api .ScatteredShardsAPI ;
20
20
import net .modfest .scatteredshards .api .shard .Shard ;
21
21
import net .modfest .scatteredshards .api .shard .ShardIconOffsets ;
22
+ import net .modfest .scatteredshards .api .shard .ShardTextureSettings ;
22
23
import net .modfest .scatteredshards .api .shard .ShardType ;
23
24
import net .modfest .scatteredshards .client .ScatteredShardsClient ;
24
25
import net .modfest .scatteredshards .client .screen .ShardTabletGuiDescription ;
@@ -34,6 +35,8 @@ public class WMiniShard extends WWidget {
34
35
protected ShardType shardType = null ;
35
36
protected boolean isCollected = false ;
36
37
protected Identifier shardId ;
38
+ private int width = (int )ShardTextureSettings .Size .DEFAULT_MINI .width ();
39
+ private int height = (int )ShardTextureSettings .Size .DEFAULT_MINI .height ();
37
40
38
41
protected Consumer <Shard > shardConsumer = (it ) -> {
39
42
};
@@ -47,6 +50,9 @@ public WMiniShard setShard(Shard shard, boolean collected, Identifier shardId) {
47
50
this .shardType = ScatteredShardsAPI .getClientLibrary ().shardTypes ().get (shard .shardTypeId ()).orElse (ShardType .MISSING );
48
51
this .isCollected = collected ;
49
52
this .shardId = shardId ;
53
+ ShardTextureSettings .Size size = shardType .getTextureSettings ().getMiniSize ();
54
+ this .width = (int )size .width ();
55
+ this .height = (int )size .height ();
50
56
51
57
return this ;
52
58
}
@@ -62,7 +68,7 @@ public void paint(DrawContext context, int x, int y, int mouseX, int mouseY) {
62
68
Identifier tex = (isCollected ) ? ShardType .getMiniFrontTexture (shard .shardTypeId ()) : ShardType .getMiniBackingTexture (shard .shardTypeId ());
63
69
int color = (isCollected ) ? 0xFF_FFFFFF : 0xFF_668866 ;
64
70
float opacity = (isCollected ) ? 1.0f : 0.6f ;
65
- ScreenDrawing .texturedRect (context , x , y , 12 , 16 , tex , color , opacity );
71
+ ScreenDrawing .texturedRect (context , x , y , getWidth (), getHeight () , tex , color , opacity );
66
72
if (isCollected && ScatteredShardsAPI .getClientLibrary ().shardDisplaySettings ().drawMiniIcons ()) {
67
73
//Maybe draw a teeny tiny icon
68
74
@@ -80,7 +86,7 @@ public void paint(DrawContext context, int x, int y, int mouseX, int mouseY) {
80
86
81
87
boolean hovered = (mouseX >= 0 && mouseY >= 0 && mouseX < getWidth () && mouseY < getHeight ());
82
88
if (hovered ) {
83
- ScreenDrawing .texturedRect (context , x - 2 , y - 2 , 16 , 20 , MINI_OUTLINE , 0 , 0 , 1 , 1 , 0xFF_FFFFFF );
89
+ ScreenDrawing .texturedRect (context , x - 2 , y - 2 , getWidth ()+ 4 , getHeight ()+ 4 , MINI_OUTLINE , 0 , 0 , 1 , 1 , 0xFF_FFFFFF );
84
90
85
91
renderTooltip (context , x , y , mouseX , mouseY );
86
92
} else if ( // Awful bullshit write real code later
@@ -89,7 +95,7 @@ public void paint(DrawContext context, int x, int y, int mouseX, int mouseY) {
89
95
&& wlrp .rightPanel instanceof WShardPanel wsp
90
96
&& wsp .getShard () == shard
91
97
) {
92
- ScreenDrawing .texturedRect (context , x - 2 , y - 2 , 16 , 20 , MINI_OUTLINE_SLIGHT , 0 , 0 , 1 , 1 , 0xFF_FFFFFF );
98
+ ScreenDrawing .texturedRect (context , x - 2 , y - 2 , getWidth ()+ 4 , getHeight ()+ 4 , MINI_OUTLINE_SLIGHT , 0 , 0 , 1 , 1 , 0xFF_FFFFFF );
93
99
}
94
100
}
95
101
@@ -123,11 +129,11 @@ public InputResult onClick(int x, int y, int button) {
123
129
124
130
@ Override
125
131
public int getWidth () {
126
- return 12 ;
132
+ return width ;
127
133
}
128
134
129
135
@ Override
130
136
public int getHeight () {
131
- return 16 ;
137
+ return height ;
132
138
}
133
139
}
0 commit comments