diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/TextComponent.java b/src/main/java/de/bixilon/minosoft/game/datatypes/TextComponent.java index 017b8965b..dfd19544e 100644 --- a/src/main/java/de/bixilon/minosoft/game/datatypes/TextComponent.java +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/TextComponent.java @@ -108,7 +108,7 @@ public class TextComponent { this.json = json; } - private JSONObject getExtraByAttributes(String message, ChatAttributes color, List formatting) { + private static JSONObject getExtraByAttributes(String message, ChatAttributes color, List formatting) { JSONObject ret = new JSONObject(); ret.put("text", message); if (color != null) { diff --git a/src/main/java/de/bixilon/minosoft/protocol/packets/clientbound/play/PacketMapData.java b/src/main/java/de/bixilon/minosoft/protocol/packets/clientbound/play/PacketMapData.java index ba9de6fcb..fe209a974 100644 --- a/src/main/java/de/bixilon/minosoft/protocol/packets/clientbound/play/PacketMapData.java +++ b/src/main/java/de/bixilon/minosoft/protocol/packets/clientbound/play/PacketMapData.java @@ -34,7 +34,7 @@ public class PacketMapData implements ClientboundPacket { byte[] colors; // players - List players; + List pins; //scale byte scale; @@ -55,15 +55,15 @@ public class PacketMapData implements ClientboundPacket { colors = buffer.readBytes(length - 3); // 3: dataData(1) + xStart (1) + yStart (1) break; case PLAYERS: - players = new ArrayList<>(); + pins = new ArrayList<>(); length--; // minus the dataData for (int i = 0; i < length / 3; i++) { // loop over all sets ( 1 set: 3 bytes) byte data = buffer.readByte(); byte type = BitByte.getLow4Bits(data); MapPlayerDirection direction = MapPlayerDirection.byId(BitByte.getHigh4Bits(data)); byte x = buffer.readByte(); - byte y = buffer.readByte(); - players.add(new MapPlayerSet(type, direction, x, y)); + byte z = buffer.readByte(); + pins.add(new MapPinSet(type, direction, x, z)); } break; case SCALE: @@ -72,7 +72,26 @@ public class PacketMapData implements ClientboundPacket { } break; case VERSION_1_8: - //ToDo + mapId = buffer.readVarInt(); + scale = buffer.readByte(); + int pinCount = buffer.readVarInt(); + pins = new ArrayList<>(); + for (int i = 0; i < pinCount; i++) { + byte directionAndType = buffer.readByte(); + byte x = buffer.readByte(); + byte z = buffer.readByte(); + pins.add(new MapPinSet(BitByte.getHigh4Bits(directionAndType), MapPlayerDirection.byId(BitByte.getLow4Bits(directionAndType)), x, z)); + } + byte columns = buffer.readByte(); + if (columns > 0) { + byte rows = buffer.readByte(); + byte xOffset = buffer.readByte(); + byte zOffset = buffer.readByte(); + + int dataLength = buffer.readVarInt(); + byte[] data = buffer.readBytes(dataLength); + } + break; } } @@ -104,10 +123,10 @@ public class PacketMapData implements ClientboundPacket { } - public List getPlayers() { - return players; + public List getPins() { + return pins; } - + public byte getScale() { return scale; @@ -163,13 +182,13 @@ public class PacketMapData implements ClientboundPacket { } } - public static class MapPlayerSet { + public static class MapPinSet { final int type; final MapPlayerDirection direction; byte x; byte z; - public MapPlayerSet(int type, MapPlayerDirection direction, byte x, byte z) { + public MapPinSet(int type, MapPlayerDirection direction, byte x, byte z) { this.type = type; this.direction = direction; this.x = x;