3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-03 14:50:30 +01:00

As per popular request, 1.12 clients for 1.12-pre6 servers.

Dieser Commit ist enthalten in:
Myles 2017-06-07 16:50:22 +01:00
Ursprung 1cb3b985a7
Commit fef435b9fb
3 geänderte Dateien mit 57 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -9,6 +9,7 @@ import us.myles.ViaVersion.protocols.protocol1_10to1_9_3.Protocol1_10To1_9_3_4;
import us.myles.ViaVersion.protocols.protocol1_11_1to1_11.Protocol1_11_1To1_11; import us.myles.ViaVersion.protocols.protocol1_11_1to1_11.Protocol1_11_1To1_11;
import us.myles.ViaVersion.protocols.protocol1_11to1_10.Protocol1_11To1_10; import us.myles.ViaVersion.protocols.protocol1_11to1_10.Protocol1_11To1_10;
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.Protocol1_12To1_11_1; import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.Protocol1_12To1_11_1;
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.Protocol1_12To1_12_Pre6;
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.Protocol1_9_1_2TO1_9_3_4; import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.Protocol1_9_1_2TO1_9_3_4;
import us.myles.ViaVersion.protocols.protocol1_9_1to1_9.Protocol1_9_1TO1_9; import us.myles.ViaVersion.protocols.protocol1_9_1to1_9.Protocol1_9_1TO1_9;
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.Protocol1_9_3TO1_9_1_2; import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.Protocol1_9_3TO1_9_1_2;
@ -41,9 +42,10 @@ public class ProtocolRegistry {
registerProtocol(new Protocol1_11To1_10(), Collections.singletonList(ProtocolVersion.v1_11.getId()), ProtocolVersion.v1_10.getId()); registerProtocol(new Protocol1_11To1_10(), Collections.singletonList(ProtocolVersion.v1_11.getId()), ProtocolVersion.v1_10.getId());
registerProtocol(new Protocol1_11_1To1_11(), Collections.singletonList(ProtocolVersion.v1_11_1.getId()), ProtocolVersion.v1_11.getId()); registerProtocol(new Protocol1_11_1To1_11(), Collections.singletonList(ProtocolVersion.v1_11_1.getId()), ProtocolVersion.v1_11.getId());
// Snapshot
registerProtocol(new Protocol1_12To1_11_1(), Collections.singletonList(ProtocolVersion.v1_12.getId()), ProtocolVersion.v1_11_1.getId()); registerProtocol(new Protocol1_12To1_11_1(), Collections.singletonList(ProtocolVersion.v1_12.getId()), ProtocolVersion.v1_11_1.getId());
// 1.12 -> 1.12-pre6 server (as per popular request)
registerProtocol(new Protocol1_12To1_12_Pre6(), Collections.singletonList(ProtocolVersion.v1_12.getId()), ProtocolVersion.v1_12_pre6.getId());
} }
/** /**

Datei anzeigen

@ -30,6 +30,7 @@ public class ProtocolVersion {
public static final ProtocolVersion v1_11; public static final ProtocolVersion v1_11;
public static final ProtocolVersion v1_11_1; public static final ProtocolVersion v1_11_1;
public static final ProtocolVersion v1_12; public static final ProtocolVersion v1_12;
public static final ProtocolVersion v1_12_pre6;
public static final ProtocolVersion unknown; public static final ProtocolVersion unknown;
private final int id; private final int id;
@ -56,6 +57,7 @@ public class ProtocolVersion {
register(v1_11 = new ProtocolVersion(315, "1.11")); register(v1_11 = new ProtocolVersion(315, "1.11"));
register(v1_11_1 = new ProtocolVersion(316, "1.11.1")); register(v1_11_1 = new ProtocolVersion(316, "1.11.1"));
register(v1_12 = new ProtocolVersion(335, "1.12")); register(v1_12 = new ProtocolVersion(335, "1.12"));
register(v1_12_pre6 = new ProtocolVersion(333, "1.12-pre6"));
register(unknown = new ProtocolVersion(-1, "UNKNOWN")); register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
} }

Datei anzeigen

@ -0,0 +1,51 @@
package us.myles.ViaVersion.protocols.protocol1_12to1_11_1;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.protocol.Protocol;
import us.myles.ViaVersion.api.remapper.PacketHandler;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.packets.State;
public class Protocol1_12To1_12_Pre6 extends Protocol {
@Override
protected void registerPackets() {
registerOutgoing(State.PLAY, 0x48, 0x48, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Sound name
map(Type.VAR_INT); // 1 - Sound Category
map(Type.INT); // 2 - x
map(Type.INT); // 3 - y
map(Type.INT); // 4 - z
map(Type.FLOAT); // 5 - Volume
map(Type.FLOAT); // 6 - Pitch
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
int id = wrapper.get(Type.VAR_INT, 0);
id = getNewSoundId(id);
if (id == -1) // Removed
wrapper.cancel();
wrapper.set(Type.VAR_INT, 0, id);
}
});
}
});
}
@Override
public void init(UserConnection userConnection) {
}
private int getNewSoundId(int id) { //TODO Make it better, suggestions are welcome. It's ugly and hardcoded now.
int newId = id;
if (id >= 544) // UI toast sound
newId += 3;
return newId;
}
}