mirror of https://github.com/kami-blue/client
[fix] CrystalAura auto swap, don't disable CrystalBasePlace after respawn
This commit is contained in:
parent
254d6fc1f6
commit
d925524ad1
|
@ -271,32 +271,36 @@ object CrystalAura : Module(
|
|||
|
||||
private fun SafeClientEvent.place() {
|
||||
getPlacingPos()?.let { pos ->
|
||||
getHand()?.let { hand ->
|
||||
if (autoSwap && getHand() == null) {
|
||||
val hand = getHand()
|
||||
|
||||
if (hand == null) {
|
||||
if (autoSwap) {
|
||||
player.hotbarSlots.firstItem(Items.END_CRYSTAL)?.let {
|
||||
if (spoofHotbar) PlayerPacketManager.spoofHotbar(it.hotbarSlot)
|
||||
else swapToSlot(it)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
placeTimer = 0
|
||||
inactiveTicks = 0
|
||||
lastLookAt = Vec3d(pos).add(0.5, placeOffset.toDouble(), 0.5)
|
||||
sendOrQueuePacket(getPlacePacket(pos, hand))
|
||||
if (extraPlacePacket) sendOrQueuePacket(getPlacePacket(pos, hand))
|
||||
if (placeSwing) sendOrQueuePacket(CPacketAnimation(hand))
|
||||
placeTimer = 0
|
||||
inactiveTicks = 0
|
||||
lastLookAt = Vec3d(pos).add(0.5, placeOffset.toDouble(), 0.5)
|
||||
|
||||
val crystalPos = pos.up()
|
||||
placedBBMap[crystalPos] = getCrystalBB(crystalPos) to System.currentTimeMillis()
|
||||
sendOrQueuePacket(getPlacePacket(pos, hand))
|
||||
if (extraPlacePacket) sendOrQueuePacket(getPlacePacket(pos, hand))
|
||||
if (placeSwing) sendOrQueuePacket(CPacketAnimation(hand))
|
||||
|
||||
if (predictExplode) {
|
||||
defaultScope.launch {
|
||||
delay(predictDelay.toLong())
|
||||
val crystalPos = pos.up()
|
||||
placedBBMap[crystalPos] = getCrystalBB(crystalPos) to System.currentTimeMillis()
|
||||
|
||||
synchronized(lockObject) {
|
||||
if (!placedBBMap.containsKey(crystalPos)) return@synchronized
|
||||
packetExplode(lastEntityID + 1, pos, crystalPos.toVec3d(0.5, 0.0, 0.5))
|
||||
}
|
||||
if (predictExplode) {
|
||||
defaultScope.launch {
|
||||
delay(predictDelay.toLong())
|
||||
|
||||
synchronized(lockObject) {
|
||||
if (!placedBBMap.containsKey(crystalPos)) return@synchronized
|
||||
packetExplode(lastEntityID + 1, pos, crystalPos.toVec3d(0.5, 0.0, 0.5))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -462,6 +466,7 @@ object CrystalAura : Module(
|
|||
/* General */
|
||||
private fun SafeClientEvent.getHand(): EnumHand? {
|
||||
val serverSideItem = if (spoofHotbar) player.inventory.getStackInSlot(PlayerPacketManager.serverSideHotbar).item else null
|
||||
|
||||
return when (Items.END_CRYSTAL) {
|
||||
player.heldItemOffhand.item -> EnumHand.OFF_HAND
|
||||
player.heldItemMainhand.item -> EnumHand.MAIN_HAND
|
||||
|
|
|
@ -10,14 +10,12 @@ import me.zeroeightsix.kami.util.*
|
|||
import me.zeroeightsix.kami.util.color.ColorHolder
|
||||
import me.zeroeightsix.kami.util.combat.CrystalUtils.calcCrystalDamage
|
||||
import me.zeroeightsix.kami.util.graphics.ESPRenderer
|
||||
import me.zeroeightsix.kami.util.items.HotbarSlot
|
||||
import me.zeroeightsix.kami.util.items.block
|
||||
import me.zeroeightsix.kami.util.items.firstBlock
|
||||
import me.zeroeightsix.kami.util.items.hotbarSlots
|
||||
import me.zeroeightsix.kami.util.math.RotationUtils
|
||||
import me.zeroeightsix.kami.util.math.VectorUtils
|
||||
import me.zeroeightsix.kami.util.math.VectorUtils.distanceTo
|
||||
import me.zeroeightsix.kami.util.text.MessageSendHelper
|
||||
import me.zeroeightsix.kami.util.threads.safeListener
|
||||
import net.minecraft.entity.EntityLivingBase
|
||||
import net.minecraft.init.Blocks
|
||||
|
@ -78,8 +76,10 @@ object CrystalBasePlace : Module(
|
|||
safeListener<TickEvent.ClientTickEvent> {
|
||||
if (it.phase != TickEvent.Phase.START) return@safeListener
|
||||
inactiveTicks++
|
||||
|
||||
if (!CombatManager.isOnTopPriority(CrystalBasePlace) || CombatSetting.pause) return@safeListener
|
||||
val slot = getObby() ?: return@safeListener
|
||||
|
||||
val slot = player.hotbarSlots.firstBlock(Blocks.OBSIDIAN) ?: return@safeListener
|
||||
val target = CombatManager.target ?: return@safeListener
|
||||
|
||||
placePacket?.let { packet ->
|
||||
|
@ -106,24 +106,11 @@ object CrystalBasePlace : Module(
|
|||
}
|
||||
|
||||
private val SafeClientEvent.isHoldingObby
|
||||
get() =
|
||||
isObby(player.heldItemMainhand)
|
||||
get() = isObby(player.heldItemMainhand)
|
||||
|| isObby(player.inventory.getStackInSlot(PlayerPacketManager.serverSideHotbar))
|
||||
|
||||
private fun isObby(itemStack: ItemStack) = itemStack.item.block == Blocks.OBSIDIAN
|
||||
|
||||
private fun SafeClientEvent.getObby(): HotbarSlot? {
|
||||
val slot = player.hotbarSlots.firstBlock(Blocks.OBSIDIAN)
|
||||
|
||||
if (slot == null) { // Obsidian check
|
||||
MessageSendHelper.sendChatMessage("$chatName No obsidian in hotbar, disabling!")
|
||||
disable()
|
||||
return null
|
||||
}
|
||||
|
||||
return slot
|
||||
}
|
||||
|
||||
private fun SafeClientEvent.prePlace(entity: EntityLivingBase) {
|
||||
if (rotationTo != null || !timer.tick((delay.value * 50.0f).toLong(), false)) return
|
||||
val placeInfo = getPlaceInfo(entity)
|
||||
|
|
Loading…
Reference in New Issue