fix chunk reading < 1.10. Print (version) mappings loading time

This commit is contained in:
Bixilon 2020-08-07 22:03:00 +02:00
parent deb700d33d
commit 00d38eb955
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 8 additions and 4 deletions

View File

@ -56,12 +56,14 @@ public class Minosoft {
checkAssets(); checkAssets();
Log.info("Assets checking done"); Log.info("Assets checking done");
Log.info("Loading versions.json..."); Log.info("Loading versions.json...");
long mappingStartLoadingTime = System.currentTimeMillis();
try { try {
Versions.load(Util.readJsonFromFile(Config.homeDir + "assets/mapping/versions.json")); Versions.load(Util.readJsonFromFile(Config.homeDir + "assets/mapping/versions.json"));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
System.exit(1); System.exit(1);
} }
Log.info(String.format("Loaded versions mapping in %dms", (System.currentTimeMillis() - mappingStartLoadingTime)));
checkClientToken(); checkClientToken();

View File

@ -99,10 +99,12 @@ public class PacketChunkData implements ClientboundPacket {
// set position of the byte buffer, because of some reasons HyPixel makes some weired stuff and sends way to much 0 bytes. (~ 190k), thanks @pokechu22 // set position of the byte buffer, because of some reasons HyPixel makes some weired stuff and sends way to much 0 bytes. (~ 190k), thanks @pokechu22
buffer.setPosition(size + lastPos); buffer.setPosition(size + lastPos);
} }
int blockEntitiesCount = buffer.readVarInt(); if (buffer.getProtocolId() >= 110) {
for (int i = 0; i < blockEntitiesCount; i++) { int blockEntitiesCount = buffer.readVarInt();
CompoundTag tag = (CompoundTag) buffer.readNBT(); for (int i = 0; i < blockEntitiesCount; i++) {
blockEntities.put(new BlockPosition(tag.getIntTag("x").getValue(), (short) tag.getIntTag("y").getValue(), tag.getIntTag("z").getValue()), tag); CompoundTag tag = (CompoundTag) buffer.readNBT();
blockEntities.put(new BlockPosition(tag.getIntTag("x").getValue(), (short) tag.getIntTag("y").getValue(), tag.getIntTag("z").getValue()), tag);
}
} }
return true; return true;
} }