Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-11-18 05:50:08 +01:00
Handle new resource pack actions
Dieser Commit ist enthalten in:
Ursprung
0949ff4ba9
Commit
adac67b85c
@ -300,22 +300,31 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol<ClientboundP
|
||||
});
|
||||
|
||||
cancelClientbound(ClientboundPackets1_20_3.RESOURCE_PACK_POP);
|
||||
registerServerbound(ServerboundPackets1_20_2.RESOURCE_PACK_STATUS, wrapper -> {
|
||||
final ResourcepackIDStorage storage = wrapper.user().get(ResourcepackIDStorage.class);
|
||||
wrapper.write(Type.UUID, storage != null ? storage.uuid() : UUID.randomUUID());
|
||||
});
|
||||
registerServerbound(ServerboundPackets1_20_2.RESOURCE_PACK_STATUS, resourcePackStatusHandler());
|
||||
|
||||
cancelClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.RESOURCE_PACK_POP.getId());
|
||||
registerServerbound(State.CONFIGURATION, ServerboundConfigurationPackets1_20_2.RESOURCE_PACK, wrapper -> {
|
||||
final ResourcepackIDStorage storage = wrapper.user().get(ResourcepackIDStorage.class);
|
||||
wrapper.write(Type.UUID, storage != null ? storage.uuid() : UUID.randomUUID());
|
||||
});
|
||||
registerServerbound(State.CONFIGURATION, ServerboundConfigurationPackets1_20_2.RESOURCE_PACK, resourcePackStatusHandler());
|
||||
registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.RESOURCE_PACK_PUSH.getId(), ServerboundConfigurationPackets1_20_2.RESOURCE_PACK.getId(), resourcePackHandler());
|
||||
// TODO Auto map via packet types provider
|
||||
registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.UPDATE_ENABLED_FEATURES.getId(), ClientboundConfigurationPackets1_20_2.UPDATE_ENABLED_FEATURES.getId());
|
||||
registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.UPDATE_TAGS.getId(), ClientboundConfigurationPackets1_20_2.UPDATE_TAGS.getId());
|
||||
}
|
||||
|
||||
private PacketHandler resourcePackStatusHandler() {
|
||||
return wrapper -> {
|
||||
final ResourcepackIDStorage storage = wrapper.user().get(ResourcepackIDStorage.class);
|
||||
wrapper.write(Type.UUID, storage != null ? storage.uuid() : UUID.randomUUID());
|
||||
|
||||
final int action = wrapper.read(Type.VAR_INT);
|
||||
if (action > 3) { // Aadded invalid url, failed reload, and discarded
|
||||
wrapper.write(Type.VAR_INT, 2); // Failed download
|
||||
} else {
|
||||
wrapper.write(Type.VAR_INT, action);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
private PacketHandler resourcePackHandler() {
|
||||
return wrapper -> {
|
||||
final UUID uuid = wrapper.read(Type.UUID);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren