@@ -89,7 +89,7 @@ object Scaffold : Module("Scaffold", Category.PLAYER, Category.SubCategory.PLAYE
8989 ) { extraClicks }
9090
9191 // Autoblock
92- private val autoBlock by choices(" AutoBlock" , arrayOf(" Off" , " Pick" , " Spoof" , " Switch" ), " Spoof" )
92+ private val autoBlock by choices(" AutoBlock" , arrayOf(" Off" , " Pick" , " Spoof" , " FakeSpoof " , " Switch" ), " Spoof" )
9393 private val sortByHighestAmount by boolean(" SortByHighestAmount" , false ) { autoBlock != " Off" }
9494 private val earlySwitch by boolean(" EarlySwitch" , false ) { autoBlock != " Off" && ! sortByHighestAmount }
9595 private val amountBeforeSwitch by int(
@@ -352,6 +352,18 @@ object Scaffold : Module("Scaffold", Category.PLAYER, Category.SubCategory.PLAYE
352352 return isYawDiagonal && (isMovingDiagonal || isStrafing)
353353 }
354354
355+ private fun isHalfBlockLevel (y : Double ) = abs(y - floor(y) - 0.5 ) <= 1E- 3
356+
357+ private fun isUsableBlockStack (stack : ItemStack ? , fullCubeOnly : Boolean = false): Boolean {
358+ val itemBlock = stack?.item as ? ItemBlock ? : return false
359+ val block = itemBlock.block
360+
361+ return stack.stackSize > 0
362+ && block !in InventoryUtils .BLOCK_BLACKLIST
363+ && block !is BlockBush
364+ && (! fullCubeOnly || block.isFullCube)
365+ }
366+
355367 // Telly
356368 private var ticksUntilJump = 0
357369 private var blocksUntilAxisChange = 0
@@ -369,6 +381,10 @@ object Scaffold : Module("Scaffold", Category.PLAYER, Category.SubCategory.PLAYE
369381
370382 launchY = player.posY.roundToInt()
371383 blocksUntilAxisChange = 0
384+ blocksPlacedUntilJump = 0
385+ blocksToJump = blocksToJumpRange.random()
386+ godBridgeTargetRotation = null
387+ placeRotation = null
372388 }
373389
374390 // Events
@@ -592,7 +608,7 @@ object Scaffold : Module("Scaffold", Category.PLAYER, Category.SubCategory.PLAYE
592608 }
593609
594610 raycast.let {
595- if (! currentRotationsActive || it != null && it.blockPos == target.blockPos && (! raycastProperly || it.sideHit == target.enumFacing)) {
611+ if (! currentRotationsActive || it != null && it.typeOfHit.isBlock && it. blockPos == target.blockPos && (! raycastProperly || it.sideHit == target.enumFacing)) {
596612 val result = if (raycastProperly && it != null ) {
597613 PlaceInfo (it.blockPos, it.sideHit, it.hitVec)
598614 } else {
@@ -631,12 +647,24 @@ object Scaffold : Module("Scaffold", Category.PLAYER, Category.SubCategory.PLAYE
631647
632648 simPlayer.tick()
633649
634- if (! simPlayer.onGround && ! isManualJumpOptionActive || blocksPlacedUntilJump > blocksToJump) {
650+ val shouldTriggerMovement = if (isManualJumpOptionActive) {
651+ blocksPlacedUntilJump >= blocksToJump
652+ } else {
653+ ! simPlayer.onGround
654+ }
655+
656+ if (shouldTriggerMovement) {
657+ val shouldAvoidJump = isLookingDiagonally
658+
635659 when (godbridgeMovementMode) {
636- " Jump" -> event.originalInput.jump = true
660+ " Jump" -> if (shouldAvoidJump) {
661+ event.originalInput.sneak = true
662+ } else {
663+ event.originalInput.jump = true
664+ }
637665 " Sneak" -> event.originalInput.sneak = true
638666 " Both" -> {
639- if (RandomUtils .nextBoolean()) {
667+ if (! shouldAvoidJump && RandomUtils .nextBoolean()) {
640668 event.originalInput.jump = true
641669 } else {
642670 event.originalInput.sneak = true
@@ -654,6 +682,8 @@ object Scaffold : Module("Scaffold", Category.PLAYER, Category.SubCategory.PLAYE
654682 val player = mc.thePlayer ? : return
655683 val holdingItem = player.heldItem?.item is ItemBlock
656684
685+ placeRotation = null
686+
657687 if (! holdingItem && (autoBlock == " Off" || InventoryUtils .findBlockInHotbar() == null )) {
658688 return
659689 }
@@ -680,14 +710,14 @@ object Scaffold : Module("Scaffold", Category.PLAYER, Category.SubCategory.PLAYE
680710 if (! shouldKeepLaunchPosition) launchY = player.posY.roundToInt()
681711
682712 val blockPosition = if (shouldGoDown) {
683- if (player.posY == player.posY.roundToInt() + 0.5 ) {
713+ if (isHalfBlockLevel( player.posY) ) {
684714 BlockPos (player.posX, player.posY - 0.6 , player.posZ)
685715 } else {
686716 BlockPos (player.posX, player.posY - 0.6 , player.posZ).down()
687717 }
688718 } else if (shouldKeepLaunchPosition && launchY <= player.posY) {
689719 BlockPos (player.posX, launchY - 1.0 , player.posZ)
690- } else if (player.posY == player.posY.roundToInt() + 0.5 ) {
720+ } else if (isHalfBlockLevel( player.posY) ) {
691721 BlockPos (player)
692722 } else {
693723 BlockPos (player).down()
@@ -740,8 +770,7 @@ object Scaffold : Module("Scaffold", Category.PLAYER, Category.SubCategory.PLAYE
740770
741771 var stack = player.hotBarSlot(currentSlot).stack
742772
743- // TODO: blacklist more blocks than only bushes
744- if (stack == null || stack.item !is ItemBlock || (stack.item as ItemBlock ).block is BlockBush || stack.stackSize <= 0 || sortByHighestAmount || earlySwitch) {
773+ if (! isUsableBlockStack(stack) || sortByHighestAmount || earlySwitch) {
745774 val blockSlot = if (sortByHighestAmount) {
746775 InventoryUtils .findLargestBlockStackInHotbar() ? : return
747776 } else if (earlySwitch) {
@@ -762,7 +791,13 @@ object Scaffold : Module("Scaffold", Category.PLAYER, Category.SubCategory.PLAYE
762791 }
763792
764793 if (autoBlock != " Off" ) {
765- SilentHotbar .selectSlotSilently(this , blockSlot, render = autoBlock == " Pick" , resetManually = true )
794+ SilentHotbar .selectSlotSilently(
795+ this ,
796+ blockSlot,
797+ render = autoBlock in arrayOf(" Pick" , " FakeSpoof" ),
798+ renderFirstPerson = autoBlock == " Pick" ,
799+ resetManually = true
800+ )
766801 }
767802 }
768803
@@ -852,6 +887,8 @@ object Scaffold : Module("Scaffold", Category.PLAYER, Category.SubCategory.PLAYE
852887 }
853888
854889 placeRotation = null
890+ godBridgeTargetRotation = null
891+ blocksPlacedUntilJump = 0
855892 mc.timer.timerSpeed = 1f
856893
857894 SilentHotbar .resetSlot(this )
@@ -915,7 +952,7 @@ object Scaffold : Module("Scaffold", Category.PLAYER, Category.SubCategory.PLAYE
915952 val z = if (omniDirectionalExpand) cos(yaw).roundToInt() else player.horizontalFacing.directionVec.z
916953 val blockPos = BlockPos (
917954 player.posX + x * it,
918- if (shouldKeepLaunchPosition && launchY <= player.posY) launchY - 1.0 else player.posY - (if (player.posY == player.posY + 0.5 ) 0.0 else 1.0 ) - if (shouldGoDown) 1.0 else 0.0 ,
955+ if (shouldKeepLaunchPosition && launchY <= player.posY) launchY - 1.0 else player.posY - (if (isHalfBlockLevel( player.posY) ) 0.0 else 1.0 ) - if (shouldGoDown) 1.0 else 0.0 ,
919956 player.posZ + z * it
920957 )
921958 val placeInfo = PlaceInfo .get(blockPos)
@@ -1045,8 +1082,15 @@ object Scaffold : Module("Scaffold", Category.PLAYER, Category.SubCategory.PLAYE
10451082
10461083 val distance = eyes.distanceTo(vec)
10471084
1048- if (raycast && (distance > maxReach || world.rayTraceBlocks(eyes, vec, false , true , false ) != null )) {
1049- return null
1085+ if (raycast) {
1086+ if (distance > maxReach) {
1087+ return null
1088+ }
1089+
1090+ val visibilityTrace = world.rayTraceBlocks(eyes, vec, false , false , true )
1091+ if (visibilityTrace != null && (! visibilityTrace.typeOfHit.isBlock || visibilityTrace.blockPos != offsetPos || visibilityTrace.sideHit != side.opposite)) {
1092+ return null
1093+ }
10501094 }
10511095
10521096 val diff = vec - eyes
@@ -1065,7 +1109,7 @@ object Scaffold : Module("Scaffold", Category.PLAYER, Category.SubCategory.PLAYE
10651109
10661110 // If the current rotation already looks at the target block and side, then return right here
10671111 performBlockRaytrace(currRotation, maxReach)?.let { raytrace ->
1068- if (raytrace.blockPos == offsetPos && (! raycast || raytrace.sideHit == side.opposite)) {
1112+ if (raytrace.typeOfHit.isBlock && raytrace. blockPos == offsetPos && (! raycast || raytrace.sideHit == side.opposite)) {
10691113 return PlaceRotation (
10701114 PlaceInfo (
10711115 raytrace.blockPos, side.opposite, modifyVec(raytrace.hitVec, side, Vec3 (offsetPos), ! raycast)
@@ -1078,7 +1122,7 @@ object Scaffold : Module("Scaffold", Category.PLAYER, Category.SubCategory.PLAYE
10781122
10791123 val multiplier = if (options.legitimize) 3 else 1
10801124
1081- if (raytrace.blockPos == offsetPos && (! raycast || raytrace.sideHit == side.opposite) && canUpdateRotation(
1125+ if (raytrace.typeOfHit.isBlock && raytrace. blockPos == offsetPos && (! raycast || raytrace.sideHit == side.opposite) && canUpdateRotation(
10821126 currRotation, rotationForPlacement, multiplier
10831127 )
10841128 ) {
@@ -1128,7 +1172,13 @@ object Scaffold : Module("Scaffold", Category.PLAYER, Category.SubCategory.PLAYE
11281172 InventoryUtils .findBlockInHotbar()
11291173 } ? : return
11301174
1131- SilentHotbar .selectSlotSilently(this , switchSlot, render = autoBlock == " Pick" , resetManually = true )
1175+ SilentHotbar .selectSlotSilently(
1176+ this ,
1177+ switchSlot,
1178+ render = autoBlock in arrayOf(" Pick" , " FakeSpoof" ),
1179+ renderFirstPerson = autoBlock == " Pick" ,
1180+ resetManually = true
1181+ )
11321182 }
11331183
11341184 private fun updatePlacedBlocksForTelly () {
@@ -1150,6 +1200,7 @@ object Scaffold : Module("Scaffold", Category.PLAYER, Category.SubCategory.PLAYE
11501200 val thePlayer = mc.thePlayer ? : return false
11511201
11521202 val prevSize = stack.stackSize
1203+ val suppressFirstPersonSwitchAnimation = autoBlock == " FakeSpoof" && SilentHotbar .isSlotModified(this )
11531204
11541205 val motionSprintActive = sprint && sprintMode == " MotionSprint" && thePlayer.isMoving
11551206 if (motionSprintActive) {
@@ -1182,15 +1233,19 @@ object Scaffold : Module("Scaffold", Category.PLAYER, Category.SubCategory.PLAYE
11821233 if (stack.stackSize <= 0 ) {
11831234 thePlayer.inventory.mainInventory[SilentHotbar .currentSlot] = null
11841235 ForgeEventFactory .onPlayerDestroyItem(thePlayer, stack)
1185- } else if (stack.stackSize != prevSize || mc.playerController.isInCreativeMode) mc.entityRenderer.itemRenderer.resetEquippedProgress()
1236+ } else if (! suppressFirstPersonSwitchAnimation && (stack.stackSize != prevSize || mc.playerController.isInCreativeMode)) {
1237+ mc.entityRenderer.itemRenderer.resetEquippedProgress()
1238+ }
11861239
11871240 placeRotation = null
11881241
11891242 placedBlocksWithoutEagle++
11901243
11911244 onSuccess()
11921245 } else {
1193- if (thePlayer.sendUseItem(stack)) mc.entityRenderer.itemRenderer.resetEquippedProgress2()
1246+ if (thePlayer.sendUseItem(stack) && ! suppressFirstPersonSwitchAnimation) {
1247+ mc.entityRenderer.itemRenderer.resetEquippedProgress2()
1248+ }
11941249 }
11951250
11961251 return clickedSuccessfully
0 commit comments