@@ -10,9 +10,11 @@ import com.lambda.client.module.Category
10
10
import com.lambda.client.module.Module
11
11
import com.lambda.client.module.modules.client.Hud
12
12
import com.lambda.client.setting.settings.impl.collection.CollectionSetting
13
+ import com.lambda.client.util.EntityUtils
13
14
import com.lambda.client.util.color.ColorHolder
14
15
import com.lambda.client.util.graphics.ESPRenderer
15
16
import com.lambda.client.util.graphics.GeometryMasks
17
+ import com.lambda.client.util.graphics.LambdaTessellator
16
18
import com.lambda.client.util.graphics.ShaderHelper
17
19
import com.lambda.client.util.math.VectorUtils.distanceTo
18
20
import com.lambda.client.util.text.MessageSendHelper
@@ -26,14 +28,19 @@ import kotlinx.coroutines.isActive
26
28
import kotlinx.coroutines.launch
27
29
import net.minecraft.block.BlockEnderChest
28
30
import net.minecraft.block.BlockShulkerBox
31
+ import net.minecraft.block.BlockStandingSign
32
+ import net.minecraft.block.BlockWallSign
33
+ import net.minecraft.block.state.BlockStateContainer.StateImplementation
29
34
import net.minecraft.block.state.IBlockState
30
35
import net.minecraft.entity.EntityList
31
36
import net.minecraft.entity.item.EntityItemFrame
32
37
import net.minecraft.init.Blocks
33
38
import net.minecraft.network.play.server.SPacketBlockChange
34
39
import net.minecraft.network.play.server.SPacketMultiBlockChange
40
+ import net.minecraft.tileentity.TileEntitySign
35
41
import net.minecraft.util.math.BlockPos
36
42
import net.minecraft.util.math.ChunkPos
43
+ import net.minecraft.util.text.TextComponentString
37
44
import net.minecraft.world.chunk.Chunk
38
45
import net.minecraftforge.fml.common.gameevent.TickEvent
39
46
import java.util.concurrent.ConcurrentHashMap
@@ -52,6 +59,8 @@ object Search : Module(
52
59
private val blockSearch by setting(" Block Search" , true )
53
60
private val illegalBedrock = setting(" Illegal Bedrock" , false )
54
61
private val illegalNetherWater = setting(" Illegal Nether Water" , false )
62
+ private val oldSigns = setting(" Old Signs" , true )
63
+ private val oldSignsColor by setting(" Old Signs Color" , ColorHolder (220 , 0 , 0 , 110 ), visibility = { oldSigns.value })
55
64
private val range by setting(" Search Range" , 512 , 0 .. 4096 , 8 )
56
65
private val yRangeBottom by setting(" Top Y" , 256 , 0 .. 256 , 1 )
57
66
private val yRangeTop by setting(" Bottom Y" , 0 , 0 .. 256 , 1 )
@@ -91,6 +100,7 @@ object Search : Module(
91
100
blockSearchList.editListeners.add { blockSearchListUpdateListener(isEnabled) }
92
101
illegalBedrock.listeners.add { blockSearchListUpdateListener(illegalBedrock.value) }
93
102
illegalNetherWater.listeners.add { blockSearchListUpdateListener(illegalNetherWater.value) }
103
+ oldSigns.listeners.add { blockSearchListUpdateListener(oldSigns.value) }
94
104
95
105
onEnable {
96
106
if (! overrideWarning && ShaderHelper .isIntegratedGraphics) {
@@ -142,7 +152,7 @@ object Search : Module(
142
152
}
143
153
144
154
safeListener<ChunkDataEvent > {
145
- // We avoid listening to SPacketChunkData directly here as even on PostReceive the chunk is not always
155
+ // We avoid listening to SPacketChunkData directly here, as even on PostReceive the chunk is not always
146
156
// fully loaded into the world. Chunk load is handled on a separate thread in mc code.
147
157
// i.e. world.getChunk(x, z) can and will return an empty chunk in the packet event
148
158
defaultScope.launch {
@@ -191,16 +201,18 @@ object Search : Module(
191
201
entitySearchDimensionFilter.value.find { dimFilter -> dimFilter.searchKey == entityName }?.dim
192
202
}?.contains(player.dimension) ? : true
193
203
}
194
- .sortedBy {
195
- it.distanceTo(player.getPositionEyes(1f ))
196
- }
204
+ .sortedBy { it.distanceTo(player.getPositionEyes(1f )) }
197
205
.take(maximumEntities)
198
- .filter {
199
- it.distanceTo(player.getPositionEyes(1f )) < range
206
+ .filter { it.distanceTo(player.getPositionEyes(1f )) < range }
207
+ .map {
208
+ Triple (
209
+ it.renderBoundingBox.offset(EntityUtils .getInterpolatedAmount(it, LambdaTessellator .pTicks())),
210
+ entitySearchColor,
211
+ GeometryMasks .Quad .ALL
212
+ )
200
213
}
201
214
.toMutableList()
202
- entityRenderer.clear()
203
- renderList.forEach { entityRenderer.add(it, entitySearchColor) }
215
+ entityRenderer.replaceAll(renderList)
204
216
}
205
217
206
218
private fun SafeClientEvent.searchAllLoadedChunks () {
@@ -270,7 +282,6 @@ object Search : Module(
270
282
}
271
283
}
272
284
.toMutableList()
273
-
274
285
blockRenderer.replaceAll(renderList)
275
286
}
276
287
@@ -294,6 +305,15 @@ object Search : Module(
294
305
for (y in yRange) for (x in xRange) for (z in zRange) {
295
306
val pos = BlockPos (x, y, z)
296
307
val blockState = chunk.getBlockState(pos)
308
+ if (isOldSign(blockState, pos)) {
309
+ val signState = if (blockState.block == Blocks .STANDING_SIGN ) {
310
+ OldStandingSign (blockState)
311
+ } else {
312
+ OldWallSign (blockState)
313
+ }
314
+ blocks.add(pos to signState)
315
+ continue // skip searching for regular sign at this pos
316
+ }
297
317
if (searchQuery(blockState, pos)) blocks.add(pos to blockState)
298
318
}
299
319
return blocks
@@ -304,8 +324,8 @@ object Search : Module(
304
324
if (block == Blocks .AIR ) return false
305
325
return (blockSearchList.contains(block.registryName.toString())
306
326
&& blockSearchDimensionFilter.value.find { dimFilter ->
307
- dimFilter.searchKey == block.registryName.toString()
308
- }?.dim?.contains(player.dimension) ? : true )
327
+ dimFilter.searchKey == block.registryName.toString()
328
+ }?.dim?.contains(player.dimension) ? : true )
309
329
|| isIllegalBedrock(state, pos)
310
330
|| isIllegalWater(state)
311
331
}
@@ -314,15 +334,9 @@ object Search : Module(
314
334
if (! illegalBedrock.value) return false
315
335
if (state.block != Blocks .BEDROCK ) return false
316
336
return when (player.dimension) {
317
- 0 -> {
318
- pos.y >= 5
319
- }
320
- - 1 -> {
321
- pos.y in 5 .. 122
322
- }
323
- else -> {
324
- false
325
- }
337
+ 0 -> pos.y >= 5
338
+ - 1 -> pos.y in 5 .. 122
339
+ else -> false
326
340
}
327
341
}
328
342
@@ -331,6 +345,25 @@ object Search : Module(
331
345
return player.dimension == - 1 && state.isWater
332
346
}
333
347
348
+ private fun SafeClientEvent.isOldSign (state : IBlockState , pos : BlockPos ): Boolean {
349
+ if (! oldSigns.value) return false
350
+ return (state.block == Blocks .STANDING_SIGN || state.block == Blocks .WALL_SIGN ) && isOldSignText(pos)
351
+ }
352
+
353
+ private fun SafeClientEvent.isOldSignText (pos : BlockPos ): Boolean {
354
+ // Explanation: Old signs on 2b2t (pre-2015 <1.9 ?) have older style NBT text tags.
355
+ // We can tell them apart by checking if there are siblings in the tag.
356
+ // Old signs won't have siblings.
357
+ val signTextComponents = listOf (world.getTileEntity(pos))
358
+ .filterIsInstance<TileEntitySign >()
359
+ .flatMap { it.signText.toList() }
360
+ .filterIsInstance<TextComponentString >()
361
+ .toList()
362
+ return signTextComponents.isNotEmpty()
363
+ && signTextComponents.all { it.siblings.size == 0 }
364
+ && ! signTextComponents.all { it.text.isEmpty() }
365
+ }
366
+
334
367
private fun SafeClientEvent.getBlockColor (pos : BlockPos , blockState : IBlockState ): ColorHolder {
335
368
val block = blockState.block
336
369
return if (autoBlockColor) {
@@ -345,6 +378,12 @@ object Search : Module(
345
378
is BlockEnderChest -> {
346
379
ColorHolder (64 , 49 , 114 )
347
380
}
381
+ is BlockOldStandingSign -> {
382
+ oldSignsColor
383
+ }
384
+ is BlockOldWallSign -> {
385
+ oldSignsColor
386
+ }
348
387
else -> {
349
388
val colorInt = blockState.getMapColor(world, pos).colorValue
350
389
ColorHolder ((colorInt shr 16 ), (colorInt shr 8 and 255 ), (colorInt and 255 ))
@@ -361,4 +400,8 @@ object Search : Module(
361
400
}
362
401
}
363
402
403
+ class OldWallSign (blockStateIn : IBlockState ): StateImplementation(BlockOldWallSign , blockStateIn.properties)
404
+ class OldStandingSign (blockStateIn : IBlockState ): StateImplementation(BlockOldStandingSign , blockStateIn.properties)
405
+ object BlockOldWallSign: BlockWallSign()
406
+ object BlockOldStandingSign: BlockStandingSign()
364
407
}
0 commit comments