@@ -27,14 +27,14 @@ public FarmMenu() {
2727 .setChildOf (this );
2828
2929
30- cropList .add (new ImageBox (new PixelConstraint (10 ), new PixelConstraint (10 ), "https://static.wikia.nocookie.net/minecraft/images/6/63/Carrot_Updated .png" , cropList , 0L , "cropType" ).setChildOf (selector ));
31- cropList .add (new ImageBox (new SiblingConstraint (10 ), new PixelConstraint (10 ), "https://static.wikia.nocookie.net/minecraft_gamepedia/images/c/c0/Nether_Wart_%28item%29_JE1 .png" , cropList , 1L , "cropType" ).setChildOf (selector ));
32- cropList .add (new ImageBox (new PixelConstraint (10 ), new SiblingConstraint (10 ), "https://static.wikia.nocookie.net/minecraft_gamepedia/images/c/c1/Potato_JE3_BE2 .png" , cropList , 2L , "cropType" ).setChildOf (selector ));
33- cropList .add ( new ImageBox (new SiblingConstraint (10 ), new CramSiblingConstraint (10 ), "https://static.wikia.nocookie.net/minecraft_gamepedia/images/7/75/Wheat_JE2_BE2 .png" , cropList , 3L , "cropType" ).setChildOf (selector ));
34- cropList .add ( new ImageBox (new PixelConstraint (80 ), new SiblingConstraint (10 ), "https://static.wikia.nocookie.net/hypixel-skyblock/images/6/67/Sugar_Cane. png/revision/latest?cb=20210615232455 " , cropList , 4L , "cropType" ).setChildOf (selector ));
30+ cropList .add (new ImageBox (new PixelConstraint (10 ), new PixelConstraint (10 ), 60f , "carrot .png" , cropList , 0L , "cropType" ).setChildOf (selector ));
31+ cropList .add (new ImageBox (new SiblingConstraint (10 ), new PixelConstraint (10 ), 60f , "netherwart .png" , cropList , 1L , "cropType" ).setChildOf (selector ));
32+ cropList .add (new ImageBox (new PixelConstraint (10 ), new SiblingConstraint (10 ), 60f , "potato .png" , cropList , 2L , "cropType" ).setChildOf (selector ));
33+ cropList .add (new ImageBox (new SiblingConstraint (10 ), new CramSiblingConstraint (10 ), 60f , "wheat .png" , cropList , 3L , "cropType" ).setChildOf (selector ));
34+ cropList .add (new ImageBox (new PixelConstraint (10 ), new SiblingConstraint (10 ), 130f , "cane. png" , cropList , 4L , "cropType" ).setChildOf (selector ));
3535
36- farmList .add (new ImageBox (new PixelConstraint (10 ), new CramSiblingConstraint (10 ), "https://i.ibb.co/6nFDfRt/ layered.png" , farmList , 0L , "farmType" ).setChildOf (selector ));
37- farmList .add (new ImageBox (new SiblingConstraint ( 10 ), new CramSiblingConstraint (10 ), "https://i.ibb.co/hLG9g3X/ vertical.png" , farmList , 1L , "farmType" ).setChildOf (selector ));
36+ farmList .add (new ImageBox (new PixelConstraint (10 ), new CramSiblingConstraint (10 ), 60f , " layered.png" , farmList , 0L , "farmType" ).setChildOf (selector ));
37+ farmList .add (new ImageBox (new PixelConstraint ( 80 ), new CramSiblingConstraint (10 ), 60f , " vertical.png" , farmList , 1L , "farmType" ).setChildOf (selector ));
3838
3939 new UIText ("Layered" )
4040 .setX (new CenterConstraint ())
@@ -55,15 +55,15 @@ class ImageBox extends UIBlock {
5555 private Color fillColor ;
5656 private ArrayList <UIComponent > components ;
5757 private String configName ;
58- public ImageBox (XConstraint x , YConstraint y , String ImageURL , ArrayList <UIComponent > components , Long value , String configName ) {
58+ public ImageBox (XConstraint x , YConstraint y , float width , String ImageURL , ArrayList <UIComponent > components , Long value , String configName ) {
5959 // Check if already marked
6060 selected = (long ) FarmHelperConfig .get (configName ) == value ;
6161 this .components = components ;
6262 this .configName = configName ;
6363 fillColor = selected ? new Color (175 , 36 , 36 ) : new Color (30 , 31 , 32 );
6464 this .setX (x )
6565 .setY (y )
66- .setWidth (new PixelConstraint (60 ))
66+ .setWidth (new PixelConstraint (width ))
6767 .setHeight (new PixelConstraint (60 ))
6868 .setColor (fillColor )
6969 .onMouseClick ((component , uiClickEvent ) -> {
@@ -79,19 +79,17 @@ public ImageBox(XConstraint x, YConstraint y, String ImageURL, ArrayList<UICompo
7979 .setX (new CenterConstraint ())
8080 .setY (new CenterConstraint ())
8181 .setHeight (new RelativeConstraint (0.95f ))
82- .setWidth (new RelativeConstraint ( 0.95f ))
82+ .setWidth (new PixelConstraint ( width - 3 ))
8383 .setChildOf (this );
8484
85- try {
86- UIImage .ofURL (new URL (ImageURL ))
87- .setX (new CenterConstraint ())
88- .setY (new CenterConstraint ())
89- .setHeight (new RelativeConstraint (0.5f ))
90- .setWidth (new RelativeConstraint (0.5f ))
91- .setChildOf (this );
92- } catch (MalformedURLException e ) {
93- e .printStackTrace ();
94- }
85+ String path = "/assets/farmhelper/textures/gui/" ;
86+
87+ UIImage .ofResource (path + ImageURL )
88+ .setX (new CenterConstraint ())
89+ .setY (new CenterConstraint ())
90+ .setHeight (new RelativeConstraint (0.5f ))
91+ .setWidth (new AspectConstraint ())
92+ .setChildOf (this );
9593 }
9694
9795
0 commit comments