Compatibility with 1.10-pre1 (number 2, git didn't push everything for some reason)

This commit is contained in:
Matsv 2016-06-02 18:37:05 +02:00
parent 5665510f7e
commit 3b533b5138
4 changed files with 39 additions and 4 deletions

View File

@ -6,7 +6,7 @@
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<artifactId>viaversion</artifactId> <artifactId>viaversion</artifactId>
<version>16w21a-DEV</version> <version>1.10-pre1-DEV</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>ViaVersion</name> <name>ViaVersion</name>

View File

@ -29,7 +29,7 @@ public class ProtocolVersion {
register(v1_9_1 = new ProtocolVersion(108, "1.9.1")); register(v1_9_1 = new ProtocolVersion(108, "1.9.1"));
register(v1_9_2 = new ProtocolVersion(109, "1.9.2")); register(v1_9_2 = new ProtocolVersion(109, "1.9.2"));
register(v1_9_3 = new ProtocolVersion(110, "1.9.3/4")); register(v1_9_3 = new ProtocolVersion(110, "1.9.3/4"));
register(SNAPSHOT = new ProtocolVersion(203, "16w21b")); register(SNAPSHOT = new ProtocolVersion(204, "1.10-pre1"));
} }
public static void register(@NonNull ProtocolVersion protocol) { public static void register(@NonNull ProtocolVersion protocol) {

View File

@ -9,6 +9,7 @@ import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.remapper.ValueTransformer; import us.myles.ViaVersion.api.remapper.ValueTransformer;
import us.myles.ViaVersion.api.type.Type; import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.packets.State; import us.myles.ViaVersion.packets.State;
import us.myles.ViaVersion.protocols.protocolsnapshotto1_9_3.storage.ResourcePackTracker;
import java.util.List; import java.util.List;
@ -104,6 +105,38 @@ public class ProtocolSnapshotTo1_9_3 extends Protocol {
map(METADATA_LIST); // 7 - Metadata list map(METADATA_LIST); // 7 - Metadata list
} }
}); });
// Packet Send ResourcePack
registerOutgoing(State.PLAY, 0x32, 0x32, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // 0 - URL
map(Type.STRING); // 1 - Hash
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
ResourcePackTracker tracker = wrapper.user().get(ResourcePackTracker.class);
tracker.setLastHash(wrapper.get(Type.STRING, 1)); // Store the hash for resourcepack status
}
});
}
});
// Packet ResourcePack status
registerIncoming(State.PLAY, 0x16, 0x16, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
ResourcePackTracker tracker = wrapper.user().get(ResourcePackTracker.class);
wrapper.write(Type.STRING, tracker.getLastHash());
wrapper.write(Type.VAR_INT, wrapper.read(Type.VAR_INT));
}
});
}
});
} }
public int getNewSoundId(int id) { //TODO organize things later public int getNewSoundId(int id) { //TODO organize things later
@ -116,6 +149,6 @@ public class ProtocolSnapshotTo1_9_3 extends Protocol {
@Override @Override
public void init(UserConnection userConnection) { public void init(UserConnection userConnection) {
userConnection.put(new ResourcePackTracker(userConnection));
} }
} }

View File

@ -1,6 +1,8 @@
package us.myles.ViaVersion.protocols.protocolsnapshotto1_9_3.storage; package us.myles.ViaVersion.protocols.protocolsnapshotto1_9_3.storage;
import lombok.*; import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import us.myles.ViaVersion.api.data.StoredObject; import us.myles.ViaVersion.api.data.StoredObject;
import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.data.UserConnection;