forked from CCBlueX/LiquidBounce
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LEGACY: Converted Ignite & TeleportHit Modules to Kotlin (CCBlueX#2763)
Soon I'll convert all modules to Kotlin.
- Loading branch information
1 parent
71f8cf4
commit 020c969
Showing
5 changed files
with
196 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
143 changes: 0 additions & 143 deletions
143
src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/Ignite.java
This file was deleted.
Oops, something went wrong.
127 changes: 127 additions & 0 deletions
127
src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/Ignite.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} | ||
} |
72 changes: 0 additions & 72 deletions
72
src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/TeleportHit.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.