Set SnifferEntity digTicks to 0 when transitioning out of DIGGING state

This commit is contained in:
AJ Ferguson 2023-05-16 23:35:28 -04:00
parent c35b7c93fd
commit 701d9844aa
1 changed files with 5 additions and 1 deletions

View File

@ -84,6 +84,10 @@ public class SnifferEntity extends AnimalEntity implements Tickable {
if (this.flags.contains(EntityFlag.DIGGING)) {
digTicks = DIG_END;
} else {
// Handles situations where the DIGGING state is exited earlier than expected,
// such as hitting the sniffer or joining the game while it is digging
digTicks = 0;
}
}
@ -99,7 +103,7 @@ public class SnifferEntity extends AnimalEntity implements Tickable {
levelEventPacket.setType(LevelEvent.PARTICLE_DESTROY_BLOCK_NO_SOUND);
levelEventPacket.setPosition(pos);
levelEventPacket.setData(blockId);
session.getUpstream().sendPacket(levelEventPacket);
session.sendUpstreamPacket(levelEventPacket);
if (digTicks % 10 == 0) {
LevelSoundEventPacket levelSoundEventPacket = new LevelSoundEventPacket();