4141import net .wurstclient .chestsearch .ChestRecorder ;
4242import net .wurstclient .clickgui .screens .ChestSearchScreen ;
4343import net .wurstclient .hacks .AutoStealHack ;
44+ import net .wurstclient .hacks .ChestSearchHack ;
4445import net .wurstclient .hacks .QuickShulkerHack ;
4546
4647@ Mixin (ContainerScreen .class )
@@ -93,6 +94,7 @@ public void init()
9394 super .init ();
9495 if (!WurstClient .INSTANCE .isEnabled ())
9596 return ;
97+ final ChestSearchHack chestSearchHack = wurst$getChestSearchHack ();
9698 if (autoSteal .areButtonsVisible ())
9799 {
98100 addRenderableWidget (Button
@@ -130,13 +132,11 @@ public void init()
130132 // ChestSearch hack settings.
131133 try
132134 {
133- net .wurstclient .hacks .ChestSearchHack csh =
134- WurstClient .INSTANCE .getHax ().chestSearchHack ;
135- boolean showScan = true ;
135+ boolean showScan = false ;
136136 try
137137 {
138- if (csh != null )
139- showScan = ! csh . isAutomaticMode ();
138+ if (chestSearchHack != null )
139+ showScan = chestSearchHack . isManualMode ();
140140 }catch (Throwable ignored )
141141 {}
142142 if (showScan )
@@ -149,6 +149,13 @@ public void init()
149149 // Attempt to record the chest contents when the container screen opens.
150150 try
151151 {
152+ try
153+ {
154+ if (chestSearchHack != null && chestSearchHack .isOffMode ())
155+ return ;
156+ }catch (Throwable ignored )
157+ {}
158+
152159 ChestConfig cfg = new ChestConfig ();
153160 if (!cfg .enabled )
154161 return ;
@@ -628,11 +635,8 @@ else if(inv != null
628635 {
629636 try
630637 {
631- net .wurstclient .hacks .ChestSearchHack csh =
632- WurstClient .INSTANCE
633- .getHax ().chestSearchHack ;
634- boolean doAuto =
635- csh == null || csh .isAutomaticMode ();
638+ boolean doAuto = chestSearchHack == null
639+ || chestSearchHack .isAutomaticMode ();
636640 if (doAuto )
637641 {
638642 int px =
@@ -705,11 +709,8 @@ else if(inv != null
705709 }
706710 try
707711 {
708- net .wurstclient .hacks .ChestSearchHack csh =
709- WurstClient .INSTANCE
710- .getHax ().chestSearchHack ;
711- boolean doAuto =
712- csh == null || csh .isAutomaticMode ();
712+ boolean doAuto = chestSearchHack == null
713+ || chestSearchHack .isAutomaticMode ();
713714 if (doAuto )
714715 {
715716 int px =
@@ -759,10 +760,8 @@ else if(inv != null
759760 // automatic mode)
760761 try
761762 {
762- net .wurstclient .hacks .ChestSearchHack csh =
763- WurstClient .INSTANCE
764- .getHax ().chestSearchHack ;
765- if (csh == null || csh .isAutomaticMode ())
763+ if (chestSearchHack == null
764+ || chestSearchHack .isAutomaticMode ())
766765 chestRecorder .onChestOpened (fServerIp ,
767766 fDimension ,
768767 GenericContainerScreenMixin .this .clickedX ,
@@ -799,9 +798,8 @@ else if(inv != null
799798 this .chestSlotOrder = new java .util .ArrayList <>(slotOrder );
800799 try
801800 {
802- net .wurstclient .hacks .ChestSearchHack csh =
803- WurstClient .INSTANCE .getHax ().chestSearchHack ;
804- if (csh == null || csh .isAutomaticMode ())
801+ if (chestSearchHack == null
802+ || chestSearchHack .isAutomaticMode ())
805803 chestRecorder .onChestOpened (fServerIp , fDimension ,
806804 GenericContainerScreenMixin .this .clickedX ,
807805 GenericContainerScreenMixin .this .clickedY ,
@@ -857,11 +855,8 @@ public void run()
857855 {
858856 try
859857 {
860- net .wurstclient .hacks .ChestSearchHack csh =
861- WurstClient .INSTANCE
862- .getHax ().chestSearchHack ;
863- boolean doAuto =
864- csh == null || csh .isAutomaticMode ();
858+ boolean doAuto = chestSearchHack == null
859+ || chestSearchHack .isAutomaticMode ();
865860 if (doAuto )
866861 {
867862 int px =
@@ -1291,6 +1286,18 @@ public void removed()
12911286 {}
12921287 }
12931288
1289+ @ Unique
1290+ private ChestSearchHack wurst$getChestSearchHack ()
1291+ {
1292+ try
1293+ {
1294+ return WurstClient .INSTANCE .getHax ().chestSearchHack ;
1295+ }catch (Throwable ignored )
1296+ {
1297+ return null ;
1298+ }
1299+ }
1300+
12941301 @ Unique
12951302 private BlockPos wurst$normalizeContainerPos (BlockPos pos )
12961303 {
0 commit comments