@@ -100,12 +100,13 @@ public class MachineScreen<Machine extends MachineBlockEntity, Menu extends Mach
100100 private static final ItemStack ALUMINUM_WIRE = new ItemStack (getOptionalItem (ResourceLocation .fromNamespaceAndPath ("galacticraft" , "aluminum_wire" ), Items .MOJANG_BANNER_PATTERN ));
101101 private static final ItemStack IRON_CHESTPLATE = new ItemStack (Items .IRON_CHESTPLATE );
102102
103- private static final int SPACING = 4 ;
103+ public static final int SPACING = 4 ;
104104
105- private static final int PANEL_ICON_X = 3 ;
105+ private static final int PANEL_ICON_X_LEFT = 4 ;
106+ private static final int PANEL_ICON_X_RIGHT = 2 ;
106107 private static final int PANEL_ICON_Y = 3 ;
107108
108- private static final int PANEL_TITLE_X = 19 ;
109+ private static final int PANEL_TITLE_X = 18 ;
109110 private static final int PANEL_TITLE_Y = 7 ;
110111
111112 private static final int REDSTONE_IGNORE_X = 18 ;
@@ -117,13 +118,13 @@ public class MachineScreen<Machine extends MachineBlockEntity, Menu extends Mach
117118 private static final int REDSTONE_HIGH_X = 68 ;
118119 private static final int REDSTONE_HIGH_Y = 30 ;
119120
120- private static final int SECURITY_PUBLIC_X = 18 ;
121+ private static final int SECURITY_PUBLIC_X = 16 ;
121122 private static final int SECURITY_PUBLIC_Y = 30 ;
122123
123- private static final int SECURITY_TEAM_X = 43 ;
124+ private static final int SECURITY_TEAM_X = 41 ;
124125 private static final int SECURITY_TEAM_Y = 30 ;
125126
126- private static final int SECURITY_PRIVATE_X = 68 ;
127+ private static final int SECURITY_PRIVATE_X = 66 ;
127128 private static final int SECURITY_PRIVATE_Y = 30 ;
128129
129130 private static final int TOP_FACE_X = 33 ;
@@ -144,17 +145,20 @@ public class MachineScreen<Machine extends MachineBlockEntity, Menu extends Mach
144145 private static final int BOTTOM_FACE_X = 33 ;
145146 private static final int BOTTOM_FACE_Y = 64 ;
146147
147- private static final int OWNER_FACE_X = 6 ;
148- private static final int OWNER_FACE_Y = 20 ;
148+ private static final int OWNER_FACE_X = 33 ;
149+ private static final int OWNER_FACE_Y = 36 ;
149150
150151 private static final int REDSTONE_STATE_TEXT_X = 11 ;
151- private static final int REDSTONE_STATE_TEXT_Y = 53 ;
152+ private static final int REDSTONE_STATE_TEXT_Y = 54 ;
152153
153154 private static final int REDSTONE_STATUS_TEXT_X = 11 ;
154- private static final int REDSTONE_STATUS_TEXT_Y = 57 ; //add font height
155+ private static final int REDSTONE_STATUS_TEXT_Y = 59 ; //add font height
155156
156- private static final int SECURITY_STATE_TEXT_X = 11 ;
157- private static final int SECURITY_STATE_TEXT_Y = 53 ;
157+ private static final int SECURITY_STATE_TEXT_X = 9 ;
158+ private static final int SECURITY_STATE_TEXT_Y = 54 ;
159+
160+ private static final int STATS_TEXT_X = 9 ;
161+ private static final int STATS_TEXT_Y = 55 ;
158162
159163 private static final int MACHINE_FACE_SIZE = 16 ;
160164 private static final int BUTTON_SIZE = 16 ;
@@ -268,17 +272,31 @@ public void appendEnergyTooltip(List<Component> lines) {
268272 */
269273 protected void drawConfigurationPanels (@ NotNull GuiGraphics graphics , int mouseX , int mouseY ) {
270274 assert this .minecraft != null ;
271- boolean secondary = false ;
272275 PoseStack poseStack = graphics .pose ();
273276
277+ int leftX = this .leftPos ;
278+ int rightX = this .leftPos + this .imageWidth ;
279+ int leftY = this .topPos + SPACING ;
280+ int rightY = this .topPos + SPACING ;
281+ int width ;
282+ int height ;
274283 for (Tab tab : Tab .values ()) { // 0, 1, 2, 3
275284 poseStack .pushPose ();
276- if (secondary ) poseStack .translate (0 , SPACING , 0 );
277- graphics .blit (Constant .ScreenTexture .MACHINE_CONFIG_PANELS , this .leftPos + (tab .isLeft () ? tab .isOpen () ? -PANEL_WIDTH : -22 : this .imageWidth ), this .topPos + (secondary ? Tab .values ()[tab .ordinal () - 1 ].isOpen () ? PANEL_HEIGHT : TAB_HEIGHT : 0 ) + SPACING , tab .getU (), tab .getV (), tab .isOpen () ? PANEL_WIDTH : TAB_WIDTH , tab .isOpen () ? PANEL_HEIGHT : TAB_HEIGHT );
278- if (!tab .isOpen ()) {
279- graphics .renderFakeItem (tab .getItem (), this .leftPos + (tab .isLeft () ? -22 : this .imageWidth ) + (tab .isLeft () ? 4 : 2 ), this .topPos + (secondary ? Tab .values ()[tab .ordinal () - 1 ].isOpen () ? PANEL_HEIGHT : TAB_HEIGHT : 0 ) + SPACING + 3 );
285+ width = tab .isOpen () ? PANEL_WIDTH : TAB_WIDTH ;
286+ height = tab .isOpen () ? PANEL_HEIGHT : TAB_HEIGHT ;
287+ if (tab .isLeft ()) {
288+ graphics .blit (Constant .ScreenTexture .MACHINE_CONFIG_PANELS , leftX - width , leftY , tab .getU (), tab .getV (), width , height );
289+ if (!tab .isOpen ()) {
290+ graphics .renderFakeItem (tab .getItem (), leftX - TAB_WIDTH + 4 , leftY + 3 );
291+ }
292+ leftY += height + SPACING ;
293+ } else {
294+ graphics .blit (Constant .ScreenTexture .MACHINE_CONFIG_PANELS , rightX , rightY , tab .getU (), tab .getV (), width , height );
295+ if (!tab .isOpen ()) {
296+ graphics .renderFakeItem (tab .getItem (), rightX + 2 , rightY + 3 );
297+ }
298+ rightY += height + SPACING ;
280299 }
281- secondary = !secondary ;
282300 poseStack .popPose ();
283301 }
284302 poseStack .pushPose ();
@@ -290,13 +308,13 @@ protected void drawConfigurationPanels(@NotNull GuiGraphics graphics, int mouseX
290308 this .drawButton (graphics , REDSTONE_IGNORE_X , REDSTONE_IGNORE_Y , mouseX + PANEL_WIDTH - this .leftPos , mouseY - SPACING - this .topPos , menu .redstoneMode == RedstoneMode .IGNORE );
291309 this .drawButton (graphics , REDSTONE_LOW_X , REDSTONE_LOW_Y , mouseX + PANEL_WIDTH - this .leftPos , mouseY - SPACING - this .topPos , menu .redstoneMode == RedstoneMode .LOW );
292310 this .drawButton (graphics , REDSTONE_HIGH_X , REDSTONE_HIGH_Y , mouseX + PANEL_WIDTH - this .leftPos , mouseY - SPACING - this .topPos , menu .redstoneMode == RedstoneMode .HIGH );
293- graphics .renderFakeItem (REDSTONE , PANEL_ICON_X , PANEL_ICON_Y );
311+ graphics .renderFakeItem (REDSTONE , ( Tab . REDSTONE . isLeft () ? PANEL_ICON_X_LEFT : PANEL_ICON_X_RIGHT ) , PANEL_ICON_Y );
294312 graphics .renderFakeItem (GUNPOWDER , REDSTONE_IGNORE_X , REDSTONE_IGNORE_Y );
295313 graphics .renderFakeItem (UNLIT_TORCH , REDSTONE_LOW_X , REDSTONE_LOW_Y - 2 );
296314 graphics .renderFakeItem (REDSTONE_TORCH , REDSTONE_HIGH_X , REDSTONE_HIGH_Y - 2 );
297315
298- graphics .drawString (this .font , Component .translatable (Constant .TranslationKey .REDSTONE_MODE )
299- . setStyle ( Constant . Text . GRAY_STYLE ), PANEL_TITLE_X , PANEL_TITLE_Y , 0xFFFFFFFF );
316+ graphics .drawString (this .font , Component .translatable (Constant .TranslationKey .REDSTONE_MODE ). setStyle ( Constant . Text . GRAY_STYLE ),
317+ ( Tab . REDSTONE . isLeft () ? PANEL_ICON_X_LEFT : PANEL_ICON_X_RIGHT ) + PANEL_TITLE_X - 1 , PANEL_TITLE_Y , 0xFFFFFFFF );
300318 graphics .drawString (this .font , Component .translatable (Constant .TranslationKey .REDSTONE_STATE ,
301319 menu .redstoneMode .getName ()).setStyle (Constant .Text .GRAY_STYLE ), REDSTONE_STATE_TEXT_X , REDSTONE_STATE_TEXT_Y , 0xFFFFFFFF );
302320 graphics .drawString (this .font , Component .translatable (Constant .TranslationKey .REDSTONE_STATUS ,
@@ -307,12 +325,13 @@ protected void drawConfigurationPanels(@NotNull GuiGraphics graphics, int mouseX
307325
308326 poseStack .popPose ();
309327 }
328+
310329 if (Tab .CONFIGURATION .isOpen ()) {
311330 poseStack .pushPose ();
312- poseStack .translate (-PANEL_WIDTH , TAB_HEIGHT + SPACING + SPACING , 0 );
313- graphics .renderFakeItem (WRENCH , PANEL_ICON_X , PANEL_ICON_Y );
314- graphics .drawString (this .font , Component .translatable (Constant .TranslationKey .CONFIGURATION )
315- . setStyle ( Constant . Text . GRAY_STYLE ), PANEL_TITLE_X , PANEL_TITLE_Y , 0xFFFFFFFF );
331+ poseStack .translate (-PANEL_WIDTH , TAB_HEIGHT + SPACING * 2 , 0 );
332+ graphics .renderFakeItem (WRENCH , ( Tab . CONFIGURATION . isLeft () ? PANEL_ICON_X_LEFT : PANEL_ICON_X_RIGHT ) , PANEL_ICON_Y );
333+ graphics .drawString (this .font , Component .translatable (Constant .TranslationKey .CONFIGURATION ). setStyle ( Constant . Text . GRAY_STYLE ),
334+ ( Tab . CONFIGURATION . isLeft () ? PANEL_ICON_X_LEFT : PANEL_ICON_X_RIGHT ) + PANEL_TITLE_X , PANEL_TITLE_Y , 0xFFFFFFFF );
316335
317336 RenderSystem .setShaderTexture (0 , InventoryMenu .BLOCK_ATLAS );
318337 this .drawMachineFace (graphics , TOP_FACE_X , TOP_FACE_Y , this .menu .configuration , BlockFace .TOP );
@@ -323,36 +342,37 @@ protected void drawConfigurationPanels(@NotNull GuiGraphics graphics, int mouseX
323342 this .drawMachineFace (graphics , BOTTOM_FACE_X , BOTTOM_FACE_Y , this .menu .configuration , BlockFace .BOTTOM );
324343 poseStack .popPose ();
325344 }
345+
326346 if (Tab .STATS .isOpen ()) {
327347 poseStack .pushPose ();
328348 poseStack .translate (this .imageWidth , SPACING , 0 );
329- graphics .renderFakeItem (ALUMINUM_WIRE , PANEL_ICON_X , PANEL_ICON_Y );
349+ graphics .renderFakeItem (ALUMINUM_WIRE , ( Tab . STATS . isLeft () ? PANEL_ICON_X_LEFT : PANEL_ICON_X_RIGHT ) , PANEL_ICON_Y );
330350 PlayerFaceRenderer .draw (graphics , this .ownerSkin .getNow (DefaultPlayerSkin .get (this .menu .security .getOwner () == null ? this .menu .player .getUUID () : this .menu .security .getOwner ())), OWNER_FACE_X , OWNER_FACE_Y , OWNER_FACE_SIZE );
331- graphics .drawString (this .font , Component .translatable (Constant .TranslationKey .STATISTICS )
332- . setStyle ( Constant . Text . GREEN_STYLE ), PANEL_TITLE_X , PANEL_TITLE_Y , 0xFFFFFFFF );
333- List <FormattedCharSequence > text = this .font .split (this .menu .be .getBlockState ().getBlock ().getName (), 64 );
334- int offsetY = 0 ;
335- for (FormattedCharSequence orderedText : text ) {
336- graphics .drawString (this .font , orderedText , 40 , 22 + offsetY , 0xFFFFFFFF , false );
337- offsetY += this .font .lineHeight + 2 ;
338- }
351+ graphics .drawString (this .font , Component .translatable (Constant .TranslationKey .STATISTICS ). setStyle ( Constant . Text . GRAY_STYLE ),
352+ ( Tab . STATS . isLeft () ? PANEL_ICON_X_LEFT : PANEL_ICON_X_RIGHT ) + PANEL_TITLE_X , PANEL_TITLE_Y , 0xFFFFFFFF );
353+ // List<FormattedCharSequence> text = this.font.split(this.menu.be.getBlockState().getBlock().getName(), 64);
354+ // int offsetY = 0;
355+ // for (FormattedCharSequence orderedText : text) {
356+ // graphics.drawString(this.font, orderedText, STATS_TEXT_X, STATS_TEXT_Y + offsetY, 0xFFFFFFFF, false);
357+ // offsetY += this.font.lineHeight + 2;
358+ // }
339359 poseStack .popPose ();
340360 }
341361
342362 if (Tab .SECURITY .isOpen ()) {
343363 poseStack .pushPose ();
344- poseStack .translate (this .imageWidth , TAB_HEIGHT + SPACING + SPACING , 0 );
345- graphics .blit ( Constant . ScreenTexture . MACHINE_CONFIG_PANELS , PANEL_ICON_X , PANEL_ICON_Y , ICON_LOCK_PRIVATE_U , ICON_LOCK_PRIVATE_V , ICON_WIDTH , ICON_HEIGHT );
364+ poseStack .translate (this .imageWidth , TAB_HEIGHT + SPACING * 2 , 0 );
365+ graphics .renderFakeItem ( IRON_CHESTPLATE , ( Tab . SECURITY . isLeft () ? PANEL_ICON_X_LEFT : PANEL_ICON_X_RIGHT ), PANEL_ICON_Y );
346366
347- this .drawButton (graphics , SECURITY_PUBLIC_X , SECURITY_PUBLIC_Y , mouseX - this .imageWidth - this .leftPos , mouseY - (TAB_HEIGHT + SPACING + SPACING ) - this .topPos , this .menu .security .getAccessLevel () == AccessLevel .PUBLIC || !this .menu .security .isOwner (this .menu .player ));
348- this .drawButton (graphics , SECURITY_TEAM_X , SECURITY_TEAM_Y , mouseX - this .imageWidth - this .leftPos , mouseY - (TAB_HEIGHT + SPACING + SPACING ) - this .topPos , this .menu .security .getAccessLevel () == AccessLevel .TEAM || !this .menu .security .isOwner (this .menu .player ));
349- this .drawButton (graphics , SECURITY_PRIVATE_X , SECURITY_PRIVATE_Y , mouseX - this .imageWidth - this .leftPos , mouseY - (TAB_HEIGHT + SPACING + SPACING ) - this .topPos , this .menu .security .getAccessLevel () == AccessLevel .PRIVATE || !this .menu .security .isOwner (this .menu .player ));
367+ this .drawButton (graphics , SECURITY_PUBLIC_X , SECURITY_PUBLIC_Y , mouseX - this .imageWidth - this .leftPos , mouseY - (TAB_HEIGHT + SPACING * 2 ) - this .topPos , this .menu .security .getAccessLevel () == AccessLevel .PUBLIC || !this .menu .security .isOwner (this .menu .player ));
368+ this .drawButton (graphics , SECURITY_TEAM_X , SECURITY_TEAM_Y , mouseX - this .imageWidth - this .leftPos , mouseY - (TAB_HEIGHT + SPACING * 2 ) - this .topPos , this .menu .security .getAccessLevel () == AccessLevel .TEAM || !this .menu .security .isOwner (this .menu .player ));
369+ this .drawButton (graphics , SECURITY_PRIVATE_X , SECURITY_PRIVATE_Y , mouseX - this .imageWidth - this .leftPos , mouseY - (TAB_HEIGHT + SPACING * 2 ) - this .topPos , this .menu .security .getAccessLevel () == AccessLevel .PRIVATE || !this .menu .security .isOwner (this .menu .player ));
350370 graphics .blit (Constant .ScreenTexture .MACHINE_CONFIG_PANELS , SECURITY_PUBLIC_X , SECURITY_PUBLIC_Y , ICON_LOCK_PRIVATE_U , ICON_LOCK_PRIVATE_V , ICON_WIDTH , ICON_HEIGHT );
351371 graphics .blit (Constant .ScreenTexture .MACHINE_CONFIG_PANELS , SECURITY_TEAM_X , SECURITY_TEAM_Y , ICON_LOCK_PARTY_U , ICON_LOCK_PARTY_V , ICON_WIDTH , ICON_HEIGHT );
352372 graphics .blit (Constant .ScreenTexture .MACHINE_CONFIG_PANELS , SECURITY_PRIVATE_X , SECURITY_PRIVATE_Y , ICON_LOCK_PUBLIC_U , ICON_LOCK_PUBLIC_V , ICON_WIDTH , ICON_HEIGHT );
353373
354- graphics .drawString (this .font , Component .translatable (Constant .TranslationKey .SECURITY )
355- . setStyle ( Constant . Text . GRAY_STYLE ), PANEL_TITLE_X , PANEL_TITLE_Y , 0xFFFFFFFF );
374+ graphics .drawString (this .font , Component .translatable (Constant .TranslationKey .SECURITY ). setStyle ( Constant . Text . GRAY_STYLE ),
375+ ( Tab . SECURITY . isLeft () ? PANEL_ICON_X_LEFT : PANEL_ICON_X_RIGHT ) + PANEL_TITLE_X , PANEL_TITLE_Y , 0xFFFFFFFF );
356376 graphics .drawString (this .font , Component .translatable (Constant .TranslationKey .ACCESS_LEVEL ,
357377 this .menu .security .getAccessLevel ().getName ()).setStyle (Constant .Text .GRAY_STYLE ), SECURITY_STATE_TEXT_X , SECURITY_STATE_TEXT_Y , 0xFFFFFFFF );
358378
@@ -462,7 +482,7 @@ public boolean checkConfigurationPanelClick(double mouseX, double mouseY, int bu
462482 mouseY = mY - this .topPos ;
463483 if (Tab .CONFIGURATION .isOpen ()) {
464484 mouseX += PANEL_WIDTH ;
465- mouseY -= TAB_HEIGHT + SPACING + SPACING ;
485+ mouseY -= TAB_HEIGHT + SPACING * 2 ;
466486 if (mouseIn (mouseX , mouseY , 0 , 0 , PANEL_WIDTH , PANEL_UPPER_HEIGHT )) {
467487 Tab .CONFIGURATION .toggle ();
468488 return true ;
@@ -491,9 +511,9 @@ public boolean checkConfigurationPanelClick(double mouseX, double mouseY, int bu
491511 } else {
492512 mouseX += TAB_WIDTH ;
493513 if (Tab .REDSTONE .isOpen ()) {
494- mouseY -= PANEL_HEIGHT + SPACING + SPACING ;
514+ mouseY -= PANEL_HEIGHT + SPACING * 2 ;
495515 } else {
496- mouseY -= TAB_HEIGHT + SPACING + SPACING ;
516+ mouseY -= TAB_HEIGHT + SPACING * 2 ;
497517 }
498518 if (mouseIn (mouseX , mouseY , 0 , 0 , TAB_WIDTH , TAB_HEIGHT )) {
499519 Tab .CONFIGURATION .toggle ();
@@ -519,7 +539,7 @@ public boolean checkConfigurationPanelClick(double mouseX, double mouseY, int bu
519539 mouseY = mY - this .topPos ;
520540 mouseX -= this .imageWidth ;
521541 if (Tab .SECURITY .isOpen ()) {
522- mouseY -= TAB_HEIGHT + SPACING + SPACING ;
542+ mouseY -= TAB_HEIGHT + SPACING * 2 ;
523543 if (mouseIn (mouseX , mouseY , 0 , 0 , PANEL_WIDTH , PANEL_UPPER_HEIGHT )) {
524544 Tab .SECURITY .toggle ();
525545 return true ;
@@ -544,9 +564,9 @@ public boolean checkConfigurationPanelClick(double mouseX, double mouseY, int bu
544564 }
545565 } else {
546566 if (Tab .STATS .isOpen ()) {
547- mouseY -= PANEL_HEIGHT + SPACING + SPACING ;
567+ mouseY -= PANEL_HEIGHT + SPACING * 2 ;
548568 } else {
549- mouseY -= TAB_HEIGHT + SPACING + SPACING ;
569+ mouseY -= TAB_HEIGHT + SPACING * 2 ;
550570 }
551571 if (mouseIn (mouseX , mouseY , 0 , 0 , TAB_WIDTH , TAB_HEIGHT )) {
552572 Tab .SECURITY .toggle ();
@@ -609,7 +629,7 @@ protected void drawConfigurationPanelTooltips(GuiGraphics graphics, int mouseX,
609629 mouseY = mY - this .topPos ;
610630 if (Tab .CONFIGURATION .isOpen ()) {
611631 mouseX += PANEL_WIDTH ;
612- mouseY -= TAB_HEIGHT + SPACING + SPACING ;
632+ mouseY -= TAB_HEIGHT + SPACING * 2 ;
613633 if (mouseIn (mouseX , mouseY , TOP_FACE_X , TOP_FACE_Y , MACHINE_FACE_SIZE , MACHINE_FACE_SIZE )) {
614634 this .renderFaceTooltip (graphics , BlockFace .TOP , mX , mY );
615635 }
@@ -660,7 +680,7 @@ protected void drawConfigurationPanelTooltips(GuiGraphics graphics, int mouseX,
660680 mouseY = mY - this .topPos ;
661681 if (Tab .SECURITY .isOpen ()) {
662682 mouseX -= this .imageWidth ;
663- mouseY -= TAB_HEIGHT + SPACING + SPACING ;
683+ mouseY -= TAB_HEIGHT + SPACING * 2 ;
664684
665685 if (this .menu .security .isOwner (this .menu .player )) {
666686 if (mouseIn (mouseX , mouseY , REDSTONE_IGNORE_X , REDSTONE_IGNORE_Y , BUTTON_WIDTH , BUTTON_HEIGHT )) {
@@ -682,12 +702,12 @@ protected void drawConfigurationPanelTooltips(GuiGraphics graphics, int mouseX,
682702 } else {
683703 mouseX -= this .imageWidth ;
684704 if (Tab .STATS .isOpen ()) {
685- mouseY -= PANEL_HEIGHT + SPACING + SPACING ;
705+ mouseY -= PANEL_HEIGHT + SPACING * 2 ;
686706 } else {
687- mouseY -= TAB_HEIGHT + SPACING + SPACING ;
707+ mouseY -= TAB_HEIGHT + SPACING * 2 ;
688708 }
689709 if (mouseIn (mouseX , mouseY , 0 , 0 , TAB_WIDTH , TAB_HEIGHT )) {
690- graphics .renderTooltip (this .font , Component .translatable (Constant .TranslationKey .SECURITY ).setStyle (Constant .Text .BLUE_STYLE ), mX , mY );
710+ graphics .renderTooltip (this .font , Component .translatable (Constant .TranslationKey .SECURITY ).setStyle (Constant .Text .GREEN_STYLE ), mX , mY );
691711 }
692712 }
693713 }
@@ -826,7 +846,7 @@ protected void drawTanks(GuiGraphics graphics, int mouseX, int mouseY) {
826846 private void handleSlotHighlight (GuiGraphics graphics , int mouseX , int mouseY ) {
827847 if (Tab .CONFIGURATION .isOpen ()) {
828848 mouseX -= (this .leftPos - PANEL_WIDTH );
829- mouseY -= (this .topPos + (TAB_HEIGHT + SPACING + SPACING ));
849+ mouseY -= (this .topPos + (TAB_HEIGHT + SPACING * 2 ));
830850 IOFace config = null ;
831851 if (mouseIn (mouseX , mouseY , TOP_FACE_X , TOP_FACE_Y , MACHINE_FACE_SIZE , MACHINE_FACE_SIZE )) {
832852 config = this .menu .configuration .get (BlockFace .TOP );
0 commit comments