From 701d9844aac52930c399a5eaba6ac18e0b90ba30 Mon Sep 17 00:00:00 2001 From: AJ Ferguson Date: Tue, 16 May 2023 23:35:28 -0400 Subject: [PATCH] Set SnifferEntity digTicks to 0 when transitioning out of DIGGING state --- .../geyser/entity/type/living/animal/SnifferEntity.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SnifferEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SnifferEntity.java index cb1995f0c..24a9ec876 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SnifferEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SnifferEntity.java @@ -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();