mappings: fix error in JarHashGenerator, support for 21w07a

This commit is contained in:
Bixilon 2021-02-17 21:12:29 +01:00
parent 14de7ff6e5
commit e7c76e3528
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
8 changed files with 55 additions and 1455 deletions

View File

@ -8,6 +8,7 @@ import de.bixilon.minosoft.data.assets.Resources;
import de.bixilon.minosoft.data.mappings.versions.Version; import de.bixilon.minosoft.data.mappings.versions.Version;
import java.io.*; import java.io.*;
import java.util.Collections;
public class JarHashGenerator { public class JarHashGenerator {
@ -17,7 +18,7 @@ public class JarHashGenerator {
return; return;
} }
try { try {
Version version = new Version(args[0], -1, -1, null, null); Version version = new Version(args[0], -1, -1, Collections.emptyMap(), Collections.emptyMap());
JsonObject json = JsonParser.parseReader(new InputStreamReader(new FileInputStream("src/main/resources/assets/mapping/resources.json"))).getAsJsonObject(); JsonObject json = JsonParser.parseReader(new InputStreamReader(new FileInputStream("src/main/resources/assets/mapping/resources.json"))).getAsJsonObject();
@ -46,6 +47,7 @@ public class JarHashGenerator {
writer.close(); writer.close();
System.exit(0); System.exit(0);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
System.exit(1); System.exit(1);
} }
} }

View File

@ -112,7 +112,6 @@ class RenderWindow(private val connection: Connection, val rendering: Rendering)
} else if (keyAction == KeyBinding.KeyAction.RELEASE) { } else if (keyAction == KeyBinding.KeyAction.RELEASE) {
keysDown.remove(keyCode) keysDown.remove(keyCode)
} }
Log.verbose("Keycode $keyCode: $keyAction")
for ((identifier, keyCallbackPair) in keyBindingCallbacks) { for ((identifier, keyCallbackPair) in keyBindingCallbacks) {
run { run {
@ -157,7 +156,6 @@ class RenderWindow(private val connection: Connection, val rendering: Rendering)
return@run return@run
} }
Log.debug("Keycode ($identifier) -> $keyCode: $keyAction")
if (keyAction == KeyBinding.KeyAction.PRESS) { if (keyAction == KeyBinding.KeyAction.PRESS) {
keyBindingDown.add(keyBinding) keyBindingDown.add(keyBinding)
} else if (keyAction == KeyBinding.KeyAction.RELEASE) { } else if (keyAction == KeyBinding.KeyAction.RELEASE) {

View File

@ -1,68 +0,0 @@
/*
* Minosoft
* Copyright (C) 2020 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program.If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.protocol.packets.serverbound.play;
import de.bixilon.minosoft.data.Difficulties;
import de.bixilon.minosoft.data.player.Hands;
import de.bixilon.minosoft.protocol.network.Connection;
import de.bixilon.minosoft.protocol.packets.ServerboundPacket;
import de.bixilon.minosoft.protocol.protocol.OutPacketBuffer;
import de.bixilon.minosoft.protocol.protocol.Packets;
import de.bixilon.minosoft.util.logging.Log;
import static de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_14W03B;
import static de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_15W31A;
public class PacketClientSettings implements ServerboundPacket {
public final String locale;
public final byte renderDistance;
public Hands mainHand;
public PacketClientSettings(String locale, int renderDistance) {
this.locale = locale;
this.renderDistance = (byte) renderDistance;
}
public PacketClientSettings(String locale, int renderDistance, Hands mainHand) {
this.locale = locale;
this.renderDistance = (byte) renderDistance;
this.mainHand = mainHand;
}
@Override
public OutPacketBuffer write(Connection connection) {
OutPacketBuffer buffer = new OutPacketBuffer(connection, Packets.Serverbound.PLAY_CLIENT_SETTINGS);
buffer.writeString(this.locale); // locale
buffer.writeByte(this.renderDistance); // render Distance
buffer.writeByte((byte) 0x00); // chat settings (nobody uses them)
buffer.writeBoolean(true); // chat colors
if (buffer.getVersionId() < V_14W03B) {
buffer.writeByte((byte) Difficulties.NORMAL.ordinal()); // difficulty
buffer.writeBoolean(true); // cape
} else {
buffer.writeByte((byte) 0b01111111); // ToDo: skin parts
}
if (buffer.getVersionId() >= V_15W31A) {
buffer.writeVarInt(this.mainHand.ordinal());
}
return buffer;
}
@Override
public void log() {
Log.protocol(String.format("[OUT] Sending settings (locale=%s, renderDistance=%d)", this.locale, this.renderDistance));
}
}

View File

@ -0,0 +1,49 @@
/*
* Minosoft
* Copyright (C) 2020 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program.If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.protocol.packets.serverbound.play
import de.bixilon.minosoft.data.Difficulties
import de.bixilon.minosoft.data.player.Hands
import de.bixilon.minosoft.protocol.network.Connection
import de.bixilon.minosoft.protocol.packets.ServerboundPacket
import de.bixilon.minosoft.protocol.protocol.OutPacketBuffer
import de.bixilon.minosoft.protocol.protocol.Packets
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions
import de.bixilon.minosoft.util.logging.Log
class PacketClientSettings(val locale: String = "en_US", val renderDistance: Int = 10, val mainHand: Hands = Hands.MAIN_HAND, val disableTextFiltering: Boolean = true) : ServerboundPacket {
override fun write(connection: Connection): OutPacketBuffer {
val buffer = OutPacketBuffer(connection, Packets.Serverbound.PLAY_CLIENT_SETTINGS)
buffer.writeString(locale) // locale
buffer.writeByte(renderDistance) // render Distance
buffer.writeByte(0x00.toByte()) // chat settings (nobody uses them)
buffer.writeBoolean(true) // chat colors
if (buffer.versionId < ProtocolVersions.V_14W03B) {
buffer.writeByte(Difficulties.NORMAL.ordinal.toByte()) // difficulty
buffer.writeBoolean(true) // cape
} else {
buffer.writeByte(0x7F.toByte()) // ToDo: skin parts
}
if (buffer.versionId >= ProtocolVersions.V_15W31A) {
buffer.writeVarInt(mainHand.ordinal)
}
if (buffer.versionId >= ProtocolVersions.V_21W07A) {
buffer.writeBoolean(disableTextFiltering)
}
return buffer
}
override fun log() {
Log.protocol(String.format("[OUT] Sending settings (locale=%s, renderDistance=%d)", locale, renderDistance))
}
}

View File

@ -15,6 +15,7 @@ package de.bixilon.minosoft.protocol.protocol;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class ProtocolVersions { public class ProtocolVersions {
public static final int V_21W07A = 768;
public static final int V_21W06A = 767; public static final int V_21W06A = 767;
public static final int V_21W05B = 766; public static final int V_21W05B = 766;
public static final int V_21W05A = 765; public static final int V_21W05A = 765;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long