Skip to content

Commit

Permalink
fix(ArmorPiece, DisablerVanillaSpeed, SpecialItemExtension, Submodule…
Browse files Browse the repository at this point in the history
…IdPredict): errors
  • Loading branch information
DataM0del committed Feb 7, 2025
1 parent 8e4d5d8 commit 3d8fa31
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import net.minecraft.entity.decoration.EndCrystalEntity
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket
import net.minecraft.network.packet.s2c.play.EntitySpawnS2CPacket
import net.minecraft.network.packet.s2c.play.ExperienceOrbSpawnS2CPacket
import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket
import net.minecraft.util.Hand
import net.minecraft.util.math.BlockPos
Expand Down Expand Up @@ -166,7 +165,9 @@ object SubmoduleIdPredict : ToggleableConfigurable(ModuleCrystalAura, "IDPredict
@Suppress("unused")
private val entitySpawnHandler = handler<PacketEvent> {
when(val packet = it.packet) {
is ExperienceOrbSpawnS2CPacket -> highestId = max(packet.entityId, highestId)
// TODO: did they remove `ExperienceOrbSpawnS2CPacket` and use `EntitySpawnS2CPacket`
// for XP orb spawning instead?
// is ExperienceOrbSpawnS2CPacket -> highestId = max(packet.entityId, highestId)
is EntitySpawnS2CPacket -> highestId = max(packet.entityId, highestId)
is GameJoinS2CPacket -> highestId = max(packet.playerEntityId, highestId)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ internal object DisablerVanillaSpeed : ToggleableConfigurable(ModuleDisabler, "V
return@handler
}

// TODO: wtf was lastBaseY?
val distance = MathHelper.magnitude(
player.x - player.lastX,
player.y - player.lastBaseY,
player.y - player.lastY,
player.z - player.lastZ
)

Expand All @@ -55,7 +56,7 @@ internal object DisablerVanillaSpeed : ToggleableConfigurable(ModuleDisabler, "V
repeat(packets) {
network.sendPacket(packetType.generatePacket().apply {
this.x = player.lastX
this.y = player.lastBaseY
this.y = player.lastY
this.z = player.lastZ
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ package net.ccbluex.liquidbounce.utils.item
import net.ccbluex.liquidbounce.utils.inventory.ItemSlot
import net.ccbluex.liquidbounce.features.module.modules.player.invcleaner.ItemSlotType
import net.minecraft.entity.EquipmentSlot
import net.minecraft.item.ArmorItem

class ArmorPiece(val itemSlot: ItemSlot) {
val slotType: EquipmentSlot
get() = (itemSlot.itemStack.item as ArmorItem).type().equipmentSlot
get() = itemSlot.itemStack.item.type().equipmentSlot
val entitySlotId: Int
get() = this.slotType.entitySlotId
val inventorySlot: Int
Expand All @@ -36,10 +35,10 @@ class ArmorPiece(val itemSlot: ItemSlot) {
get() = itemSlot.slotType == ItemSlotType.HOTBAR

val toughness: Float
get() = (itemSlot.itemStack.item as ArmorItem).material().toughness
get() = itemSlot.itemStack.item.material().toughness
val defensePoints: Float
get() {
val item = itemSlot.itemStack.item as ArmorItem
val item = itemSlot.itemStack.item

return item.material().defense.getOrDefault(item.type(), 0).toFloat()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@
*/
package net.ccbluex.liquidbounce.utils.item

import net.ccbluex.liquidbounce.interfaces.ArmorItemAdditions
import net.ccbluex.liquidbounce.interfaces.MiningToolItemAddition
import net.minecraft.item.ArmorItem
import net.minecraft.item.MiningToolItem
import net.minecraft.item.ToolMaterial
import net.minecraft.item.equipment.ArmorMaterial
import net.minecraft.item.equipment.EquipmentType
//import net.ccbluex.liquidbounce.interfaces.ArmorItemAdditions
//import net.ccbluex.liquidbounce.interfaces.MiningToolItemAddition
//import net.minecraft.item.ArmorItem
//import net.minecraft.item.MiningToolItem
//import net.minecraft.item.ToolMaterial
//import net.minecraft.item.equipment.ArmorMaterial
//import net.minecraft.item.equipment.EquipmentType

fun ArmorItem.material(): ArmorMaterial = (this as ArmorItemAdditions).`liquid_bounce$getMaterial`()

fun MiningToolItem.material(): ToolMaterial = (this as MiningToolItemAddition).`liquid_bounce$getMaterial`()

fun ArmorItem.type(): EquipmentType = (this as ArmorItemAdditions).`liquid_bounce$getType`()
// TODO: fix these
//fun ArmorItem.material(): ArmorMaterial = (this as ArmorItemAdditions).`liquid_bounce$getMaterial`()
//
//fun MiningToolItem.material(): ToolMaterial = (this as MiningToolItemAddition).`liquid_bounce$getMaterial`()
//
//fun ArmorItem.type(): EquipmentType = (this as ArmorItemAdditions).`liquid_bounce$getType`()

0 comments on commit 3d8fa31

Please sign in to comment.