mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-12-23 06:50:26 +01:00
Ignore invalid animations in ClientboundAnimatePacket (#4025)
This commit is contained in:
parent
7725651726
commit
d89b55e9ac
1 changed files with 9 additions and 3 deletions
|
@ -25,6 +25,7 @@
|
|||
|
||||
package org.geysermc.geyser.translator.protocol.java.entity;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.Animation;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundAnimatePacket;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.AnimateEntityPacket;
|
||||
|
@ -44,12 +45,17 @@ public class JavaAnimateTranslator extends PacketTranslator<ClientboundAnimatePa
|
|||
@Override
|
||||
public void translate(GeyserSession session, ClientboundAnimatePacket packet) {
|
||||
Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());
|
||||
if (entity == null)
|
||||
if (entity == null) {
|
||||
return;
|
||||
}
|
||||
Animation animation = packet.getAnimation();
|
||||
if (animation == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
AnimatePacket animatePacket = new AnimatePacket();
|
||||
animatePacket.setRuntimeEntityId(entity.getGeyserId());
|
||||
switch (packet.getAnimation()) {
|
||||
switch (animation) {
|
||||
case SWING_ARM:
|
||||
animatePacket.setAction(AnimatePacket.Action.SWING_ARM);
|
||||
if (entity.getEntityId() == session.getPlayerEntity().getEntityId()) {
|
||||
|
@ -86,7 +92,7 @@ public class JavaAnimateTranslator extends PacketTranslator<ClientboundAnimatePa
|
|||
animatePacket.setAction(AnimatePacket.Action.WAKE_UP);
|
||||
break;
|
||||
default:
|
||||
// Unknown Animation
|
||||
session.getGeyser().getLogger().debug("Unhandled java animation: " + animation);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue