Skip to content

Commit

Permalink
LEGACY: Converted Ignite & TeleportHit Modules to Kotlin (CCBlueX#2763)
Browse files Browse the repository at this point in the history
Soon I'll convert all modules to Kotlin.
  • Loading branch information
EclipsesDev committed Apr 11, 2024
1 parent 71f8cf4 commit 020c969
Show file tree
Hide file tree
Showing 5 changed files with 196 additions and 218 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@ object ModuleManager : Listenable {

// Register modules which need to be instanced (Java classes)
registerModules(
Ignite::class.java,
ItemTeleport::class.java,
Phase::class.java,
Teleport::class.java,
TeleportHit::class.java
Teleport::class.java
)

// Register modules which have already been instanced (Kotlin objects)
Expand Down Expand Up @@ -130,6 +128,7 @@ object ModuleManager : Listenable {
HighJump,
HitBox,
IceSpeed,
Ignite,
InventoryCleaner,
InventoryMove,
ItemESP,
Expand Down Expand Up @@ -197,6 +196,7 @@ object ModuleManager : Listenable {
StorageESP,
Strafe,
SuperKnockback,
TeleportHit,
TNTBlock,
TNTESP,
TNTTimer,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
/*
* LiquidBounce Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/CCBlueX/LiquidBounce/
*/
package net.ccbluex.liquidbounce.features.module.modules.combat

import net.ccbluex.liquidbounce.event.EventTarget
import net.ccbluex.liquidbounce.event.UpdateEvent
import net.ccbluex.liquidbounce.features.module.Module
import net.ccbluex.liquidbounce.features.module.ModuleCategory
import net.ccbluex.liquidbounce.utils.EntityUtils
import net.ccbluex.liquidbounce.utils.PacketUtils.sendPacket
import net.ccbluex.liquidbounce.utils.PacketUtils.sendPackets
import net.ccbluex.liquidbounce.utils.RotationUtils
import net.ccbluex.liquidbounce.utils.extensions.*
import net.ccbluex.liquidbounce.utils.inventory.InventoryUtils
import net.ccbluex.liquidbounce.utils.timing.MSTimer
import net.ccbluex.liquidbounce.value.BoolValue
import net.minecraft.block.BlockAir
import net.minecraft.init.Items
import net.minecraft.item.ItemBucket
import net.minecraft.network.play.client.C03PacketPlayer.C05PacketPlayerLook
import net.minecraft.network.play.client.C09PacketHeldItemChange
import net.minecraft.util.EnumFacing
import net.minecraft.util.MathHelper
import net.minecraft.util.Vec3
import kotlin.math.atan2
import kotlin.math.sqrt

object Ignite : Module("Ignite", ModuleCategory.COMBAT) {

private val lighter by BoolValue("Lighter", true)
private val lavaBucket by BoolValue("Lava", true)

private val msTimer = MSTimer()

@EventTarget
fun onUpdate(event: UpdateEvent) {
if (!msTimer.hasTimePassed(500))
return

val thePlayer = mc.thePlayer ?: return
val theWorld = mc.theWorld ?: return

val lighterInHotbar = if (lighter) InventoryUtils.findItem(36, 44, Items.flint_and_steel) else -1
val lavaInHotbar = if (lavaBucket) InventoryUtils.findItem(26, 44, Items.lava_bucket) else -1

if (lighterInHotbar == -1 && lavaInHotbar == -1)
return

val fireInHotbar = if (lighterInHotbar != -1) lighterInHotbar else lavaInHotbar

for (entity in theWorld.loadedEntityList) {
if (EntityUtils.isSelected(entity, true) && !entity.isBurning) {
val blockPos = entity.position

if (thePlayer.getDistanceSq(blockPos) >= 22.3 || !blockPos.isReplaceable() || blockPos.getBlock() !is BlockAir)
continue

RotationUtils.keepLength += 1

InventoryUtils.serverSlot = fireInHotbar!! - 36

val itemStack = thePlayer.inventoryContainer.getSlot(fireInHotbar).stack

if (itemStack.item is ItemBucket) {
val diffX = blockPos.x + 0.5 - thePlayer.posX
val diffY = blockPos.y + 0.5 - (thePlayer.entityBoundingBox.minY + thePlayer.eyeHeight)
val diffZ = blockPos.z + 0.5 - thePlayer.posZ
val sqrt = sqrt(diffX * diffX + diffZ * diffZ)
val yaw = (atan2(diffZ, diffX)).toDegreesF() - 90F
val pitch = -(atan2(diffY, sqrt)).toDegreesF()

sendPacket(C05PacketPlayerLook(
thePlayer.rotationYaw +
MathHelper.wrapAngleTo180_float(yaw - thePlayer.rotationYaw),
thePlayer.rotationPitch +
MathHelper.wrapAngleTo180_float(pitch - thePlayer.rotationPitch),
thePlayer.onGround)
)

thePlayer.sendUseItem(itemStack)
} else {
for (side in EnumFacing.values()) {
val neighbor = blockPos.offset(side)

if (!neighbor.canBeClicked())
continue

val diffX = neighbor.x + 0.5 - thePlayer.posX
val diffY = neighbor.y + 0.5 - (thePlayer.entityBoundingBox.minY + thePlayer.eyeHeight)
val diffZ = neighbor.z + 0.5 - thePlayer.posZ
val sqrt = sqrt(diffX * diffX + diffZ * diffZ)
val yaw = (atan2(diffZ, diffX)).toDegreesF() - 90F
val pitch = -(atan2(diffY, sqrt)).toDegreesF()

sendPacket(C05PacketPlayerLook(
thePlayer.rotationYaw +
MathHelper.wrapAngleTo180_float(yaw - thePlayer.rotationYaw),
thePlayer.rotationPitch +
MathHelper.wrapAngleTo180_float(pitch - thePlayer.rotationPitch),
thePlayer.onGround)
)

if (thePlayer.onPlayerRightClick(neighbor, side.opposite, Vec3(side.directionVec), itemStack)) {
thePlayer.swingItem()
break
}
}
}

sendPackets(
C09PacketHeldItemChange(thePlayer.inventory.currentItem),
C05PacketPlayerLook(
thePlayer.rotationYaw,
thePlayer.rotationPitch,
thePlayer.onGround
)
)

msTimer.reset()
break
}
}
}
}

This file was deleted.

Loading

0 comments on commit 020c969

Please sign in to comment.