Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-20 06:50:09 +01:00
Ignore invalid animations in ClientboundAnimatePacket (#4025)
Dieser Commit ist enthalten in:
Ursprung
7725651726
Commit
d89b55e9ac
@ -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;
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren