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

Finish mappings

Dieser Commit ist enthalten in:
Nassim Jahnke 2022-10-22 12:22:55 +02:00
Ursprung 9d3ee288df
Commit 808b1fd2f0
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
2 geänderte Dateien mit 657 neuen und 648 gelöschten Zeilen

Datei anzeigen

@ -30,7 +30,7 @@ import com.viaversion.viabackwards.protocol.protocol1_19_1to1_19_3.storage.Nonce
import com.viaversion.viabackwards.protocol.protocol1_19to1_19_1.Protocol1_19To1_19_1;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.ProfileKey;
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types;
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19_3Types;
import com.viaversion.viaversion.api.protocol.packet.State;
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
import com.viaversion.viaversion.api.rewriter.EntityRewriter;
@ -285,12 +285,21 @@ public final class Protocol1_19_1To1_19_3 extends BackwardsProtocol<ClientboundP
registerClientbound(ClientboundPackets1_19_3.DISGUISED_CHAT, ClientboundPackets1_19_1.SYSTEM_CHAT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.COMPONENT);
//TODO chat type handling
read(Type.VAR_INT); // Chat type
read(Type.COMPONENT); // Sender
read(Type.OPTIONAL_COMPONENT); // Target
create(Type.BOOLEAN, false); // Overlay
handler(wrapper -> {
final JsonElement content = wrapper.read(Type.COMPONENT);
translatableRewriter.processText(content);
final int chatTypeId = wrapper.read(Type.VAR_INT);
final JsonElement senderName = wrapper.read(Type.COMPONENT);
final JsonElement targetName = wrapper.read(Type.OPTIONAL_COMPONENT);
final JsonElement result = Protocol1_19To1_19_1.decorateChatMessage(wrapper.user().get(ChatTypeStorage1_19_3.class), chatTypeId, senderName, targetName, content);
if (result == null) {
wrapper.cancel();
return;
}
wrapper.write(Type.COMPONENT, result);
wrapper.write(Type.BOOLEAN, false);
});
}
});
@ -303,7 +312,7 @@ public final class Protocol1_19_1To1_19_3 extends BackwardsProtocol<ClientboundP
public void init(final UserConnection user) {
user.put(new ChatSessionStorage());
user.put(new ChatTypeStorage1_19_3());
addEntityTracker(user, new EntityTrackerBase(user, Entity1_19Types.PLAYER, true));
addEntityTracker(user, new EntityTrackerBase(user, Entity1_19_3Types.PLAYER, true));
}
@Override