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.
This commit is contained in:
RednedEpic 2019-12-09 20:19:09 -06:00
parent 374436172a
commit 5e8a3d2ca9
6 changed files with 13 additions and 7 deletions

View file

@ -103,7 +103,7 @@
<dependency>
<groupId>com.github.steveice10</groupId>
<artifactId>mcprotocollib</artifactId>
<version>1.14.4-2-SNAPSHOT</version>
<version>1.15-pre6-1-SNAPSHOT</version>
<scope>compile</scope>
<exclusions>
<exclusion>

View file

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

View file

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

View file

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

View file

@ -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());

View file

@ -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),