Add rabbit jumping animation (#1027)

* Add rabbit jumping animation

This isn't perfect as Bedrock uses a duration and Java just sends the jumping animation. There may be something else missing from the puzzle piece.

* Remove debug line
This commit is contained in:
Camotoy 2020-07-30 16:12:09 -04:00 committed by GitHub
parent 784cb73301
commit 9097f8547b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 6 deletions

View file

@ -25,7 +25,6 @@
package org.geysermc.connector.entity.living; package org.geysermc.connector.entity.living;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
@ -37,11 +36,6 @@ public class MagmaCubeEntity extends SlimeEntity {
super(entityId, geyserId, entityType, position, motion, rotation); super(entityId, geyserId, entityType, position, motion, rotation);
} }
@Override
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
super.updateBedrockMetadata(entityMetadata, session);
}
@Override @Override
public void moveRelative(GeyserSession session, double relX, double relY, double relZ, Vector3f rotation, boolean isOnGround) { public void moveRelative(GeyserSession session, double relX, double relY, double relZ, Vector3f rotation, boolean isOnGround) {
updateJump(session, isOnGround); updateJump(session, isOnGround);

View file

@ -26,8 +26,10 @@
package org.geysermc.connector.network.translators.java.entity; package org.geysermc.connector.network.translators.java.entity;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityStatusPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityStatusPacket;
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityEventType;
import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket;
import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket;
import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
@ -102,6 +104,17 @@ public class JavaEntityStatusTranslator extends PacketTranslator<ServerEntitySta
case IRON_GOLEM_EMPTY_HAND: case IRON_GOLEM_EMPTY_HAND:
entityEventPacket.setType(EntityEventType.GOLEM_FLOWER_WITHDRAW); entityEventPacket.setType(EntityEventType.GOLEM_FLOWER_WITHDRAW);
break; break;
case RABBIT_JUMP_OR_MINECART_SPAWNER_DELAY_RESET:
if (entity.getEntityType() == EntityType.RABBIT) {
// This doesn't match vanilla Bedrock behavior but I'm unsure how to make it better
// I assume part of the problem is that Bedrock uses a duration and Java just says the rabbit is jumping
SetEntityDataPacket dataPacket = new SetEntityDataPacket();
dataPacket.getMetadata().put(EntityData.JUMP_DURATION, (byte) 3);
dataPacket.setRuntimeEntityId(entity.getGeyserId());
session.sendUpstreamPacket(dataPacket);
return;
}
break;
} }
session.sendUpstreamPacket(entityEventPacket); session.sendUpstreamPacket(entityEventPacket);