Skip to content

Commit cc54854

Browse files
committed
Fix nametag custom ContentTypes
1 parent 964470e commit cc54854

File tree

15 files changed

+85
-87
lines changed

15 files changed

+85
-87
lines changed

src/main/kotlin/com/lambda/client/manager/managers/MessageManager.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package com.lambda.client.manager.managers
22

33
import com.lambda.client.event.events.PacketEvent
44
import com.lambda.client.manager.Manager
5-
import com.lambda.client.mixin.extension.packetMessage
5+
import com.lambda.client.mixin.extension.chatMessage
66
import com.lambda.client.module.AbstractModule
77
import com.lambda.client.module.modules.client.ChatSetting
88
import com.lambda.client.util.TaskState
@@ -124,7 +124,7 @@ object MessageManager : Manager {
124124
* @return true if [queuedMessage] have been modified
125125
*/
126126
fun apply(queuedMessage: QueuedMessage) = filter(queuedMessage).also {
127-
if (it) queuedMessage.packet.packetMessage = modifier(queuedMessage)
127+
if (it) queuedMessage.packet.chatMessage = modifier(queuedMessage)
128128
}
129129

130130
override fun compareTo(other: MessageModifier): Int {

src/main/kotlin/com/lambda/client/manager/managers/PlayerPacketManager.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ object PlayerPacketManager : Manager {
4040
listener<PacketEvent.PostSend>(-6969) {
4141
if (it.cancelled || it.packet !is CPacketPlayer) return@listener
4242

43-
if (it.packet.moving) {
44-
serverSidePosition = Vec3d(it.packet.x, it.packet.y, it.packet.z)
43+
if (it.packet.playerMoving) {
44+
serverSidePosition = Vec3d(it.packet.playerX, it.packet.playerY, it.packet.playerZ)
4545
}
4646

47-
if (it.packet.rotating) {
48-
serverSideRotation = Vec2f(it.packet.yaw, it.packet.pitch)
49-
Wrapper.player?.let { player -> player.rotationYawHead = it.packet.yaw }
47+
if (it.packet.playerRotating) {
48+
serverSideRotation = Vec2f(it.packet.playerYaw, it.packet.playerPitch)
49+
Wrapper.player?.let { player -> player.rotationYawHead = it.packet.playerYaw }
5050
}
5151
}
5252

src/main/kotlin/com/lambda/client/mixin/extension/Network.kt

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
package com.lambda.client.mixin.extension
22

33
import com.lambda.client.mixin.client.accessor.network.*
4-
import net.minecraft.network.play.client.CPacketChatMessage
5-
import net.minecraft.network.play.client.CPacketCloseWindow
6-
import net.minecraft.network.play.client.CPacketPlayer
7-
import net.minecraft.network.play.client.CPacketUseEntity
4+
import net.minecraft.network.play.client.*
85
import net.minecraft.network.play.server.SPacketChat
96
import net.minecraft.network.play.server.SPacketEntityVelocity
107
import net.minecraft.network.play.server.SPacketExplosion
118
import net.minecraft.network.play.server.SPacketPlayerPosLook
129
import net.minecraft.util.text.ITextComponent
1310

14-
var CPacketChatMessage.packetMessage: String
11+
var CPacketChatMessage.chatMessage: String
1512
get() = this.message
1613
set(value) {
1714
(this as AccessorCPacketChatMessage).setMessage(value)
@@ -21,46 +18,46 @@ val CPacketCloseWindow.windowID: Int
2118
get() = (this as AccessorCPacketCloseWindow).kbGetWindowID()
2219

2320

24-
var CPacketPlayer.x: Double
21+
var CPacketPlayer.playerX: Double
2522
get() = this.getX(0.0)
2623
set(value) {
2724
(this as AccessorCPacketPlayer).setX(value)
2825
}
29-
var CPacketPlayer.y: Double
26+
var CPacketPlayer.playerY: Double
3027
get() = this.getY(0.0)
3128
set(value) {
3229
(this as AccessorCPacketPlayer).setY(value)
3330
}
34-
var CPacketPlayer.z: Double
31+
var CPacketPlayer.playerZ: Double
3532
get() = this.getZ(0.0)
3633
set(value) {
3734
(this as AccessorCPacketPlayer).setZ(value)
3835
}
39-
var CPacketPlayer.yaw: Float
36+
var CPacketPlayer.playerYaw: Float
4037
get() = this.getYaw(0.0f)
4138
set(value) {
4239
(this as AccessorCPacketPlayer).setYaw(value)
4340
}
44-
var CPacketPlayer.pitch: Float
41+
var CPacketPlayer.playerPitch: Float
4542
get() = this.getPitch(0.0f)
4643
set(value) {
4744
(this as AccessorCPacketPlayer).setPitch(value)
4845
}
49-
var CPacketPlayer.onGround: Boolean
46+
var CPacketPlayer.playerIsOnGround: Boolean
5047
get() = this.isOnGround
5148
set(value) {
5249
(this as AccessorCPacketPlayer).setOnGround(value)
5350
}
54-
val CPacketPlayer.moving: Boolean get() = (this as AccessorCPacketPlayer).moving
55-
val CPacketPlayer.rotating: Boolean get() = (this as AccessorCPacketPlayer).rotating
51+
val CPacketPlayer.playerMoving: Boolean get() = (this as AccessorCPacketPlayer).moving
52+
val CPacketPlayer.playerRotating: Boolean get() = (this as AccessorCPacketPlayer).rotating
5653

57-
var CPacketUseEntity.id: Int
54+
var CPacketUseEntity.useEntityId: Int
5855
get() = (this as AccessorCPacketUseEntity).id
5956
set(value) {
6057
(this as AccessorCPacketUseEntity).id = value
6158
}
6259

63-
var CPacketUseEntity.packetAction: CPacketUseEntity.Action
60+
var CPacketUseEntity.useEntityAction: CPacketUseEntity.Action
6461
get() = this.action
6562
set(value) {
6663
(this as AccessorCPacketUseEntity).setAction(value)
@@ -72,44 +69,44 @@ var SPacketChat.textComponent: ITextComponent
7269
(this as AccessorSPacketChat).setChatComponent(value)
7370
}
7471

75-
var SPacketEntityVelocity.packetMotionX: Int
72+
var SPacketEntityVelocity.entityVelocityMotionX: Int
7673
get() = this.motionX
7774
set(value) {
7875
(this as AccessorSPacketEntityVelocity).setMotionX(value)
7976
}
80-
var SPacketEntityVelocity.packetMotionY: Int
77+
var SPacketEntityVelocity.entityVelocityMotionY: Int
8178
get() = this.motionY
8279
set(value) {
8380
(this as AccessorSPacketEntityVelocity).setMotionY(value)
8481
}
85-
var SPacketEntityVelocity.packetMotionZ: Int
82+
var SPacketEntityVelocity.entityVelocityMotionZ: Int
8683
get() = this.motionZ
8784
set(value) {
8885
(this as AccessorSPacketEntityVelocity).setMotionZ(value)
8986
}
9087

91-
var SPacketExplosion.packetMotionX: Float
88+
var SPacketExplosion.explosionMotionX: Float
9289
get() = this.motionX
9390
set(value) {
9491
(this as AccessorSPacketExplosion).setMotionX(value)
9592
}
96-
var SPacketExplosion.packetMotionY: Float
93+
var SPacketExplosion.explosionMotionY: Float
9794
get() = this.motionY
9895
set(value) {
9996
(this as AccessorSPacketExplosion).setMotionY(value)
10097
}
101-
var SPacketExplosion.packetMotionZ: Float
98+
var SPacketExplosion.explosionMotionZ: Float
10299
get() = this.motionZ
103100
set(value) {
104101
(this as AccessorSPacketExplosion).setMotionZ(value)
105102
}
106103

107-
var SPacketPlayerPosLook.rotationYaw: Float
104+
var SPacketPlayerPosLook.playerPosLookYaw: Float
108105
get() = this.yaw
109106
set(value) {
110107
(this as AccessorSPacketPosLook).setYaw(value)
111108
}
112-
var SPacketPlayerPosLook.rotationPitch: Float
109+
var SPacketPlayerPosLook.playerPosLookPitch: Float
113110
get() = this.pitch
114111
set(value) {
115112
(this as AccessorSPacketPosLook).setPitch(value)

src/main/kotlin/com/lambda/client/module/modules/combat/CrystalAura.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import com.lambda.client.manager.managers.HotbarManager.serverSideItem
1212
import com.lambda.client.manager.managers.HotbarManager.spoofHotbar
1313
import com.lambda.client.manager.managers.PlayerPacketManager
1414
import com.lambda.client.manager.managers.PlayerPacketManager.sendPlayerPacket
15-
import com.lambda.client.mixin.extension.id
16-
import com.lambda.client.mixin.extension.packetAction
15+
import com.lambda.client.mixin.extension.useEntityId
16+
import com.lambda.client.mixin.extension.useEntityAction
1717
import com.lambda.client.module.Category
1818
import com.lambda.client.module.Module
1919
import com.lambda.client.util.Bind
@@ -368,8 +368,8 @@ object CrystalAura : Module(
368368
if (calculation.distance > explodeRange) return
369369

370370
val attackPacket = CPacketUseEntity().apply {
371-
id = entityID
372-
packetAction = CPacketUseEntity.Action.ATTACK
371+
useEntityId = entityID
372+
useEntityAction = CPacketUseEntity.Action.ATTACK
373373
}
374374

375375
synchronized(packetList) {

src/main/kotlin/com/lambda/client/module/modules/movement/AntiHunger.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.lambda.client.module.modules.movement
22

33
import com.lambda.client.event.events.PacketEvent
4-
import com.lambda.client.mixin.extension.onGround
4+
import com.lambda.client.mixin.extension.playerIsOnGround
55
import com.lambda.client.module.Category
66
import com.lambda.client.module.Module
77
import com.lambda.client.util.threads.safeListener
@@ -30,7 +30,7 @@ object AntiHunger : Module(
3030
}
3131
}
3232
is CPacketPlayer -> {
33-
it.packet.onGround = (player.fallDistance <= 0 || mc.playerController.isHittingBlock) && player.isElytraFlying
33+
it.packet.playerIsOnGround = (player.fallDistance <= 0 || mc.playerController.isHittingBlock) && player.isElytraFlying
3434
}
3535
}
3636
}

src/main/kotlin/com/lambda/client/module/modules/movement/BoatFly.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package com.lambda.client.module.modules.movement
22

33
import com.lambda.client.event.events.PacketEvent
44
import com.lambda.client.event.events.PlayerTravelEvent
5-
import com.lambda.client.mixin.extension.rotationPitch
6-
import com.lambda.client.mixin.extension.rotationYaw
5+
import com.lambda.client.mixin.extension.playerPosLookPitch
6+
import com.lambda.client.mixin.extension.playerPosLookYaw
77
import com.lambda.client.module.Category
88
import com.lambda.client.module.Module
99
import com.lambda.client.util.EntityUtils.steerEntity
@@ -89,8 +89,8 @@ object BoatFly : Module(
8989
}
9090
is SPacketPlayerPosLook -> {
9191
if (antiForceLook) {
92-
it.packet.rotationYaw = player.rotationYaw
93-
it.packet.rotationPitch = player.rotationPitch
92+
it.packet.playerPosLookYaw = player.rotationYaw
93+
it.packet.playerPosLookPitch = player.rotationPitch
9494
}
9595
}
9696
is SPacketEntityTeleport -> {

src/main/kotlin/com/lambda/client/module/modules/movement/ElytraFlight.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import com.lambda.client.event.SafeClientEvent
44
import com.lambda.client.event.events.PacketEvent
55
import com.lambda.client.event.events.PlayerTravelEvent
66
import com.lambda.client.manager.managers.PlayerPacketManager.sendPlayerPacket
7-
import com.lambda.client.mixin.extension.rotationPitch
7+
import com.lambda.client.mixin.extension.playerPosLookPitch
88
import com.lambda.client.mixin.extension.tickLength
99
import com.lambda.client.mixin.extension.timer
1010
import com.lambda.client.module.Category
@@ -123,7 +123,7 @@ object ElytraFlight : Module(
123123
if (player.isSpectator || !elytraIsEquipped || elytraDurability <= 1 || !isFlying || mode.value == ElytraFlightMode.BOOST) return@safeListener
124124
if (it.packet is SPacketPlayerPosLook && mode.value != ElytraFlightMode.PACKET) {
125125
val packet = it.packet
126-
packet.rotationPitch = player.rotationPitch
126+
packet.playerPosLookPitch = player.rotationPitch
127127
}
128128

129129
/* Cancels the elytra opening animation */

src/main/kotlin/com/lambda/client/module/modules/movement/Jesus.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package com.lambda.client.module.modules.movement
22

33
import com.lambda.client.event.events.PacketEvent
44
import com.lambda.client.event.events.PlayerTravelEvent
5-
import com.lambda.client.mixin.extension.moving
6-
import com.lambda.client.mixin.extension.y
5+
import com.lambda.client.mixin.extension.playerMoving
6+
import com.lambda.client.mixin.extension.playerY
77
import com.lambda.client.module.Category
88
import com.lambda.client.module.Module
99
import com.lambda.client.util.BaritoneUtils
@@ -52,13 +52,13 @@ object Jesus : Module(
5252
}
5353

5454
safeListener<PacketEvent.Send> {
55-
if (it.packet !is CPacketPlayer || !it.packet.moving) return@safeListener
55+
if (it.packet !is CPacketPlayer || !it.packet.playerMoving) return@safeListener
5656
if (mc.gameSettings.keyBindSneak.isKeyDown || player.ticksExisted % 2 != 0) return@safeListener
5757

5858
val entity = player.ridingEntity ?: player
5959

6060
if (EntityUtils.isAboveLiquid(entity, true) && !isInWater(entity)) {
61-
it.packet.y += 0.02
61+
it.packet.playerY += 0.02
6262
}
6363
}
6464
}

src/main/kotlin/com/lambda/client/module/modules/movement/Step.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package com.lambda.client.module.modules.movement
33
import com.lambda.client.event.SafeClientEvent
44
import com.lambda.client.event.events.PacketEvent
55
import com.lambda.client.manager.managers.PlayerPacketManager
6-
import com.lambda.client.mixin.extension.y
6+
import com.lambda.client.mixin.extension.playerY
77
import com.lambda.client.module.Category
88
import com.lambda.client.module.Module
99
import com.lambda.client.setting.settings.impl.primitive.BooleanSetting
@@ -118,7 +118,7 @@ object Step : Module(
118118
if (ignoredPackets.remove(event.packet)) return@safeListener
119119

120120
val prevPos = PlayerPacketManager.prevServerSidePosition
121-
if (player.ticksExisted - lastCollidedTick <= 5) getStepArray(event.packet.y - prevPos.y)?.let {
121+
if (player.ticksExisted - lastCollidedTick <= 5) getStepArray(event.packet.playerY - prevPos.y)?.let {
122122
for (posY in it) {
123123
val packet = CPacketPlayer.Position(prevPos.x, prevPos.y + posY, prevPos.z, true)
124124
ignoredPackets.add(packet)

src/main/kotlin/com/lambda/client/module/modules/movement/Velocity.kt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ package com.lambda.client.module.modules.movement
33
import com.lambda.client.event.events.PacketEvent
44
import com.lambda.client.mixin.client.entity.MixinEntity
55
import com.lambda.client.mixin.client.world.MixinBlockLiquid
6-
import com.lambda.client.mixin.extension.packetMotionX
7-
import com.lambda.client.mixin.extension.packetMotionY
8-
import com.lambda.client.mixin.extension.packetMotionZ
6+
import com.lambda.client.mixin.extension.*
97
import com.lambda.client.module.Category
108
import com.lambda.client.module.Module
119
import com.lambda.client.util.threads.safeListener
@@ -42,19 +40,19 @@ object Velocity : Module(
4240
if (isZero) {
4341
it.cancel()
4442
} else {
45-
packetMotionX = (packetMotionX * horizontal).toInt()
46-
packetMotionY = (packetMotionY * vertical).toInt()
47-
packetMotionZ = (packetMotionZ * horizontal).toInt()
43+
entityVelocityMotionX = (entityVelocityMotionX * horizontal).toInt()
44+
entityVelocityMotionY = (entityVelocityMotionY * vertical).toInt()
45+
entityVelocityMotionZ = (entityVelocityMotionZ * horizontal).toInt()
4846
}
4947
}
5048
} else if (it.packet is SPacketExplosion) {
5149
with(it.packet) {
5250
if (isZero) {
5351
it.cancel()
5452
} else {
55-
packetMotionX *= horizontal
56-
packetMotionY *= vertical
57-
packetMotionZ *= horizontal
53+
explosionMotionX *= horizontal
54+
explosionMotionY *= vertical
55+
explosionMotionZ *= horizontal
5856
}
5957
}
6058
}

0 commit comments

Comments
 (0)