Skip to content
This repository has been archived by the owner on Aug 14, 2024. It is now read-only.

Commit

Permalink
splash potions aren't usable
Browse files Browse the repository at this point in the history
  • Loading branch information
ManInMyVan committed Jul 31, 2024
1 parent 1ff79e5 commit d0ec6b3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,33 @@
package net.ccbluex.liquidbounce.features.module.modules.movement

import net.ccbluex.liquidbounce.event.EventState
import net.ccbluex.liquidbounce.event.EventTarget
import net.ccbluex.liquidbounce.event.EventState.POST
import net.ccbluex.liquidbounce.event.EventState.PRE
import net.ccbluex.liquidbounce.event.EventTarget
import net.ccbluex.liquidbounce.event.events.MotionEvent
import net.ccbluex.liquidbounce.event.events.PacketEvent
import net.ccbluex.liquidbounce.event.events.SlowDownEvent
import net.ccbluex.liquidbounce.features.module.Module
import net.ccbluex.liquidbounce.features.module.ModuleCategory.MOVEMENT
import net.ccbluex.liquidbounce.features.module.modules.combat.KillAura
import net.ccbluex.liquidbounce.features.module.modules.movement.noslowmodes.NoSlowMode
import net.ccbluex.liquidbounce.features.module.modules.movement.noslowmodes.aac.*
import net.ccbluex.liquidbounce.features.module.modules.movement.noslowmodes.ncp.*
import net.ccbluex.liquidbounce.features.module.modules.movement.noslowmodes.aac.AAC
import net.ccbluex.liquidbounce.features.module.modules.movement.noslowmodes.aac.AAC2
import net.ccbluex.liquidbounce.features.module.modules.movement.noslowmodes.ncp.NCP
import net.ccbluex.liquidbounce.features.module.modules.movement.noslowmodes.ncp.NewNCP
import net.ccbluex.liquidbounce.features.module.modules.movement.noslowmodes.ncp.UNCP
import net.ccbluex.liquidbounce.features.module.modules.movement.noslowmodes.ncp.UNCP.shouldSwap
import net.ccbluex.liquidbounce.features.module.modules.movement.noslowmodes.ncp.UNCP2
import net.ccbluex.liquidbounce.features.module.modules.movement.noslowmodes.other.*
import net.ccbluex.liquidbounce.features.module.modules.movement.noslowmodes.watchdog.*
import net.ccbluex.liquidbounce.features.module.modules.movement.noslowmodes.watchdog.WatchDog
import net.ccbluex.liquidbounce.features.module.modules.movement.noslowmodes.watchdog.WatchDog2
import net.ccbluex.liquidbounce.utils.MovementUtils.hasMotion
import net.ccbluex.liquidbounce.utils.NoSlowItem
import net.ccbluex.liquidbounce.utils.NoSlowItem.*
import net.ccbluex.liquidbounce.utils.PacketUtils.sendPacket
import net.ccbluex.liquidbounce.utils.PacketUtils.sendPackets
import net.ccbluex.liquidbounce.utils.extensions.canUse
import net.ccbluex.liquidbounce.utils.extensions.isSplashPotion
import net.ccbluex.liquidbounce.utils.inventory.InventoryUtils.serverUsing
import net.ccbluex.liquidbounce.value.BooleanValue
import net.ccbluex.liquidbounce.value.FloatValue
Expand Down Expand Up @@ -289,11 +296,11 @@ object NoSlow : Module("NoSlow", MOVEMENT, gameDetecting = false) {
private val isUsingItem get() = mc.thePlayer?.heldItem != null && (mc.thePlayer.isUsingItem || (mc.thePlayer.heldItem?.item is ItemSword && KillAura.blockStatus) || isUNCPBlocking())

val noSlowItem: NoSlowItem
get() = mc.thePlayer?.heldItem?.item?.run {
get() = mc.thePlayer?.heldItem?.run {
return@run when {
this is ItemSword && blocking -> SWORD
this is ItemBow && bows -> BOW
(this is ItemPotion || this is ItemFood || this is ItemBucketMilk) && consuming -> CONSUMABLE
item is ItemSword && blocking -> SWORD
item is ItemBow && bows -> BOW
(item is ItemPotion && !isSplashPotion || item is ItemFood || item is ItemBucketMilk) && consuming -> CONSUMABLE
else -> OTHER
}
} ?: OTHER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ object Drop : NoSlowMode("Drop") {
if (!mc.thePlayer.isUsingItem)
received = false

if (event.packet.isUse && mc.thePlayer.heldItem.item.canUse) {
if (event.packet.isUse && mc.thePlayer.heldItem.canUse) {
// fixme this should be after the packet is sent
sendPacket(C07PacketPlayerDigging(DROP_ITEM, ORIGIN, DOWN))
received = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object Grim2365 : NoSlowMode("Grim2.3.65") {
override fun onMotion(event: MotionEvent) {
if (event.eventState != PRE) return
for (i in 0..8) {
if (mc.thePlayer.inventory?.mainInventory?.get(i)?.item.canUse) continue
if (mc.thePlayer.inventory?.mainInventory?.get(i).canUse) continue

serverSlot = i
sendPacket(C08PacketPlayerBlockPlacement(mc.thePlayer.heldItem))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ val ItemStack.attackDamage

val ItemStack.isSplashPotion get() = item is ItemPotion && ItemPotion.isSplash(metadata)

val Item?.canUse get() = when (this) {
is ItemSword, is ItemPotion, is ItemBucketMilk -> true
val ItemStack?.canUse: Boolean get() = when (this?.item) {
is ItemSword, is ItemPotion, is ItemBucketMilk -> !isSplashPotion
is ItemBow -> mc.playerController.isInCreativeMode || mc.thePlayer.inventory.hasItem(arrow)
is ItemAppleGold -> mc.playerController.isNotCreative
is ItemFood -> mc.playerController.isNotCreative && mc.thePlayer.foodStats.foodLevel < 20
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ object InventoryUtils : MinecraftInstance(), Listenable {
CLICK_TIMER.reset()

// check if the item was used
if (packet.placedBlockDirection == 255 && packet.stack.item.canUse)
if (packet.placedBlockDirection == 255 && packet.stack.canUse)
_serverUsing = true
}

Expand Down

0 comments on commit d0ec6b3

Please sign in to comment.