Skip to content

Improve crystal aura (second try at git) - #326

Open
KMatias123 wants to merge 4 commits into
lambda-client:1.21.11from
KMatias123:fix/crystalaura-grim-2
Open

Improve crystal aura (second try at git)#326
KMatias123 wants to merge 4 commits into
lambda-client:1.21.11from
KMatias123:fix/crystalaura-grim-2

Conversation

@KMatias123

@KMatias123 KMatias123 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

note: this has not been tested on 2b2t as i do not have priority queue, i have tested it on ccbluex's server

additions:

  • rendering and settings
  • the hand selected in the settings is now what hand the module prefers to use, so if you have crystals in your offhand while having the hand setting set to main and need to place some it will not start to move crystals from the inventory and instead places the ones in the inventory, after they are used it will then start moving crystals to the hotbar

fixes:

  • trying to place at opportunities that are blocked by other crystals
  • main hand swapping when main hand is selected as preference
  • hotbar logic

improvements:

  • made it bypass grim, also with the prediction exploit

@github-project-automation github-project-automation Bot moved this to Backlog in Kanban Aug 20, 2026
@KMatias123
KMatias123 marked this pull request as draft August 20, 2026 20:47
…ode to ticked as async was being weird. Fixed hotbar logic.
@KMatias123
KMatias123 marked this pull request as ready for review August 21, 2026 17:30
@beanbag44
beanbag44 self-requested a review August 22, 2026 08:15
::worldWidthSetting
)
forEachSetting {
visibility { old -> { old() && render }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we typically keep spaces between }} in scenarios like this. No biggie, just thought i'd say anyway

@Tab(RENDERING_TAB) private val renderLineSettings by configBlock(WorldLineSettings(this))
.withEdits {
hideAllExcept (
::worldWidthSetting

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can inline this so its (::worldWidthSetting)

immediateRenderer("CrystalAura Immediate Renderer") {
runSafe {
if (lastPlace != null) {
if (lastPlace!!.second + 100 < System.currentTimeMillis()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we never use !! as its an unsafe operator. Could be changed to use

val place = lastPlace ?: return@listen

then using the place value as we know its not null

hand, BlockHitResult(opportunity.crystalPosition, opportunity.side, opportunity.blockPos, false), 0
)
}
runSafe {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're already in a SafeContext so we shouldnt need runSafe here

lastPlace = Pair(opportunity.blockPos, System.currentTimeMillis())
}
interaction.syncSelectedSlot() // TODO: when server only hotbar swap gets implemented, this will be removed
mc.interactionManager!!.sendSequencedPacket(world, { sequence ->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can just use interaction.sendSequencedPacket due to the SafeContext

PlayerInteractBlockC2SPacket(
hand, BlockHitResult(opportunity.crystalPosition, opportunity.side, opportunity.blockPos, false), sequence
)
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for ; here and the lambda can be moved out of the parenthesis like how the settings do visibility

val entitiesNearby = fastEntitySearch<Entity>(3.5, pos)
val crystals = entitiesNearby.filterIsInstance<EndCrystalEntity>()
val otherEntities = entitiesNearby - crystals + player
val otherEntities = entitiesNearby - crystals.toSet() + player

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this to make duplicate lookups faster?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah


if (itemToUse == null || swapHand == Hand.MAIN_HAND) {
if (swapHand == Hand.MAIN_HAND) {
val itemStack = selection.bestItemMatch(player.hotbarStacks)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works, but ive been migrating things to use the containers. This would instead use HotbarContainer to access the slots

if (itemStack == null) { // retrieve to hotbar
if (!selection.transfer(swapTo)) return@runSafe
}
val s = player.hotbarStacks.indexOf(itemStack)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of indexOf here, you could use the container as said above, and then access the index through Slot::index

placeTimer.runSafeIfPassed(placeDelay.milliseconds) {
placeInternal(this@Opportunity, swapHand)
if (placeTimer.timePassed(placeDelay.milliseconds) || (postPacketPlace && safeToPlaceInstantly && !placePostPause)) {
runSafe {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldnt be a need here for runSafe as we're already in a runSafe context from the start of the function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants