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

Ignore invalid animations in ClientboundAnimatePacket (#4025)

Dieser Commit ist enthalten in:
Konicai 2023-07-31 16:56:28 -04:00 committet von GitHub
Ursprung 7725651726
Commit d89b55e9ac
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -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;
}