@@ -124,6 +124,18 @@ public final class EnchantmentHandlerHack extends Hack
124124 private final SliderSetting slotHighlightOpacity =
125125 new SliderSetting ("Slot highlight opacity" , 45 , 5 , 100 , 1 ,
126126 ValueDisplay .INTEGER .withSuffix ("%" ));
127+ private final CheckboxSetting savedContainerPosition =
128+ new CheckboxSetting ("Saved container position" , false );
129+ private final SliderSetting savedContainerX = new SliderSetting (
130+ "Saved container X" , 0 , -4000 , 4000 , 1 , ValueDisplay .INTEGER );
131+ private final SliderSetting savedContainerY = new SliderSetting (
132+ "Saved container Y" , 0 , -4000 , 4000 , 1 , ValueDisplay .INTEGER );
133+ private final CheckboxSetting savedInventoryPosition =
134+ new CheckboxSetting ("Saved inventory position" , false );
135+ private final SliderSetting savedInventoryX = new SliderSetting (
136+ "Saved inventory X" , 0 , -4000 , 4000 , 1 , ValueDisplay .INTEGER );
137+ private final SliderSetting savedInventoryY = new SliderSetting (
138+ "Saved inventory Y" , 0 , -4000 , 4000 , 1 , ValueDisplay .INTEGER );
127139
128140 private double scrollOffset ;
129141 private double maxScroll ;
@@ -166,6 +178,12 @@ public EnchantmentHandlerHack()
166178 addSetting (slotHighlightEnabled );
167179 addSetting (slotHighlightColor );
168180 addSetting (slotHighlightOpacity );
181+ addHiddenPositionSetting (savedContainerPosition );
182+ addHiddenPositionSetting (savedContainerX );
183+ addHiddenPositionSetting (savedContainerY );
184+ addHiddenPositionSetting (savedInventoryPosition );
185+ addHiddenPositionSetting (savedInventoryX );
186+ addHiddenPositionSetting (savedInventoryY );
169187
170188 for (GearCategory cat : GearCategory .ORDERED )
171189 {
@@ -223,6 +241,13 @@ protected void onDisable()
223241 public void renderOnHandledScreen (AbstractContainerScreen <?> screen ,
224242 GuiGraphicsExtractor context , float partialTicks )
225243 {
244+ customPosition = savedContainerPosition .isChecked ();
245+ containerPanelX = savedContainerX .getValueI ();
246+ containerPanelY = savedContainerY .getValueI ();
247+ inventoryCustomPosition = savedInventoryPosition .isChecked ();
248+ inventoryPanelX = savedInventoryX .getValueI ();
249+ inventoryPanelY = savedInventoryY .getValueI ();
250+
226251 if (screen == lastRenderedScreen && context == lastRenderContext )
227252 return ;
228253 lastRenderedScreen = screen ;
@@ -406,6 +431,7 @@ public boolean handleMouseRelease(AbstractContainerScreen<?> screen,
406431 if (panelDragging && button == 0 )
407432 {
408433 panelDragging = false ;
434+ savePanelPosition ();
409435 return true ;
410436 }
411437
@@ -467,6 +493,28 @@ private void startPanelDrag(double mouseX, double mouseY)
467493 customPosition = true ;
468494 }
469495
496+ private void savePanelPosition ()
497+ {
498+ if (renderingInventoryScreen )
499+ {
500+ savedInventoryPosition .setChecked (inventoryCustomPosition );
501+ savedInventoryX .setValue (inventoryPanelX );
502+ savedInventoryY .setValue (inventoryPanelY );
503+ return ;
504+ }
505+
506+ savedContainerPosition .setChecked (customPosition );
507+ savedContainerX .setValue (containerPanelX );
508+ savedContainerY .setValue (containerPanelY );
509+ }
510+
511+ private void addHiddenPositionSetting (
512+ net .wurstclient .settings .Setting setting )
513+ {
514+ setting .setVisibleInGui (false );
515+ addSetting (setting );
516+ }
517+
470518 private void renderOverlay (GuiGraphicsExtractor context )
471519 {
472520 hitboxes .clear ();
0 commit comments