From 5e8a3d2ca94499e1ddfcdf841a1aecb9c371ab98 Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Mon, 9 Dec 2019 20:19:09 -0600 Subject: [PATCH] Add support for 1.15-pre6 Merely just a protocol change, nothing new has been implemented (such as bees) and won't be until bedrock 1.14 is released. --- connector/pom.xml | 2 +- .../connector/entity/living/AbstractHorseEntity.java | 1 - .../connector/entity/living/AgeableEntity.java | 11 +++++++++-- .../connector/entity/living/InsentientEntity.java | 2 +- .../entity/living/monster/GuardianEntity.java | 2 +- .../geysermc/connector/entity/type/EntityType.java | 2 +- 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/connector/pom.xml b/connector/pom.xml index b7a97863e..21d7a6cac 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -103,7 +103,7 @@ com.github.steveice10 mcprotocollib - 1.14.4-2-SNAPSHOT + 1.15-pre6-1-SNAPSHOT compile diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/AbstractHorseEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/AbstractHorseEntity.java index 7b71d0409..585c8cffe 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/AbstractHorseEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/AbstractHorseEntity.java @@ -27,7 +27,6 @@ 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.protocol.bedrock.data.EntityData; import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java index 926cfde38..d2d798546 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java @@ -26,6 +26,7 @@ package org.geysermc.connector.entity.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.EntityFlag; import org.geysermc.connector.entity.type.EntityType; @@ -39,8 +40,14 @@ public class AgeableEntity extends CreatureEntity { @Override public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 14) { - metadata.getFlags().setFlag(EntityFlag.BABY, (boolean) entityMetadata.getValue()); + if (entityMetadata.getId() == 15) { + // TODO: Figure out why this value sometimes returns an integer + // At the time of writing this, the value here sometimes returns as an int + // rather than a boolean for donkeys. The wiki.vg documentation is lacking at the + // time of writing this, but once this value is known, the bug will be fixed accordingly. + if (entityMetadata.getType() == MetadataType.BOOLEAN) { + metadata.getFlags().setFlag(EntityFlag.BABY, (boolean) entityMetadata.getValue()); + } } super.updateBedrockMetadata(entityMetadata, session); diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/InsentientEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/InsentientEntity.java index 121174312..c37041bf2 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/InsentientEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/InsentientEntity.java @@ -41,7 +41,7 @@ public class InsentientEntity extends LivingEntity { @Override public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 13 && entityMetadata.getType() == MetadataType.BYTE) { + if (entityMetadata.getId() == 14 && entityMetadata.getType() == MetadataType.BYTE) { byte xd = (byte) entityMetadata.getValue(); metadata.getFlags().setFlag(EntityFlag.NO_AI, (xd & 0x01) == 0x01); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/GuardianEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/GuardianEntity.java index af6a18327..3ca7eb8eb 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/GuardianEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/GuardianEntity.java @@ -41,7 +41,7 @@ public class GuardianEntity extends MonsterEntity { @Override public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 15) { + if (entityMetadata.getId() == 16) { Entity entity = session.getEntityCache().getEntityByJavaId((int) entityMetadata.getValue()); if (entity != null) { metadata.put(EntityData.TARGET_EID, entity.getGeyserId()); diff --git a/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java b/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java index 73c484104..b39d617a6 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java +++ b/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java @@ -47,7 +47,7 @@ public enum EntityType { BAT(AmbientEntity.class, 19, 0.9f, 0.5f), IRON_GOLEM(GolemEntity.class, 20, 2.7f, 1.4f), SNOW_GOLEM(GolemEntity.class, 21, 1.9f, 0.7f), - OCELOT(TameableEntity.class, 22, 0.35f, 0.3f), + OCELOT(AgeableEntity.class, 22, 0.35f, 0.3f), HORSE(HorseEntity.class, 23, 1.6f, 1.3965f), DONKEY(ChestedHorseEntity.class, 24, 1.6f, 1.3965f), MULE(ChestedHorseEntity.class, 25, 1.6f, 1.3965f),