Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.cloudburstmc.protocol.bedrock.codec.v776.Bedrock_v776;
import org.cloudburstmc.protocol.bedrock.data.Ability;
import org.cloudburstmc.protocol.bedrock.data.AbilityLayer;
import org.cloudburstmc.protocol.bedrock.data.BuildPlatform;
import org.cloudburstmc.protocol.bedrock.data.GameType;
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataMap;
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
Expand Down Expand Up @@ -266,6 +267,7 @@ public void testBedrockComponentSurvivesAddPlayerPacketRoundTrip() {
packet.setRotation(Vector3f.ZERO);
packet.setDeviceId("");
packet.setHand(ItemData.AIR);
packet.setBuildPlatform(BuildPlatform.GOOGLE);
packet.setGameType(GameType.SURVIVAL);
packet.setPlatformChatId("");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import lombok.NoArgsConstructor;
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper;
import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.AddPlayerSerializer_v291;
import org.cloudburstmc.protocol.bedrock.data.BuildPlatform;
import org.cloudburstmc.protocol.bedrock.packet.AddPlayerPacket;

@NoArgsConstructor(access = AccessLevel.PROTECTED)
Expand All @@ -15,13 +16,13 @@ public class AddPlayerSerializer_v388 extends AddPlayerSerializer_v291 {
public void serialize(ByteBuf buffer, BedrockCodecHelper helper, AddPlayerPacket packet) {
super.serialize(buffer, helper, packet);

buffer.writeIntLE(packet.getBuildPlatform());
buffer.writeIntLE(packet.getBuildPlatform().ordinal());
}

@Override
public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, AddPlayerPacket packet) {
super.deserialize(buffer, helper, packet);

packet.setBuildPlatform(buffer.readIntLE());
packet.setBuildPlatform(BuildPlatform.from(buffer.readIntLE()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import lombok.NoArgsConstructor;
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper;
import org.cloudburstmc.protocol.bedrock.codec.BedrockPacketSerializer;
import org.cloudburstmc.protocol.bedrock.data.BuildPlatform;
import org.cloudburstmc.protocol.bedrock.packet.PlayerListPacket;
import org.cloudburstmc.protocol.common.util.TextConverter;
import org.cloudburstmc.protocol.common.util.VarInts;
Expand All @@ -30,7 +31,7 @@ public void serialize(ByteBuf buffer, BedrockCodecHelper helper, PlayerListPacke
helper.writeString(buffer, converter.serialize(entry.getName(CharSequence.class)));
helper.writeString(buffer, entry.getXuid());
helper.writeString(buffer, entry.getPlatformChatId());
buffer.writeIntLE(entry.getBuildPlatform());
buffer.writeIntLE(entry.getBuildPlatform().ordinal());
helper.writeSkin(buffer, entry.getSkin());
buffer.writeBoolean(entry.isTeacher());
buffer.writeBoolean(entry.isHost());
Expand All @@ -53,7 +54,7 @@ public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, PlayerListPac
entry.setName(converter.deserialize(helper.readString(buffer)));
entry.setXuid(helper.readString(buffer));
entry.setPlatformChatId(helper.readString(buffer));
entry.setBuildPlatform(buffer.readIntLE());
entry.setBuildPlatform(BuildPlatform.from(buffer.readIntLE()));
entry.setSkin(helper.readSkin(buffer));
entry.setTeacher(buffer.readBoolean());
entry.setHost(buffer.readBoolean());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import lombok.NoArgsConstructor;
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper;
import org.cloudburstmc.protocol.bedrock.codec.BedrockPacketSerializer;
import org.cloudburstmc.protocol.bedrock.data.BuildPlatform;
import org.cloudburstmc.protocol.bedrock.packet.PlayerListPacket;
import org.cloudburstmc.protocol.common.util.TextConverter;
import org.cloudburstmc.protocol.common.util.VarInts;
Expand Down Expand Up @@ -65,7 +66,7 @@ protected void writeEntryBase(ByteBuf buffer, BedrockCodecHelper helper, Entry e
helper.writeString(buffer, converter.serialize(entry.getName(CharSequence.class)));
helper.writeString(buffer, entry.getXuid());
helper.writeString(buffer, entry.getPlatformChatId());
buffer.writeIntLE(entry.getBuildPlatform());
buffer.writeIntLE(entry.getBuildPlatform().ordinal());
helper.writeSkin(buffer, entry.getSkin());
buffer.writeBoolean(entry.isTeacher());
buffer.writeBoolean(entry.isHost());
Expand All @@ -78,7 +79,7 @@ protected Entry readEntryBase(ByteBuf buffer, BedrockCodecHelper helper) {
entry.setName(converter.deserialize(helper.readString(buffer)));
entry.setXuid(helper.readString(buffer));
entry.setPlatformChatId(helper.readString(buffer));
entry.setBuildPlatform(buffer.readIntLE());
entry.setBuildPlatform(BuildPlatform.from(buffer.readIntLE()));
entry.setSkin(helper.readSkin(buffer));
entry.setTeacher(buffer.readBoolean());
entry.setHost(buffer.readBoolean());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper;
import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.AdventureSettingsSerializer_v291;
import org.cloudburstmc.protocol.bedrock.codec.v388.serializer.AddPlayerSerializer_v388;
import org.cloudburstmc.protocol.bedrock.data.BuildPlatform;
import org.cloudburstmc.protocol.bedrock.data.GameType;
import org.cloudburstmc.protocol.bedrock.packet.AddPlayerPacket;
import org.cloudburstmc.protocol.common.util.VarInts;
Expand All @@ -28,7 +29,7 @@ public void serialize(ByteBuf buffer, BedrockCodecHelper helper, AddPlayerPacket
AdventureSettingsSerializer_v291.INSTANCE.serialize(buffer, helper, packet.getAdventureSettings());
helper.writeArray(buffer, packet.getEntityLinks(), helper::writeEntityLink);
helper.writeString(buffer, packet.getDeviceId());
buffer.writeIntLE(packet.getBuildPlatform());
buffer.writeIntLE(packet.getBuildPlatform().ordinal());
}

@Override
Expand All @@ -47,6 +48,6 @@ public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, AddPlayerPack
AdventureSettingsSerializer_v291.INSTANCE.deserialize(buffer, helper, packet.getAdventureSettings());
helper.readArray(buffer, packet.getEntityLinks(), helper::readEntityLink);
packet.setDeviceId(helper.readString(buffer));
packet.setBuildPlatform(buffer.readIntLE());
packet.setBuildPlatform(BuildPlatform.from(buffer.readIntLE()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import lombok.NoArgsConstructor;
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper;
import org.cloudburstmc.protocol.bedrock.codec.v503.serializer.AddPlayerSerializer_v503;
import org.cloudburstmc.protocol.bedrock.data.BuildPlatform;
import org.cloudburstmc.protocol.bedrock.packet.AddPlayerPacket;
import org.cloudburstmc.protocol.common.util.VarInts;

Expand All @@ -27,7 +28,7 @@ public void serialize(ByteBuf buffer, BedrockCodecHelper helper, AddPlayerPacket
helper.writePlayerAbilities(buffer, packet);
helper.writeArray(buffer, packet.getEntityLinks(), helper::writeEntityLink);
helper.writeString(buffer, packet.getDeviceId());
buffer.writeIntLE(packet.getBuildPlatform());
buffer.writeIntLE(packet.getBuildPlatform().ordinal());
}

@Override
Expand All @@ -45,6 +46,6 @@ public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, AddPlayerPack
helper.readPlayerAbilities(buffer, packet);
helper.readArray(buffer, packet.getEntityLinks(), helper::readEntityLink);
packet.setDeviceId(helper.readString(buffer));
packet.setBuildPlatform(buffer.readIntLE());
packet.setBuildPlatform(BuildPlatform.from(buffer.readIntLE()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.netty.buffer.ByteBuf;
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper;
import org.cloudburstmc.protocol.bedrock.codec.v534.serializer.AddPlayerSerializer_v534;
import org.cloudburstmc.protocol.bedrock.data.BuildPlatform;
import org.cloudburstmc.protocol.bedrock.packet.AddPlayerPacket;
import org.cloudburstmc.protocol.common.util.VarInts;

Expand All @@ -24,7 +25,7 @@ public void serialize(ByteBuf buffer, BedrockCodecHelper helper, AddPlayerPacket
helper.writePlayerAbilities(buffer, packet);
helper.writeArray(buffer, packet.getEntityLinks(), helper::writeEntityLink);
helper.writeString(buffer, packet.getDeviceId());
buffer.writeIntLE(packet.getBuildPlatform());
buffer.writeIntLE(packet.getBuildPlatform().ordinal());
}

@Override
Expand All @@ -43,6 +44,6 @@ public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, AddPlayerPack
helper.readPlayerAbilities(buffer, packet);
helper.readArray(buffer, packet.getEntityLinks(), helper::readEntityLink);
packet.setDeviceId(helper.readString(buffer));
packet.setBuildPlatform(buffer.readIntLE());
packet.setBuildPlatform(BuildPlatform.from(buffer.readIntLE()));
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package org.cloudburstmc.protocol.bedrock.data;

public enum BuildPlatform {

UNDEFINED,
UNKNOWN,
/**
* Android
*/
GOOGLE,
IOS,
/**
* Mac OS
* macOS
*/
OSX,
/**
Expand All @@ -23,16 +22,16 @@ public enum BuildPlatform {
*/
UWP,
/**
* Educational edition
* Education Edition
*/
WIN_32,
WIN32,
DEDICATED,
/**
* Apple TV
*/
TV_OS,
/**
* Playstation
* PlayStation
*/
SONY,
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import lombok.ToString;
import org.cloudburstmc.math.vector.Vector3f;
import org.cloudburstmc.protocol.bedrock.data.AbilityLayer;
import org.cloudburstmc.protocol.bedrock.data.BuildPlatform;
import org.cloudburstmc.protocol.bedrock.data.GameType;
import org.cloudburstmc.protocol.bedrock.data.PlayerAbilityHolder;
import org.cloudburstmc.protocol.bedrock.data.PlayerPermission;
Expand Down Expand Up @@ -36,7 +37,7 @@ public class AddPlayerPacket implements BedrockPacket, PlayerAbilityHolder {
private ItemData hand;
private AdventureSettingsPacket adventureSettings = new AdventureSettingsPacket();
private String deviceId;
private int buildPlatform;
private BuildPlatform buildPlatform;
private GameType gameType;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.cloudburstmc.protocol.bedrock.data.BuildPlatform;
import org.cloudburstmc.protocol.bedrock.data.skin.SerializedSkin;
import org.cloudburstmc.protocol.common.PacketSignal;

Expand Down Expand Up @@ -42,7 +43,7 @@ public final static class Entry {
private CharSequence name;
private String xuid;
private String platformChatId;
private int buildPlatform;
private BuildPlatform buildPlatform;
private SerializedSkin skin;
private boolean teacher;
private boolean host;
Expand Down
Loading