mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Send cooldown when punching air (#4257)
This commit is contained in:
parent
644082ae84
commit
ec526a798d
1 changed files with 5 additions and 0 deletions
|
@ -55,6 +55,7 @@ import org.geysermc.geyser.translator.inventory.item.CustomItemTranslator;
|
||||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||||
import org.geysermc.geyser.translator.protocol.Translator;
|
import org.geysermc.geyser.translator.protocol.Translator;
|
||||||
import org.geysermc.geyser.util.BlockUtils;
|
import org.geysermc.geyser.util.BlockUtils;
|
||||||
|
import org.geysermc.geyser.util.CooldownUtils;
|
||||||
|
|
||||||
@Translator(packet = PlayerActionPacket.class)
|
@Translator(packet = PlayerActionPacket.class)
|
||||||
public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket> {
|
public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket> {
|
||||||
|
@ -281,6 +282,10 @@ public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket
|
||||||
entity.setOnGround(false); // Increase block break time while jumping
|
entity.setOnGround(false); // Increase block break time while jumping
|
||||||
break;
|
break;
|
||||||
case MISSED_SWING:
|
case MISSED_SWING:
|
||||||
|
// Java edition sends a cooldown when hitting air.
|
||||||
|
// Normally handled by BedrockLevelSoundEventTranslator, but there is no sound on Java for this.
|
||||||
|
CooldownUtils.sendCooldown(session);
|
||||||
|
|
||||||
// TODO Re-evaluate after pre-1.20.10 is no longer supported?
|
// TODO Re-evaluate after pre-1.20.10 is no longer supported?
|
||||||
if (session.getArmAnimationTicks() == -1) {
|
if (session.getArmAnimationTicks() == -1) {
|
||||||
session.sendDownstreamGamePacket(new ServerboundSwingPacket(Hand.MAIN_HAND));
|
session.sendDownstreamGamePacket(new ServerboundSwingPacket(Hand.MAIN_HAND));
|
||||||
|
|
Loading…
Reference in a new issue