Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-20 06:50:08 +01:00
1.13-pre3
Dieser Commit ist enthalten in:
Ursprung
e26b6d08e1
Commit
39419f4ca3
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.4.0-1.13-pre2</version>
|
||||
<version>1.4.0-1.13-pre3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.4.0-1.13-pre2</version>
|
||||
<version>1.4.0-1.13-pre3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.4.0-1.13-pre2</version>
|
||||
<version>1.4.0-1.13-pre3</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -62,7 +62,7 @@ public class ProtocolVersion {
|
||||
register(v1_12 = new ProtocolVersion(335, "1.12"));
|
||||
register(v1_12_1 = new ProtocolVersion(338, "1.12.1"));
|
||||
register(v1_12_2 = new ProtocolVersion(340, "1.12.2"));
|
||||
register(v1_13 = new ProtocolVersion(384, "1.13-pre2"));
|
||||
register(v1_13 = new ProtocolVersion(385, "1.13-pre3"));
|
||||
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ import us.myles.ViaVersion.api.platform.providers.ViaProviders;
|
||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||
import us.myles.ViaVersion.api.protocol.ProtocolPipeline;
|
||||
import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
|
||||
import us.myles.ViaVersion.api.protocol.ProtocolVersion;
|
||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
@ -107,50 +108,51 @@ public class BaseProtocol extends Protocol {
|
||||
|
||||
registerOutgoing(State.STATUS, 0x01, 0x01); // Status Pong Packet
|
||||
|
||||
registerOutgoing(State.LOGIN, 0x00, 0x00); // Login Disconnect Packet
|
||||
registerOutgoing(State.LOGIN, 0x01, 0x01); // Encryption Request Packet
|
||||
|
||||
// Login Success Packet
|
||||
// Login Disconnect Packet (1.12.2)
|
||||
// Plugin Message (1.13)
|
||||
registerOutgoing(State.LOGIN, 0x00, 0x00);
|
||||
|
||||
// Encryption Request Packet (1.12.2)
|
||||
// Login Disconnect Packet (1.13)
|
||||
registerOutgoing(State.LOGIN, 0x01, 0x01);
|
||||
|
||||
// Login Success Packet (1.12.2)
|
||||
// Encryption Request Packet (1.13)
|
||||
registerOutgoing(State.LOGIN, 0x02, 0x02, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.STRING); // 0 - UUID as String
|
||||
map(Type.STRING); // 1 - Player Username
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
ProtocolInfo info = wrapper.user().get(ProtocolInfo.class);
|
||||
info.setState(State.PLAY);
|
||||
// Save other info
|
||||
String stringUUID = wrapper.get(Type.STRING, 0);
|
||||
if (stringUUID.length() == 32) { // Trimmed UUIDs are 32 characters
|
||||
// Trimmed
|
||||
stringUUID = addDashes(stringUUID);
|
||||
}
|
||||
UUID uuid = UUID.fromString(stringUUID);
|
||||
info.setUuid(uuid);
|
||||
info.setUsername(wrapper.get(Type.STRING, 1));
|
||||
// Add to ported clients
|
||||
Via.getManager().addPortedClient(wrapper.user());
|
||||
|
||||
if (info.getPipeline().pipes().size() == 1 && info.getPipeline().pipes().get(0).getClass() == BaseProtocol.class) // Only base protocol
|
||||
wrapper.user().setActive(false);
|
||||
|
||||
if (Via.getManager().isDebug()) {
|
||||
// Print out the route to console
|
||||
Via.getPlatform().getLogger().log(Level.INFO, "{0} logged in with protocol {1}, Route: {2}",
|
||||
new Object[]{
|
||||
wrapper.get(Type.STRING, 1),
|
||||
info.getProtocolVersion(),
|
||||
Joiner.on(", ").join(info.getPipeline().pipes(), ", ")
|
||||
});
|
||||
}
|
||||
int protocol = wrapper.user().get(ProtocolInfo.class).getProtocolVersion();
|
||||
if (protocol < ProtocolVersion.v1_13.getId())
|
||||
handleLoginSuccess(wrapper);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
registerOutgoing(State.LOGIN, 0x03, 0x03); // Login Set Compression Packet
|
||||
// Login Set Compression Packet (1.12.2)
|
||||
// Login Success Packet (1.13)
|
||||
registerOutgoing(State.LOGIN, 0x03, 0x03, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
int protocol = wrapper.user().get(ProtocolInfo.class).getProtocolVersion();
|
||||
if (protocol >= ProtocolVersion.v1_13.getId())
|
||||
handleLoginSuccess(wrapper);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Login Set Compression Packet (1.13)
|
||||
registerOutgoing(State.LOGIN, 0x04, 0x04);
|
||||
|
||||
|
||||
/* Incoming Packets */
|
||||
|
||||
// Handshake Packet
|
||||
@ -206,13 +208,43 @@ public class BaseProtocol extends Protocol {
|
||||
registerIncoming(State.STATUS, 0x00, 0x00); // Status Request Packet
|
||||
registerIncoming(State.STATUS, 0x01, 0x01); // Status Ping Packet
|
||||
|
||||
// Login Start Packet
|
||||
// Login Start Packet (1.12.2)
|
||||
// Plugin Message (1.13)
|
||||
registerIncoming(State.LOGIN, 0x00, 0x00, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(final PacketWrapper wrapper) throws Exception {
|
||||
int protocol = wrapper.user().get(ProtocolInfo.class).getProtocolVersion();
|
||||
if (protocol < ProtocolVersion.v1_13.getId())
|
||||
handleLoginStart(wrapper);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Encryption Response Packet (1.12.2)
|
||||
// Login Start Packet (1.13)
|
||||
registerIncoming(State.LOGIN, 0x01, 0x01, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
int protocol = wrapper.user().get(ProtocolInfo.class).getProtocolVersion();
|
||||
if (protocol >= ProtocolVersion.v1_13.getId())
|
||||
handleLoginStart(wrapper);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Encryption Response Packet (1.13)
|
||||
registerIncoming(State.LOGIN, 0x02, 0x02);
|
||||
}
|
||||
|
||||
private void handleLoginStart(final PacketWrapper wrapper) throws Exception {
|
||||
int protocol = wrapper.user().get(ProtocolInfo.class).getProtocolVersion();
|
||||
if (Via.getConfig().getBlockedProtocols().contains(protocol)) {
|
||||
if (!wrapper.user().getChannel().isOpen()) return;
|
||||
@ -231,10 +263,35 @@ public class BaseProtocol extends Protocol {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void handleLoginSuccess(final PacketWrapper wrapper) throws Exception {
|
||||
ProtocolInfo info = wrapper.user().get(ProtocolInfo.class);
|
||||
info.setState(State.PLAY);
|
||||
// Save other info
|
||||
String stringUUID = wrapper.passthrough(Type.STRING);
|
||||
if (stringUUID.length() == 32) { // Trimmed UUIDs are 32 characters
|
||||
// Trimmed
|
||||
stringUUID = addDashes(stringUUID);
|
||||
}
|
||||
UUID uuid = UUID.fromString(stringUUID);
|
||||
info.setUuid(uuid);
|
||||
String username = wrapper.passthrough(Type.STRING);
|
||||
info.setUsername(username);
|
||||
// Add to ported clients
|
||||
Via.getManager().addPortedClient(wrapper.user());
|
||||
|
||||
if (info.getPipeline().pipes().size() == 1 && info.getPipeline().pipes().get(0).getClass() == BaseProtocol.class) // Only base protocol
|
||||
wrapper.user().setActive(false);
|
||||
|
||||
if (Via.getManager().isDebug()) {
|
||||
// Print out the route to console
|
||||
Via.getPlatform().getLogger().log(Level.INFO, "{0} logged in with protocol {1}, Route: {2}",
|
||||
new Object[]{
|
||||
username,
|
||||
info.getProtocolVersion(),
|
||||
Joiner.on(", ").join(info.getPipeline().pipes(), ", ")
|
||||
});
|
||||
}
|
||||
}); // Login Start Packet
|
||||
registerIncoming(State.LOGIN, 0x01, 0x01); // Encryption Response Packet
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -259,7 +316,7 @@ public class BaseProtocol extends Protocol {
|
||||
}
|
||||
|
||||
public static String addDashes(String trimmedUUID) {
|
||||
StringBuffer idBuff = new StringBuffer(trimmedUUID);
|
||||
StringBuilder idBuff = new StringBuilder(trimmedUUID);
|
||||
idBuff.insert(20, '-');
|
||||
idBuff.insert(16, '-');
|
||||
idBuff.insert(12, '-');
|
||||
|
@ -54,6 +54,12 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
|
||||
|
||||
// Outgoing packets
|
||||
|
||||
// New packet 0x0 - Login Plugin Message
|
||||
registerOutgoing(State.LOGIN, 0x0, 0x1);
|
||||
registerOutgoing(State.LOGIN, 0x1, 0x2);
|
||||
registerOutgoing(State.LOGIN, 0x2, 0x3);
|
||||
registerOutgoing(State.LOGIN, 0x3, 0x4);
|
||||
|
||||
// Statistics
|
||||
registerOutgoing(State.PLAY, 0x07, 0x07, new PacketRemapper() {
|
||||
@Override
|
||||
@ -406,6 +412,22 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
|
||||
// New packet 0x53 - Tags
|
||||
|
||||
// Incoming packets
|
||||
|
||||
// New packet 0x0 - Login Plugin Message
|
||||
registerIncoming(State.LOGIN, -1, 0x0, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
wrapper.cancel();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
registerIncoming(State.LOGIN, 0x0, 0x1);
|
||||
registerIncoming(State.LOGIN, 0x1, 0x2);
|
||||
|
||||
registerIncoming(State.PLAY, 0x2, 0x1);
|
||||
registerIncoming(State.PLAY, 0x3, 0x2);
|
||||
registerIncoming(State.PLAY, 0x4, 0x3);
|
||||
|
@ -100,34 +100,43 @@ public class InventoryPackets {
|
||||
}
|
||||
|
||||
wrapper.set(Type.BYTE, 0, flags); // Update flags
|
||||
}
|
||||
if (channel.equalsIgnoreCase("MC|TrList")) {
|
||||
return;
|
||||
} else if (channel.equalsIgnoreCase("MC|TrList")) {
|
||||
channel = "minecraft:trader_list";
|
||||
wrapper.passthrough(Type.INT); // Passthrough Window ID
|
||||
|
||||
int size = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||
for (int i = 0; i < size; i++) {
|
||||
// Input Item
|
||||
Item input = wrapper.read(Type.ITEM);
|
||||
toClient(input);
|
||||
wrapper.write(Type.ITEM, input);
|
||||
Item input = wrapper.passthrough(Type.ITEM);
|
||||
InventoryPackets.toClient(input);
|
||||
// Output Item
|
||||
Item output = wrapper.read(Type.ITEM);
|
||||
toClient(output);
|
||||
wrapper.write(Type.ITEM, output);
|
||||
Item output = wrapper.passthrough(Type.ITEM);
|
||||
InventoryPackets.toClient(output);
|
||||
|
||||
boolean secondItem = wrapper.passthrough(Type.BOOLEAN); // Has second item
|
||||
if (secondItem) {
|
||||
// Second Item
|
||||
Item second = wrapper.read(Type.ITEM);
|
||||
toClient(second);
|
||||
wrapper.write(Type.ITEM, second);
|
||||
Item second = wrapper.passthrough(Type.ITEM);
|
||||
InventoryPackets.toClient(second);
|
||||
}
|
||||
|
||||
wrapper.passthrough(Type.BOOLEAN); // Trade disabled
|
||||
wrapper.passthrough(Type.INT); // Number of tools uses
|
||||
wrapper.passthrough(Type.INT); // Maximum number of trade uses
|
||||
}
|
||||
} else if (channel.equalsIgnoreCase("MC|Brand")) {
|
||||
channel = "minecraft:brand";
|
||||
} else if (channel.equalsIgnoreCase("MC|BOpen")) {
|
||||
channel = "minecraft:book_open";
|
||||
} else if (channel.equalsIgnoreCase("MC|DebugPath")) {
|
||||
channel = "minecraft:debug/paths";
|
||||
} else if (channel.equalsIgnoreCase("MC|DebugNeighborsUpdate")) {
|
||||
channel = "minecraft:debug/neighbors_update";
|
||||
} else {
|
||||
wrapper.cancel(); // TODO REGISTER channel removed?
|
||||
}
|
||||
wrapper.set(Type.STRING, 0, channel);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -8409,33 +8409,33 @@
|
||||
"8406": "minecraft:green_concrete_powder",
|
||||
"8407": "minecraft:red_concrete_powder",
|
||||
"8408": "minecraft:black_concrete_powder",
|
||||
"8409": "minecraft:kelp_plant",
|
||||
"8410": "minecraft:kelp[age=0]",
|
||||
"8411": "minecraft:kelp[age=1]",
|
||||
"8412": "minecraft:kelp[age=2]",
|
||||
"8413": "minecraft:kelp[age=3]",
|
||||
"8414": "minecraft:kelp[age=4]",
|
||||
"8415": "minecraft:kelp[age=5]",
|
||||
"8416": "minecraft:kelp[age=6]",
|
||||
"8417": "minecraft:kelp[age=7]",
|
||||
"8418": "minecraft:kelp[age=8]",
|
||||
"8419": "minecraft:kelp[age=9]",
|
||||
"8420": "minecraft:kelp[age=10]",
|
||||
"8421": "minecraft:kelp[age=11]",
|
||||
"8422": "minecraft:kelp[age=12]",
|
||||
"8423": "minecraft:kelp[age=13]",
|
||||
"8424": "minecraft:kelp[age=14]",
|
||||
"8425": "minecraft:kelp[age=15]",
|
||||
"8426": "minecraft:kelp[age=16]",
|
||||
"8427": "minecraft:kelp[age=17]",
|
||||
"8428": "minecraft:kelp[age=18]",
|
||||
"8429": "minecraft:kelp[age=19]",
|
||||
"8430": "minecraft:kelp[age=20]",
|
||||
"8431": "minecraft:kelp[age=21]",
|
||||
"8432": "minecraft:kelp[age=22]",
|
||||
"8433": "minecraft:kelp[age=23]",
|
||||
"8434": "minecraft:kelp[age=24]",
|
||||
"8435": "minecraft:kelp[age=25]",
|
||||
"8409": "minecraft:kelp[age=0]",
|
||||
"8410": "minecraft:kelp[age=1]",
|
||||
"8411": "minecraft:kelp[age=2]",
|
||||
"8412": "minecraft:kelp[age=3]",
|
||||
"8413": "minecraft:kelp[age=4]",
|
||||
"8414": "minecraft:kelp[age=5]",
|
||||
"8415": "minecraft:kelp[age=6]",
|
||||
"8416": "minecraft:kelp[age=7]",
|
||||
"8417": "minecraft:kelp[age=8]",
|
||||
"8418": "minecraft:kelp[age=9]",
|
||||
"8419": "minecraft:kelp[age=10]",
|
||||
"8420": "minecraft:kelp[age=11]",
|
||||
"8421": "minecraft:kelp[age=12]",
|
||||
"8422": "minecraft:kelp[age=13]",
|
||||
"8423": "minecraft:kelp[age=14]",
|
||||
"8424": "minecraft:kelp[age=15]",
|
||||
"8425": "minecraft:kelp[age=16]",
|
||||
"8426": "minecraft:kelp[age=17]",
|
||||
"8427": "minecraft:kelp[age=18]",
|
||||
"8428": "minecraft:kelp[age=19]",
|
||||
"8429": "minecraft:kelp[age=20]",
|
||||
"8430": "minecraft:kelp[age=21]",
|
||||
"8431": "minecraft:kelp[age=22]",
|
||||
"8432": "minecraft:kelp[age=23]",
|
||||
"8433": "minecraft:kelp[age=24]",
|
||||
"8434": "minecraft:kelp[age=25]",
|
||||
"8435": "minecraft:kelp_plant",
|
||||
"8436": "minecraft:dried_kelp_block",
|
||||
"8437": "minecraft:turtle_egg[eggs=1,hatch=0]",
|
||||
"8438": "minecraft:turtle_egg[eggs=1,hatch=1]",
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.4.0-1.13-pre2</version>
|
||||
<version>1.4.0-1.13-pre3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<name>viaversion-jar</name>
|
||||
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>us.myles</groupId>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<version>1.4.0-1.13-pre2</version>
|
||||
<version>1.4.0-1.13-pre3</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>viaversion-parent</name>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.4.0-1.13-pre2</version>
|
||||
<version>1.4.0-1.13-pre3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.4.0-1.13-pre2</version>
|
||||
<version>1.4.0-1.13-pre3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren