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,17 +271,22 @@ object CrystalAura : Module(
|
||||||
|
|
||||||
private fun SafeClientEvent.place() {
|
private fun SafeClientEvent.place() {
|
||||||
getPlacingPos()?.let { pos ->
|
getPlacingPos()?.let { pos ->
|
||||||
getHand()?.let { hand ->
|
val hand = getHand()
|
||||||
if (autoSwap && getHand() == null) {
|
|
||||||
|
if (hand == null) {
|
||||||
|
if (autoSwap) {
|
||||||
player.hotbarSlots.firstItem(Items.END_CRYSTAL)?.let {
|
player.hotbarSlots.firstItem(Items.END_CRYSTAL)?.let {
|
||||||
if (spoofHotbar) PlayerPacketManager.spoofHotbar(it.hotbarSlot)
|
if (spoofHotbar) PlayerPacketManager.spoofHotbar(it.hotbarSlot)
|
||||||
else swapToSlot(it)
|
else swapToSlot(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
placeTimer = 0
|
placeTimer = 0
|
||||||
inactiveTicks = 0
|
inactiveTicks = 0
|
||||||
lastLookAt = Vec3d(pos).add(0.5, placeOffset.toDouble(), 0.5)
|
lastLookAt = Vec3d(pos).add(0.5, placeOffset.toDouble(), 0.5)
|
||||||
|
|
||||||
sendOrQueuePacket(getPlacePacket(pos, hand))
|
sendOrQueuePacket(getPlacePacket(pos, hand))
|
||||||
if (extraPlacePacket) sendOrQueuePacket(getPlacePacket(pos, hand))
|
if (extraPlacePacket) sendOrQueuePacket(getPlacePacket(pos, hand))
|
||||||
if (placeSwing) sendOrQueuePacket(CPacketAnimation(hand))
|
if (placeSwing) sendOrQueuePacket(CPacketAnimation(hand))
|
||||||
|
@ -301,7 +306,6 @@ object CrystalAura : Module(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private fun SafeClientEvent.preExplode(): Boolean {
|
private fun SafeClientEvent.preExplode(): Boolean {
|
||||||
if (antiWeakness && player.isPotionActive(MobEffects.WEAKNESS) && !isHoldingTool()) {
|
if (antiWeakness && player.isPotionActive(MobEffects.WEAKNESS) && !isHoldingTool()) {
|
||||||
|
@ -462,6 +466,7 @@ object CrystalAura : Module(
|
||||||
/* General */
|
/* General */
|
||||||
private fun SafeClientEvent.getHand(): EnumHand? {
|
private fun SafeClientEvent.getHand(): EnumHand? {
|
||||||
val serverSideItem = if (spoofHotbar) player.inventory.getStackInSlot(PlayerPacketManager.serverSideHotbar).item else null
|
val serverSideItem = if (spoofHotbar) player.inventory.getStackInSlot(PlayerPacketManager.serverSideHotbar).item else null
|
||||||
|
|
||||||
return when (Items.END_CRYSTAL) {
|
return when (Items.END_CRYSTAL) {
|
||||||
player.heldItemOffhand.item -> EnumHand.OFF_HAND
|
player.heldItemOffhand.item -> EnumHand.OFF_HAND
|
||||||
player.heldItemMainhand.item -> EnumHand.MAIN_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.color.ColorHolder
|
||||||
import me.zeroeightsix.kami.util.combat.CrystalUtils.calcCrystalDamage
|
import me.zeroeightsix.kami.util.combat.CrystalUtils.calcCrystalDamage
|
||||||
import me.zeroeightsix.kami.util.graphics.ESPRenderer
|
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.block
|
||||||
import me.zeroeightsix.kami.util.items.firstBlock
|
import me.zeroeightsix.kami.util.items.firstBlock
|
||||||
import me.zeroeightsix.kami.util.items.hotbarSlots
|
import me.zeroeightsix.kami.util.items.hotbarSlots
|
||||||
import me.zeroeightsix.kami.util.math.RotationUtils
|
import me.zeroeightsix.kami.util.math.RotationUtils
|
||||||
import me.zeroeightsix.kami.util.math.VectorUtils
|
import me.zeroeightsix.kami.util.math.VectorUtils
|
||||||
import me.zeroeightsix.kami.util.math.VectorUtils.distanceTo
|
import me.zeroeightsix.kami.util.math.VectorUtils.distanceTo
|
||||||
import me.zeroeightsix.kami.util.text.MessageSendHelper
|
|
||||||
import me.zeroeightsix.kami.util.threads.safeListener
|
import me.zeroeightsix.kami.util.threads.safeListener
|
||||||
import net.minecraft.entity.EntityLivingBase
|
import net.minecraft.entity.EntityLivingBase
|
||||||
import net.minecraft.init.Blocks
|
import net.minecraft.init.Blocks
|
||||||
|
@ -78,8 +76,10 @@ object CrystalBasePlace : Module(
|
||||||
safeListener<TickEvent.ClientTickEvent> {
|
safeListener<TickEvent.ClientTickEvent> {
|
||||||
if (it.phase != TickEvent.Phase.START) return@safeListener
|
if (it.phase != TickEvent.Phase.START) return@safeListener
|
||||||
inactiveTicks++
|
inactiveTicks++
|
||||||
|
|
||||||
if (!CombatManager.isOnTopPriority(CrystalBasePlace) || CombatSetting.pause) return@safeListener
|
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
|
val target = CombatManager.target ?: return@safeListener
|
||||||
|
|
||||||
placePacket?.let { packet ->
|
placePacket?.let { packet ->
|
||||||
|
@ -106,24 +106,11 @@ object CrystalBasePlace : Module(
|
||||||
}
|
}
|
||||||
|
|
||||||
private val SafeClientEvent.isHoldingObby
|
private val SafeClientEvent.isHoldingObby
|
||||||
get() =
|
get() = isObby(player.heldItemMainhand)
|
||||||
isObby(player.heldItemMainhand)
|
|
||||||
|| isObby(player.inventory.getStackInSlot(PlayerPacketManager.serverSideHotbar))
|
|| isObby(player.inventory.getStackInSlot(PlayerPacketManager.serverSideHotbar))
|
||||||
|
|
||||||
private fun isObby(itemStack: ItemStack) = itemStack.item.block == Blocks.OBSIDIAN
|
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) {
|
private fun SafeClientEvent.prePlace(entity: EntityLivingBase) {
|
||||||
if (rotationTo != null || !timer.tick((delay.value * 50.0f).toLong(), false)) return
|
if (rotationTo != null || !timer.tick((delay.value * 50.0f).toLong(), false)) return
|
||||||
val placeInfo = getPlaceInfo(entity)
|
val placeInfo = getPlaceInfo(entity)
|
||||||
|
|
Loading…
Reference in New Issue