1
1
package com.lambda.client.module.modules.player
2
2
3
+ import com.lambda.client.commons.interfaces.DisplayEnum
3
4
import com.lambda.client.event.Phase
4
5
import com.lambda.client.event.SafeClientEvent
5
6
import com.lambda.client.event.events.OnUpdateWalkingPlayerEvent
@@ -9,13 +10,11 @@ import com.lambda.client.manager.managers.HotbarManager.spoofHotbar
9
10
import com.lambda.client.mixin.extension.syncCurrentPlayItem
10
11
import com.lambda.client.module.Category
11
12
import com.lambda.client.module.Module
13
+ import com.lambda.client.setting.settings.impl.collection.CollectionSetting
12
14
import com.lambda.client.util.EntityUtils.prevPosVector
13
15
import com.lambda.client.util.TickTimer
14
16
import com.lambda.client.util.TimeUnit
15
- import com.lambda.client.util.items.HotbarSlot
16
- import com.lambda.client.util.items.firstItem
17
- import com.lambda.client.util.items.hotbarSlots
18
- import com.lambda.client.util.items.swapToSlot
17
+ import com.lambda.client.util.items.*
19
18
import com.lambda.client.util.math.RotationUtils.getRotationTo
20
19
import com.lambda.client.util.math.VectorUtils.toBlockPos
21
20
import com.lambda.client.util.threads.safeListener
@@ -36,6 +35,7 @@ object Scaffold : Module(
36
35
category = Category .PLAYER ,
37
36
modulePriority = 500
38
37
) {
38
+ private val blockSelectionMode by setting(" Block Selection Mode" , ScaffoldBlockSelectionMode .ANY )
39
39
private val tower by setting(" Tower" , true )
40
40
private val spoofHotbar by setting(" Spoof Hotbar" , true )
41
41
val safeWalk by setting(" Safe Walk" , true )
@@ -45,12 +45,27 @@ object Scaffold : Module(
45
45
private val maxRange by setting(" Max Range" , 1 , 0 .. 3 , 1 )
46
46
private val noGhost by setting(" No Ghost Blocks" , false )
47
47
48
+ val blockSelectionWhitelist = setting(CollectionSetting (" BlockWhitelist" , linkedSetOf(" minecraft:obsidian" ), { false }))
49
+ val blockSelectionBlacklist = setting(CollectionSetting (" BlockBlacklist" , linkedSetOf(" minecraft:white_shulker_box" , " minecraft:orange_shulker_box" ,
50
+ " minecraft:magenta_shulker_box" , " minecraft:light_blue_shulker_box" , " minecraft:yellow_shulker_box" , " minecraft:lime_shulker_box" ,
51
+ " minecraft:pink_shulker_box" , " minecraft:gray_shulker_box" , " minecraft:silver_shulker_box" , " minecraft:cyan_shulker_box" ,
52
+ " minecraft:purple_shulker_box" , " minecraft:blue_shulker_box" , " minecraft:brown_shulker_box" , " minecraft:green_shulker_box" ,
53
+ " minecraft:red_shulker_box" , " minecraft:black_shulker_box" , " minecraft:crafting_table" , " minecraft:dropper" ,
54
+ " minecraft:hopper" , " minecraft:dispenser" , " minecraft:ender_chest" , " minecraft:furnace" ),
55
+ { false }))
56
+
48
57
private val placeTimer = TickTimer (TimeUnit .TICKS )
49
58
50
59
private var lastHitVec: Vec3d ? = null
51
60
private var placeInfo: PlaceInfo ? = null
52
61
private var inactiveTicks = 69
53
62
63
+ private enum class ScaffoldBlockSelectionMode (override val displayName : String ): DisplayEnum {
64
+ ANY (" Any" ),
65
+ WHITELIST (" Whitelist" ),
66
+ BLACKLIST (" Blacklist" )
67
+ }
68
+
54
69
override fun isActive (): Boolean {
55
70
return isEnabled && inactiveTicks <= 5
56
71
}
@@ -133,9 +148,28 @@ object Scaffold : Module(
133
148
(value * 2.5 * maxRange).roundToInt().coerceAtMost(maxRange)
134
149
135
150
private fun SafeClientEvent.swap (): Boolean {
136
- if (player.heldItemMainhand.item is ItemBlock || player.heldItemOffhand.item is ItemBlock ) {
137
- inactiveTicks = 0 ;
138
- return true ;
151
+ // todo: refactor this into a function?
152
+ when (blockSelectionMode) {
153
+ ScaffoldBlockSelectionMode .ANY -> {
154
+ if (player.heldItemMainhand.item is ItemBlock || player.heldItemOffhand.item is ItemBlock ) {
155
+ inactiveTicks = 0 ;
156
+ return true ;
157
+ }
158
+ }
159
+ ScaffoldBlockSelectionMode .BLACKLIST -> {
160
+ if ((player.heldItemMainhand.item is ItemBlock && ! blockSelectionBlacklist.contains(player.heldItemMainhand.item.block.registryName.toString()))
161
+ || player.heldItemOffhand.item is ItemBlock && ! blockSelectionBlacklist.contains(player.heldItemOffhand.item.block.registryName.toString())) {
162
+ inactiveTicks = 0
163
+ return true
164
+ }
165
+ }
166
+ ScaffoldBlockSelectionMode .WHITELIST -> {
167
+ if ((player.heldItemMainhand.item is ItemBlock && blockSelectionWhitelist.contains(player.heldItemMainhand.item.block.registryName.toString()))
168
+ || player.heldItemOffhand.item is ItemBlock && blockSelectionWhitelist.contains(player.heldItemOffhand.item.block.registryName.toString())) {
169
+ inactiveTicks = 0
170
+ return true
171
+ }
172
+ }
139
173
}
140
174
getBlockSlot()?.let { slot ->
141
175
if (spoofHotbar) spoofHotbar(slot)
@@ -148,6 +182,16 @@ object Scaffold : Module(
148
182
149
183
private fun SafeClientEvent.getBlockSlot (): HotbarSlot ? {
150
184
playerController.syncCurrentPlayItem()
151
- return player.hotbarSlots.firstItem<ItemBlock , HotbarSlot >()
185
+ return player.hotbarSlots.firstItem<ItemBlock , HotbarSlot > {
186
+ when (blockSelectionMode) {
187
+ ScaffoldBlockSelectionMode .BLACKLIST -> {
188
+ return @firstItem ! blockSelectionBlacklist.contains(it.item.block.registryName.toString())
189
+ }
190
+ ScaffoldBlockSelectionMode .WHITELIST -> {
191
+ return @firstItem blockSelectionWhitelist.contains(it.item.block.registryName.toString())
192
+ }
193
+ else -> return @firstItem true
194
+ }
195
+ }
152
196
}
153
197
}
0 commit comments