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 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_CLIENT_JAR_VERSION = "20w45a"; // 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_INDEX_HASH = "951e1a1272565745cc8de8132705934a42f604b1"; // version.json -> assetIndex -> sha1
public static final String ASSETS_CLIENT_JAR_VERSION = "20w46a"; // version.json -> id
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/"};
private static final HashMap<String, String> assets = new HashMap<>();

View File

@ -85,7 +85,6 @@ public class Connection {
this.desiredVersionNumber = versionId;
Thread resolveThread = new Thread(() -> {
Minosoft.waitForStartup(); // wait until mappings are loaded
if (desiredVersionNumber != -1) {
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.protocol.InByteBuffer;
import de.bixilon.minosoft.protocol.protocol.PacketHandler;
import de.bixilon.minosoft.util.BitByte;
import java.util.ArrayList;
@ -43,8 +42,8 @@ public class PacketMapData implements ClientboundPacket {
@Override
public boolean read(InByteBuffer buffer) {
mapId = buffer.readVarInt(); // mapId
if (buffer.getVersionId() < 27) {
mapId = buffer.readVarInt(); // mapId
short length = buffer.readShort();
// read action
dataData = PacketMapDataDataActions.byId(buffer.readByte());
@ -68,15 +67,27 @@ public class PacketMapData implements ClientboundPacket {
}
return true;
}
if (buffer.getVersionId() < 373) {
mapId = buffer.readVarInt();
scale = buffer.readByte();
if (buffer.getVersionId() >= 58) {
boolean trackPosition = buffer.readBoolean();
scale = buffer.readByte();
if (buffer.getVersionId() >= 58 && buffer.getVersionId() < 759) {
boolean trackPosition = buffer.readBoolean();
}
if (buffer.getVersionId() >= 452) {
locked = buffer.readBoolean();
}
int pinCount = 0;
if (buffer.getVersionId() < 759) {
pinCount = buffer.readVarInt();
} else {
if (buffer.readBoolean()) {
pinCount = buffer.readVarInt();
}
int pinCount = buffer.readVarInt();
pins = new ArrayList<>();
for (int i = 0; i < pinCount; i++) {
}
pins = new ArrayList<>();
for (int i = 0; i < pinCount; i++) {
if (buffer.getVersionId() < 373) {
byte directionAndType = buffer.readByte();
byte x = buffer.readByte();
byte z = buffer.readByte();
@ -85,27 +96,8 @@ public class PacketMapData implements ClientboundPacket {
} else {
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());
byte x = buffer.readByte();
byte z = buffer.readByte();
@ -116,11 +108,12 @@ public class PacketMapData implements ClientboundPacket {
}
pins.add(new MapPinSet(type, direction, x, z, displayName));
}
short columns = BitByte.byteToUShort(buffer.readByte());
short columns = buffer.readUnsignedByte();
if (columns > 0) {
byte rows = buffer.readByte();
byte xOffset = buffer.readByte();
byte zOffset = buffer.readByte();
short rows = buffer.readUnsignedByte();
short xOffset = buffer.readUnsignedByte();
short zOffset = buffer.readUnsignedByte();
int dataLength = buffer.readVarInt();
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.world.BlockPosition;
import de.bixilon.minosoft.protocol.network.Connection;
import de.bixilon.minosoft.util.BitByte;
import de.bixilon.minosoft.util.Util;
import de.bixilon.minosoft.util.nbt.tag.*;
@ -184,6 +183,10 @@ public class InByteBuffer {
return bytes[position++];
}
public short readUnsignedByte() {
return (short) (bytes[position++] & 0xFF);
}
public BlockPosition readPosition() {
//ToDo: protocol id 7
if (versionId < 440) {
@ -355,7 +358,7 @@ public class InByteBuffer {
}
public BlockPosition readBlockPosition() {
return new BlockPosition(readInt(), BitByte.byteToUShort(readByte()), readInt());
return new BlockPosition(readInt(), readUnsignedByte(), readInt());
}
public BlockPosition readBlockPositionInteger() {

View File

@ -37,8 +37,4 @@ public final class BitByte {
int mask = 1 << pos;
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