3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 16:12:46 +01:00

Set SnifferEntity digTicks to 0 when transitioning out of DIGGING state

Dieser Commit ist enthalten in:
AJ Ferguson 2023-05-16 23:35:28 -04:00
Ursprung c35b7c93fd
Commit 701d9844aa

Datei anzeigen

@ -84,6 +84,10 @@ public class SnifferEntity extends AnimalEntity implements Tickable {
if (this.flags.contains(EntityFlag.DIGGING)) { if (this.flags.contains(EntityFlag.DIGGING)) {
digTicks = DIG_END; 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.setType(LevelEvent.PARTICLE_DESTROY_BLOCK_NO_SOUND);
levelEventPacket.setPosition(pos); levelEventPacket.setPosition(pos);
levelEventPacket.setData(blockId); levelEventPacket.setData(blockId);
session.getUpstream().sendPacket(levelEventPacket); session.sendUpstreamPacket(levelEventPacket);
if (digTicks % 10 == 0) { if (digTicks % 10 == 0) {
LevelSoundEventPacket levelSoundEventPacket = new LevelSoundEventPacket(); LevelSoundEventPacket levelSoundEventPacket = new LevelSoundEventPacket();