Skip to content

Commit

Permalink
fix: NullPointerException for calls related to S1CPacketEntityMetadata (
Browse files Browse the repository at this point in the history
  • Loading branch information
TakoTheDev authored Oct 2, 2024
1 parent fc0beae commit f7dc9fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ object AlignmentTaskSolver {
val pos = entity.hangingPosition
val pending = pendingClicks[pos]
if (pending != null) {
val newRot = (event.packet.func_149376_c().find { it.dataValueId == 9 && it.objectType == 0 }?.`object` as? Byte ?: return).toInt()
val newRot = (event.packet.func_149376_c()?.find { it.dataValueId == 9 && it.objectType == 0 }?.`object` as? Byte ?: return).toInt()
val currentRot = entity.rotation
val delta = getTurnsNeeded(currentRot, newRot)
val newPending = pending - delta
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ object SlayerFeatures : CoroutineScope {
if (packet is S1CPacketEntityMetadata) {
(slayer as? SeraphSlayer)?.run {
if (packet.entityId == entity.entityId) {
if (entity.heldBlockState?.block == Blocks.beacon && ((packet.func_149376_c()
.find { it.dataValueId == 16 } ?: return).`object` as Short).toInt().and(65535)
if (entity.heldBlockState?.block == Blocks.beacon && ((packet.func_149376_c()?.find { it.dataValueId == 16 } ?: return)
.`object` as Short).toInt().and(65535)
.and(4095) == 0
) {
lastYangGlyphSwitch = System.currentTimeMillis()
Expand All @@ -324,7 +324,7 @@ object SlayerFeatures : CoroutineScope {
}
}
if (Skytils.config.totemPing != 0 && packet.entityId == (slayer as? DemonlordSlayer)?.totemEntity?.entityId) {
((packet.func_149376_c().find { it.dataValueId == 2 } ?: return).`object` as String).let { name ->
((packet.func_149376_c()?.find { it.dataValueId == 2 } ?: return).`object` as String).let { name ->
printDevMessage("totem name updating: $name", "totem")
totemRegex.matchEntire(name)?.run {
printDevMessage("time ${groups["time"]}", "totem")
Expand All @@ -333,7 +333,7 @@ object SlayerFeatures : CoroutineScope {
}
}
} else if (packet.entityId == (slayer as? DemonlordSlayer)?.entity?.entityId &&
(((packet.func_149376_c().find { it.dataValueId == 0 }
(((packet.func_149376_c()?.find { it.dataValueId == 0 }
?: return).`object` as Byte).toInt() and 0x20) == 0 &&
slayer?.entity?.isInvisible == true
) {
Expand Down

0 comments on commit f7dc9fe

Please sign in to comment.