3838import org .lwjgl .input .Keyboard ;
3939import org .lwjgl .input .Mouse ;
4040
41+ import appeng .api .config .ActionItems ;
4142import appeng .api .config .CraftingStatus ;
4243import appeng .api .config .PinSectionOrder ;
4344import appeng .api .config .PinsRows ;
@@ -178,8 +179,8 @@ public GuiMEMonitorable(final InventoryPlayer inventoryPlayer, final ITerminalHo
178179
179180 this .configSrc = ((IConfigurableObject ) this .inventorySlots ).getConfigManager ();
180181
181- craftingPinsRows = ( PinsRows ) configSrc . getSetting ( Settings . CRAFTING_PINS_ROWS ) ;
182- playerPinsRows = ( PinsRows ) configSrc . getSetting ( Settings . PLAYER_PINS_ROWS ) ;
182+ craftingPinsRows = PinsRows . DISABLED ;
183+ playerPinsRows = PinsRows . DISABLED ;
183184
184185 (this .monitorableContainer = (ContainerMEMonitorable ) this .inventorySlots ).setGui (this );
185186
@@ -251,19 +252,7 @@ protected void actionPerformed(final GuiButton btn) {
251252 NetworkHandler .instance .sendToServer (new PacketSwitchGuis (GuiBridge .GUI_CRAFTING_STATUS ));
252253 }
253254
254- if (!(btn instanceof GuiImgButton iBtn ) || iBtn .getSetting () == Settings .ACTIONS ) return ;
255-
256- final Enum cv = iBtn .getCurrentValue ();
257- final boolean backwards = Mouse .isButtonDown (1 );
258- final Enum next = Platform .rotateEnum (cv , backwards , iBtn .getSetting ().getPossibleValues ());
259-
260- if (btn == this .terminalStyleBox ) {
261- AEConfig .instance .settings .putSetting (iBtn .getSetting (), next );
262- } else if (btn == this .searchBoxSettings ) {
263- AEConfig .instance .settings .putSetting (iBtn .getSetting (), next );
264- } else if (btn == this .searchStringSave ) {
265- AEConfig .instance .preserveSearchBar = next == YesNo .YES ;
266- } else if (btn == this .pinsStateButton ) {
255+ if (btn == this .pinsStateButton ) {
267256 try {
268257 boolean rmb = Mouse .isButtonDown (1 );
269258 boolean ctrl = GuiScreen .isCtrlKeyDown ();
@@ -286,6 +275,20 @@ protected void actionPerformed(final GuiButton btn) {
286275 }
287276 reinitalize ();
288277 return ;
278+ }
279+
280+ if (!(btn instanceof GuiImgButton iBtn ) || iBtn .getSetting () == Settings .ACTIONS ) return ;
281+
282+ final Enum cv = iBtn .getCurrentValue ();
283+ final boolean backwards = Mouse .isButtonDown (1 );
284+ final Enum next = Platform .rotateEnum (cv , backwards , iBtn .getSetting ().getPossibleValues ());
285+
286+ if (btn == this .terminalStyleBox ) {
287+ AEConfig .instance .settings .putSetting (iBtn .getSetting (), next );
288+ } else if (btn == this .searchBoxSettings ) {
289+ AEConfig .instance .settings .putSetting (iBtn .getSetting (), next );
290+ } else if (btn == this .searchStringSave ) {
291+ AEConfig .instance .preserveSearchBar = next == YesNo .YES ;
289292 } else {
290293 try {
291294 NetworkHandler .instance .sendToServer (new PacketValueConfig (iBtn .getSetting ().name (), next .name ()));
@@ -508,11 +511,9 @@ public void initGui() {
508511 this .pinsStateButton = new GuiImgButton (
509512 getPinButtonX (),
510513 getPinButtonY (),
511- Settings .CRAFTING_PINS_ROWS ,
512- PinsRows .ONE ));
513- this .repo .setVisiblePinRows (
514- ((PinsRows ) configSrc .getSetting (Settings .CRAFTING_PINS_ROWS )).ordinal (),
515- ((PinsRows ) configSrc .getSetting (Settings .PLAYER_PINS_ROWS )).ordinal ());
514+ Settings .ACTIONS ,
515+ ActionItems .PINS ));
516+ this .repo .setVisiblePinRows (this .craftingPinsRows .ordinal (), this .playerPinsRows .ordinal ());
516517 }
517518
518519 // Enum setting = AEConfig.INSTANCE.getSetting( "Terminal", SearchBoxMode.class, SearchBoxMode.AUTOSEARCH );
@@ -1011,13 +1012,6 @@ public void updateSetting(final IConfigManager manager, final Enum settingName,
10111012 this .ViewBox .set (this .configSrc .getSetting (Settings .VIEW_MODE ));
10121013 }
10131014
1014- if (this .pinsStateButton != null ) {
1015- craftingPinsRows = (PinsRows ) this .configSrc .getSetting (Settings .CRAFTING_PINS_ROWS );
1016- playerPinsRows = (PinsRows ) this .configSrc .getSetting (Settings .PLAYER_PINS_ROWS );
1017- this .repo .setVisiblePinRows (craftingPinsRows .ordinal (), playerPinsRows .ordinal ());
1018- reinitalize ();
1019- }
1020-
10211015 this .repo .updateView ();
10221016 }
10231017
@@ -1136,16 +1130,13 @@ public void setAEPins(IAEStack<?>[] pins) {
11361130 }
11371131
11381132 @ Override
1139- public void setCraftingPinsRows (PinsRows rows ) {
1140- configSrc .putSetting (Settings .CRAFTING_PINS_ROWS , rows );
1141- repo .setVisiblePinRows (rows .ordinal (), ((PinsRows ) configSrc .getSetting (Settings .PLAYER_PINS_ROWS )).ordinal ());
1142- }
1143-
1144- @ Override
1145- public void setPlayerPinsRows (PinsRows rows ) {
1146- configSrc .putSetting (Settings .PLAYER_PINS_ROWS , rows );
1147- repo .setVisiblePinRows (
1148- ((PinsRows ) configSrc .getSetting (Settings .CRAFTING_PINS_ROWS )).ordinal (),
1149- rows .ordinal ());
1133+ public void setPinsRows (PinsRows craftingRows , PinsRows playerRows ) {
1134+ if (this .pinsStateButton != null ) {
1135+ if (craftingRows != craftingPinsRows || playerRows != playerPinsRows ) {
1136+ craftingPinsRows = craftingRows ;
1137+ playerPinsRows = playerRows ;
1138+ reinitalize ();
1139+ }
1140+ }
11501141 }
11511142}
0 commit comments