Skip to content

Commit

Permalink
Another 1.21.2 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SamB440 committed Dec 7, 2024
1 parent 7d30183 commit 912939a
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,15 @@ public void onPacketSend(final PacketSendEvent event) {
WrapperPlayServerExplosion explosion = new WrapperPlayServerExplosion(event);

// Since 1.21.2, the server will instead send these changes via block change packets
if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_21_2)) {
final boolean hasBlocks = PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_21_2);
if (hasBlocks) {
this.handleBlockExplosions(explosion);
}

Vector3d velocity = explosion.getKnockback();
if (velocity != null && (velocity.x != 0 || velocity.y != 0 || velocity.z != 0)) {
// No need to spam transactions
if (explosion.getRecords().isEmpty()) player.sendTransaction();
if (!hasBlocks || explosion.getRecords().isEmpty()) player.sendTransaction();
addPlayerExplosion(player.lastTransactionSent.get(), velocity);
event.getTasksAfterSend().add(player::sendTransaction);
}
Expand Down

0 comments on commit 912939a

Please sign in to comment.