Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 00:00:41 +01:00
Fix combat by sending the animate packet after damage (Closes #260)
Dieser Commit ist enthalten in:
Ursprung
03e11df58b
Commit
9b487d7d03
@ -33,6 +33,8 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerSwingArmPacket;
|
||||
import com.nukkitx.protocol.bedrock.packet.AnimatePacket;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Translator(packet = AnimatePacket.class)
|
||||
public class BedrockAnimateTranslator extends PacketTranslator<AnimatePacket> {
|
||||
|
||||
@ -40,8 +42,12 @@ public class BedrockAnimateTranslator extends PacketTranslator<AnimatePacket> {
|
||||
public void translate(AnimatePacket packet, GeyserSession session) {
|
||||
switch (packet.getAction()) {
|
||||
case SWING_ARM:
|
||||
ClientPlayerSwingArmPacket swingArmPacket = new ClientPlayerSwingArmPacket(Hand.MAIN_HAND);
|
||||
session.getDownstream().getSession().send(swingArmPacket);
|
||||
// Delay so entity damage can be processed first
|
||||
session.getConnector().getGeneralThreadPool().schedule(() ->
|
||||
session.getDownstream().getSession().send(new ClientPlayerSwingArmPacket(Hand.MAIN_HAND)),
|
||||
25,
|
||||
TimeUnit.MILLISECONDS
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,11 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
|
||||
break;
|
||||
case ITEM_RELEASE:
|
||||
if (packet.getActionType() == 0) {
|
||||
ClientPlayerActionPacket releaseItemPacket = new ClientPlayerActionPacket(PlayerAction.RELEASE_USE_ITEM, new Position(0, 0, 0), BlockFace.DOWN);
|
||||
ClientPlayerActionPacket releaseItemPacket = new ClientPlayerActionPacket(PlayerAction.RELEASE_USE_ITEM, new Position(
|
||||
packet.getBlockPosition().getX(),
|
||||
packet.getBlockPosition().getY(),
|
||||
packet.getBlockPosition().getZ()
|
||||
), BlockFace.values()[packet.getFace()]);
|
||||
session.getDownstream().getSession().send(releaseItemPacket);
|
||||
}
|
||||
break;
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren