77import org .blackum .blackaddons .gui .screen .BlackAddonsGUI ;
88import org .blackum .blackaddons .Blackaddons ;
99import org .blackum .blackaddons .feature .cheat .Freecam ;
10+ import org .blackum .blackaddons .feature .cheat .Perspective ;
1011import org .blackum .blackaddons .gui .widget .*;
1112
1213import java .util .ArrayList ;
@@ -20,6 +21,7 @@ public class CheatsTabController extends SimpleTabController {
2021 private ResizableCard rotationCard ;
2122 private ResizableCard autoBMCard ;
2223 private ResizableCard freecamCard ;
24+ private ResizableCard perspectiveCard ;
2325 private Dropdown s1Dropdown ;
2426 private Dropdown s2Dropdown ;
2527 private Dropdown s3Dropdown ;
@@ -117,7 +119,7 @@ public void init(TabPanel.Tab cheatsTab) {
117119 }
118120
119121 Button resetLayout = new Button (contentX + 10 , contentY , contentWidth - 20 , "Reset Layout" , () -> {
120- screen .resetCardStates ("autoTnt" , "autoSS" , "fastLeap" , "rotationSet" , "autoBM" , "freecam" );
122+ screen .resetCardStates ("autoTnt" , "autoSS" , "fastLeap" , "rotationSet" , "autoBM" , "freecam" , "perspective" );
121123 });
122124 cheatsTab .addWidget (resetLayout );
123125
@@ -144,6 +146,8 @@ public void init(TabPanel.Tab cheatsTab) {
144146 cards .add (autoBMCard );
145147 freecamCard = createFreecamCard (0 , 0 );
146148 cards .add (freecamCard );
149+ perspectiveCard = createPerspectiveCard (0 , 0 );
150+ cards .add (perspectiveCard );
147151
148152 for (ResizableCard card : cards ) {
149153 int shortestCol = 0 ;
@@ -162,6 +166,7 @@ public void init(TabPanel.Tab cheatsTab) {
162166 cheatsCardContainer .addCard (rotationCard );
163167 cheatsCardContainer .addCard (autoBMCard );
164168 cheatsCardContainer .addCard (freecamCard );
169+ cheatsCardContainer .addCard (perspectiveCard );
165170 }
166171
167172 private ResizableCard createAutoTntCard (int x , int y ) {
@@ -466,16 +471,13 @@ private void collapseOtherDropdowns(Dropdown active) {
466471 }
467472
468473 private ResizableCard createAutoBM (int x , int y ) {
469- // 1. Initialize the correct variable
470474 autoBMCard = screen .createResizableCard ("autoBM" , x , y , 300 , 310 , "Auto Ballista Mechanic" );
471475
472476 int contentX = autoBMCard .getContentX ();
473477 int contentY = autoBMCard .getContentY ();
474478
475- // Use a ListView to handle the multiple sliders/labels
476479 ListView listView = new ListView (contentX , contentY , 260 , 260 );
477480
478- // Toggle
479481 ToggleSwitch enabled = new ToggleSwitch (0 , 0 , 260 ,
480482 "Enabled" ,
481483 "Enabled and disables auto BM" ,
@@ -486,7 +488,6 @@ private ResizableCard createAutoBM(int x, int y) {
486488 );
487489 listView .addItem (enabled );
488490
489- // Min FC Delay
490491 Label min_fc_label = new Label (0 , 0 ,
491492 String .format ("Min first click delay: %.0fms" , ConfigManager .data .autoBMConfig .min_fc_delay ),
492493 Label .Style .BODY );
@@ -500,7 +501,6 @@ private ResizableCard createAutoBM(int x, int y) {
500501 });
501502 listView .addItem (min_fc_slider );
502503
503- // Max FC Delay
504504 Label max_fc_label = new Label (0 , 0 ,
505505 String .format ("Max first click delay: %.0fms" , ConfigManager .data .autoBMConfig .max_fc_delay ),
506506 Label .Style .BODY );
@@ -514,7 +514,6 @@ private ResizableCard createAutoBM(int x, int y) {
514514 });
515515 listView .addItem (max_fc_slider );
516516
517- // Min Between Click
518517 Label min_between_click_label = new Label (0 , 0 ,
519518 String .format ("Min between click delay: %.0fms" , ConfigManager .data .autoBMConfig .min_between_click_delay ),
520519 Label .Style .BODY );
@@ -528,7 +527,6 @@ private ResizableCard createAutoBM(int x, int y) {
528527 });
529528 listView .addItem (min_between_click_slider );
530529
531- // Max Between Click
532530 Label max_between_click_label = new Label (0 , 0 ,
533531 String .format ("Max between click delay: %.0fms" , ConfigManager .data .autoBMConfig .max_between_click_delay ),
534532 Label .Style .BODY );
@@ -542,7 +540,6 @@ private ResizableCard createAutoBM(int x, int y) {
542540 });
543541 listView .addItem (max_between_click_slider );
544542
545- // Add the list to the card and update
546543 autoBMCard .addChild (listView );
547544 autoBMCard .updateLayout ();
548545
@@ -749,6 +746,77 @@ private ResizableCard createFreecamCard(int x, int y) {
749746 freecamCard .updateLayout ();
750747 return freecamCard ;
751748 }
749+
750+ private ResizableCard createPerspectiveCard (int x , int y ) {
751+ perspectiveCard = screen .createResizableCard ("perspective" , x , y , 300 , 300 , "Perspective" );
752+ int contentX = perspectiveCard .getContentX ();
753+ int contentY = perspectiveCard .getContentY ();
754+
755+ ListView listView = new ListView (contentX , contentY , 260 , 250 );
756+
757+ ToggleSwitch enableToggle = new ToggleSwitch (0 , 0 , 260 ,
758+ "Enabled" ,
759+ "Orbits camera around player" ,
760+ ConfigManager .data .perspectiveEnabled , value -> {
761+ if (value ) {
762+ Perspective .getInstance ().activate ();
763+ } else {
764+ Perspective .getInstance ().deactivate ();
765+ }
766+ ConfigManager .data .perspectiveEnabled = Perspective .getInstance ().isActive ();
767+ ConfigManager .save ();
768+ });
769+ listView .addItem (enableToggle );
770+
771+ KeybindButton keybindButton = new KeybindButton (0 , 0 , 260 ,
772+ "Keybind" ,
773+ ConfigManager .data .perspectiveKeyCode ,
774+ keyCode -> {
775+ ConfigManager .data .perspectiveKeyCode = keyCode ;
776+ ConfigManager .save ();
777+ });
778+ listView .addItem (keybindButton );
779+
780+ Dropdown activationModeDropdown = new Dropdown (0 , 0 , 260 ,
781+ "Activation Mode" ,
782+ List .of ("Toggle On/Off" , "Hold Key" ),
783+ mode -> {
784+ ConfigManager .data .perspectiveHoldMode = mode .equals ("Hold Key" );
785+ ConfigManager .save ();
786+ });
787+ activationModeDropdown .setSelectedIndex (ConfigManager .data .perspectiveHoldMode ? 1 : 0 );
788+ listView .addItem (activationModeDropdown );
789+
790+ Label distLabel = new Label (0 , 0 ,
791+ String .format (Locale .ROOT , "Distance: %.1f" , ConfigManager .data .perspectiveDistance ),
792+ Label .Style .BODY );
793+ listView .addItem (distLabel );
794+
795+ Slider distSlider = new Slider (0 , 0 , 260 , 1.0f , 20.0f ,
796+ ConfigManager .data .perspectiveDistance , val -> {
797+ ConfigManager .data .perspectiveDistance = val ;
798+ distLabel .setText (String .format (Locale .ROOT , "Distance: %.1f" , val ));
799+ ConfigManager .save ();
800+ });
801+ listView .addItem (distSlider );
802+
803+ Label sensitivityLabel = new Label (0 , 0 ,
804+ String .format (Locale .ROOT , "Sensitivity: %.1f" , ConfigManager .data .perspectiveSensitivity ),
805+ Label .Style .BODY );
806+ listView .addItem (sensitivityLabel );
807+
808+ Slider sensitivitySlider = new Slider (0 , 0 , 260 , 0.1f , 5.0f ,
809+ ConfigManager .data .perspectiveSensitivity , val -> {
810+ ConfigManager .data .perspectiveSensitivity = val ;
811+ sensitivityLabel .setText (String .format (Locale .ROOT , "Sensitivity: %.1f" , val ));
812+ ConfigManager .save ();
813+ });
814+ listView .addItem (sensitivitySlider );
815+
816+ perspectiveCard .addChild (listView );
817+ perspectiveCard .updateLayout ();
818+ return perspectiveCard ;
819+ }
752820 private static String delayLabel (int ticks ) {
753821 String base = "Action Delay: " + ticks + (ticks == 1 ? " tick" : " ticks" );
754822 return ticks <= 1 ? base + " (can be broken)" : base ;
0 commit comments