protocol, assets: 20w46a

This commit is contained in:
Bixilon 2020-11-11 22:09:58 +01:00
parent 77bc055464
commit 5ef1cf5793
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
7 changed files with 37 additions and 46 deletions

View File

@ -38,9 +38,9 @@ import java.util.zip.ZipInputStream;
public class AssetsManager { public class AssetsManager {
public static final String ASSETS_INDEX_VERSION = "1.17"; // version.json -> assetIndex -> id public static final String ASSETS_INDEX_VERSION = "1.17"; // version.json -> assetIndex -> id
public static final String ASSETS_INDEX_HASH = "0aeb75059ef955d4cf2b9823d15775d0eacb13d5"; // version.json -> assetIndex -> sha1 public static final String ASSETS_INDEX_HASH = "951e1a1272565745cc8de8132705934a42f604b1"; // version.json -> assetIndex -> sha1
public static final String ASSETS_CLIENT_JAR_VERSION = "20w45a"; // version.json -> id public static final String ASSETS_CLIENT_JAR_VERSION = "20w46a"; // version.json -> id
public static final String ASSETS_CLIENT_JAR_HASH = "e54153b4d7e03ab3faee11dbff58a4e45f3299e8"; // sha1 hash of file generated by minosoft (client jar file mappings: name -> hash) public static final String ASSETS_CLIENT_JAR_HASH = "ab636db71346ff05c9f4a146e10bb2fbb2990014"; // sha1 hash of file generated by minosoft (client jar file mappings: name -> hash)
public static final String[] RELEVANT_ASSETS = {"minecraft/lang/", "minecraft/sounds/", "minecraft/textures/", "minecraft/font/"}; public static final String[] RELEVANT_ASSETS = {"minecraft/lang/", "minecraft/sounds/", "minecraft/textures/", "minecraft/font/"};
private static final HashMap<String, String> assets = new HashMap<>(); private static final HashMap<String, String> assets = new HashMap<>();

View File

@ -85,7 +85,6 @@ public class Connection {
this.desiredVersionNumber = versionId; this.desiredVersionNumber = versionId;
Thread resolveThread = new Thread(() -> { Thread resolveThread = new Thread(() -> {
Minosoft.waitForStartup(); // wait until mappings are loaded
if (desiredVersionNumber != -1) { if (desiredVersionNumber != -1) {
setVersion(Versions.getVersionById(desiredVersionNumber)); setVersion(Versions.getVersionById(desiredVersionNumber));
} }

View File

@ -18,7 +18,6 @@ import de.bixilon.minosoft.logging.Log;
import de.bixilon.minosoft.protocol.packets.ClientboundPacket; import de.bixilon.minosoft.protocol.packets.ClientboundPacket;
import de.bixilon.minosoft.protocol.protocol.InByteBuffer; import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
import de.bixilon.minosoft.protocol.protocol.PacketHandler; import de.bixilon.minosoft.protocol.protocol.PacketHandler;
import de.bixilon.minosoft.util.BitByte;
import java.util.ArrayList; import java.util.ArrayList;
@ -43,8 +42,8 @@ public class PacketMapData implements ClientboundPacket {
@Override @Override
public boolean read(InByteBuffer buffer) { public boolean read(InByteBuffer buffer) {
if (buffer.getVersionId() < 27) {
mapId = buffer.readVarInt(); // mapId mapId = buffer.readVarInt(); // mapId
if (buffer.getVersionId() < 27) {
short length = buffer.readShort(); short length = buffer.readShort();
// read action // read action
dataData = PacketMapDataDataActions.byId(buffer.readByte()); dataData = PacketMapDataDataActions.byId(buffer.readByte());
@ -68,15 +67,27 @@ public class PacketMapData implements ClientboundPacket {
} }
return true; return true;
} }
if (buffer.getVersionId() < 373) {
mapId = buffer.readVarInt();
scale = buffer.readByte(); scale = buffer.readByte();
if (buffer.getVersionId() >= 58) { if (buffer.getVersionId() >= 58 && buffer.getVersionId() < 759) {
boolean trackPosition = buffer.readBoolean(); boolean trackPosition = buffer.readBoolean();
} }
int pinCount = buffer.readVarInt(); if (buffer.getVersionId() >= 452) {
locked = buffer.readBoolean();
}
int pinCount = 0;
if (buffer.getVersionId() < 759) {
pinCount = buffer.readVarInt();
} else {
if (buffer.readBoolean()) {
pinCount = buffer.readVarInt();
}
}
pins = new ArrayList<>(); pins = new ArrayList<>();
for (int i = 0; i < pinCount; i++) { for (int i = 0; i < pinCount; i++) {
if (buffer.getVersionId() < 373) {
byte directionAndType = buffer.readByte(); byte directionAndType = buffer.readByte();
byte x = buffer.readByte(); byte x = buffer.readByte();
byte z = buffer.readByte(); byte z = buffer.readByte();
@ -85,27 +96,8 @@ public class PacketMapData implements ClientboundPacket {
} else { } else {
pins.add(new MapPinSet(MapPinTypes.byId(directionAndType & 0xF), directionAndType >>> 4, x, z)); pins.add(new MapPinSet(MapPinTypes.byId(directionAndType & 0xF), directionAndType >>> 4, x, z));
} }
continue;
} }
short columns = BitByte.byteToUShort(buffer.readByte());
if (columns > 0) {
byte rows = buffer.readByte();
byte xOffset = buffer.readByte();
byte zOffset = buffer.readByte();
int dataLength = buffer.readVarInt();
data = buffer.readBytes(dataLength);
}
return true;
}
mapId = buffer.readVarInt();
scale = buffer.readByte();
boolean trackPosition = buffer.readBoolean();
if (buffer.getVersionId() >= 452) {
locked = buffer.readBoolean();
}
int pinCount = buffer.readVarInt();
pins = new ArrayList<>();
for (int i = 0; i < pinCount; i++) {
MapPinTypes type = MapPinTypes.byId(buffer.readVarInt()); MapPinTypes type = MapPinTypes.byId(buffer.readVarInt());
byte x = buffer.readByte(); byte x = buffer.readByte();
byte z = buffer.readByte(); byte z = buffer.readByte();
@ -116,11 +108,12 @@ public class PacketMapData implements ClientboundPacket {
} }
pins.add(new MapPinSet(type, direction, x, z, displayName)); pins.add(new MapPinSet(type, direction, x, z, displayName));
} }
short columns = BitByte.byteToUShort(buffer.readByte());
short columns = buffer.readUnsignedByte();
if (columns > 0) { if (columns > 0) {
byte rows = buffer.readByte(); short rows = buffer.readUnsignedByte();
byte xOffset = buffer.readByte(); short xOffset = buffer.readUnsignedByte();
byte zOffset = buffer.readByte(); short zOffset = buffer.readUnsignedByte();
int dataLength = buffer.readVarInt(); int dataLength = buffer.readVarInt();
data = buffer.readBytes(dataLength); data = buffer.readBytes(dataLength);

View File

@ -29,7 +29,6 @@ import de.bixilon.minosoft.data.mappings.recipes.Ingredient;
import de.bixilon.minosoft.data.text.ChatComponent; import de.bixilon.minosoft.data.text.ChatComponent;
import de.bixilon.minosoft.data.world.BlockPosition; import de.bixilon.minosoft.data.world.BlockPosition;
import de.bixilon.minosoft.protocol.network.Connection; import de.bixilon.minosoft.protocol.network.Connection;
import de.bixilon.minosoft.util.BitByte;
import de.bixilon.minosoft.util.Util; import de.bixilon.minosoft.util.Util;
import de.bixilon.minosoft.util.nbt.tag.*; import de.bixilon.minosoft.util.nbt.tag.*;
@ -184,6 +183,10 @@ public class InByteBuffer {
return bytes[position++]; return bytes[position++];
} }
public short readUnsignedByte() {
return (short) (bytes[position++] & 0xFF);
}
public BlockPosition readPosition() { public BlockPosition readPosition() {
//ToDo: protocol id 7 //ToDo: protocol id 7
if (versionId < 440) { if (versionId < 440) {
@ -355,7 +358,7 @@ public class InByteBuffer {
} }
public BlockPosition readBlockPosition() { public BlockPosition readBlockPosition() {
return new BlockPosition(readInt(), BitByte.byteToUShort(readByte()), readInt()); return new BlockPosition(readInt(), readUnsignedByte(), readInt());
} }
public BlockPosition readBlockPositionInteger() { public BlockPosition readBlockPositionInteger() {

View File

@ -37,8 +37,4 @@ public final class BitByte {
int mask = 1 << pos; int mask = 1 << pos;
return ((in & mask) == mask); return ((in & mask) == mask);
} }
public static short byteToUShort(byte b) {
return (short) (b & 0xFF);
}
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long