@@ -111,6 +111,13 @@ public final class AutoBuildHack extends Hack implements UpdateListener,
111111 "Disable when finished" ,
112112 "Automatically disables AutoBuild when all blocks are placed." , true );
113113
114+ private final CheckboxSetting enableCreativeFlight = new CheckboxSetting (
115+ "Enable CreativeFlight" ,
116+ "Enables CreativeFlight and starts flying when AutoBuild begins.\n \n "
117+ + "If CreativeFlight was off before the build, it will be turned"
118+ + " off again when the build ends." ,
119+ false );
120+
114121 private final CheckboxSetting swapFlightWithAirWalk =
115122 new CheckboxSetting ("Swap flight with AirWalk" ,
116123 "If Flight is enabled, swaps to AirWalk while building and swaps"
@@ -129,6 +136,7 @@ public final class AutoBuildHack extends Hack implements UpdateListener,
129136
130137 private static final long STUCK_TIMEOUT_MS = 1250L ;
131138 private boolean swappedFlightForAirWalk ;
139+ private boolean enabledCreativeFlightForBuild ;
132140
133141 public AutoBuildHack ()
134142 {
@@ -145,6 +153,7 @@ public AutoBuildHack()
145153 addSetting (previewTemplate );
146154 addSetting (confirmTicks );
147155 addSetting (disableOnFinish );
156+ addSetting (enableCreativeFlight );
148157 addSetting (swapFlightWithAirWalk );
149158 }
150159
@@ -203,6 +212,7 @@ protected void onDisable()
203212
204213 // Swap back from AirWalk to Flight if we swapped earlier
205214 swapBackFlightIfNeeded ();
215+ stopCreativeFlightIfNeeded ();
206216
207217 if (template == null )
208218 status = Status .NO_TEMPLATE ;
@@ -294,6 +304,8 @@ public void onRightClick(RightClickEvent event)
294304
295305 status = Status .BUILDING ;
296306
307+ startCreativeFlightIfEnabled ();
308+
297309 // If Flight is enabled, swap to AirWalk while building
298310 swapFlightToAirWalkIfEnabled ();
299311 }
@@ -311,7 +323,7 @@ public void onUpdate()
311323 break ;
312324
313325 case IDLE :
314- if (!template .isSelected (templateSetting ))
326+ if (!template .isGenerated () && ! template . isSelected (templateSetting ))
315327 loadSelectedTemplate ();
316328 updatePreview ();
317329 break ;
@@ -386,6 +398,7 @@ private void buildNormally()
386398
387399 // Swap back from AirWalk to Flight when building finishes
388400 swapBackFlightIfNeeded ();
401+ stopCreativeFlightIfNeeded ();
389402
390403 if (disableOnFinish .isChecked ())
391404 setEnabled (false );
@@ -549,6 +562,18 @@ public boolean selectTemplateByName(String templateName)
549562 return false ;
550563 }
551564
565+ public void selectGeneratedTemplate (AutoBuildTemplate generatedTemplate )
566+ {
567+ template = generatedTemplate ;
568+ remainingBlocks .clear ();
569+ previewBlocks .clear ();
570+ placedConfirmations .clear ();
571+ previewStartPos = null ;
572+ previewDirection = null ;
573+ lastProgressMs = System .currentTimeMillis ();
574+ status = Status .IDLE ;
575+ }
576+
552577 private void updatePreview ()
553578 {
554579 if (!previewTemplate .isChecked () || template == null )
@@ -596,8 +621,8 @@ private void renderBlocks(PoseStack matrixStack,
596621 return ;
597622
598623 List <BlockPos > blocksToDraw = blocks .keySet ().stream ()
599- .filter (pos -> BlockUtils .getState (pos ).canBeReplaced ()). limit ( 1024 )
600- .toList ();
624+ .filter (pos -> BlockUtils .getState (pos ).canBeReplaced ())
625+ .limit ( 16384 ). toList ();
601626
602627 int black = 0x80000000 ;
603628 List <AABB > outlineBoxes =
@@ -678,6 +703,9 @@ private void swapFlightToAirWalkIfEnabled()
678703 if (!swapFlightWithAirWalk .isChecked ())
679704 return ;
680705
706+ if (enableCreativeFlight .isChecked ())
707+ return ;
708+
681709 if (!WURST .getHax ().flightHack .isEnabled ())
682710 return ;
683711
@@ -698,4 +726,28 @@ private void swapBackFlightIfNeeded()
698726
699727 WURST .getHax ().flightHack .setEnabled (true );
700728 }
729+
730+ private void startCreativeFlightIfEnabled ()
731+ {
732+ if (!enableCreativeFlight .isChecked () || MC .player == null )
733+ return ;
734+
735+ CreativeFlightHack creativeFlight = WURST .getHax ().creativeFlightHack ;
736+ enabledCreativeFlightForBuild = !creativeFlight .isEnabled ();
737+ if (enabledCreativeFlightForBuild )
738+ creativeFlight .setEnabled (true );
739+
740+ MC .player .getAbilities ().mayfly = true ;
741+ MC .player .getAbilities ().flying = true ;
742+ }
743+
744+ private void stopCreativeFlightIfNeeded ()
745+ {
746+ if (!enabledCreativeFlightForBuild )
747+ return ;
748+
749+ enabledCreativeFlightForBuild = false ;
750+ if (WURST .getHax ().creativeFlightHack .isEnabled ())
751+ WURST .getHax ().creativeFlightHack .setEnabled (false );
752+ }
701753}
0 commit comments