mirror of
https://github.com/ViaVersion/ViaProxy.git
synced 2024-11-28 02:15:47 -05:00
Updated Via API usage
This commit is contained in:
parent
c2e5817651
commit
86888a0d38
2 changed files with 2 additions and 56 deletions
|
@ -56,15 +56,12 @@ repositories {
|
|||
dependencies {
|
||||
include "com.viaversion:viaversion-common:4.10.0-23w51b-SNAPSHOT"
|
||||
include "com.viaversion:viabackwards-common:4.10.0-23w51b-SNAPSHOT"
|
||||
include "com.viaversion:viarewind-common:3.0.5"
|
||||
include("net.raphimc:ViaLegacy:2.2.22-SNAPSHOT") {
|
||||
exclude group: "net.lenni0451.mcstructs", module: "text"
|
||||
}
|
||||
include "com.viaversion:viarewind-common:3.0.6-SNAPSHOT"
|
||||
include "net.raphimc:ViaLegacy:2.2.22-SNAPSHOT"
|
||||
include "net.raphimc:ViaAprilFools:2.0.10"
|
||||
include("net.raphimc:ViaBedrock:0.0.4-SNAPSHOT") {
|
||||
exclude group: "io.netty"
|
||||
exclude group: "io.jsonwebtoken"
|
||||
exclude group: "net.lenni0451.mcstructs", module: "text"
|
||||
}
|
||||
include("net.raphimc:ViaLoader:2.2.13-SNAPSHOT") {
|
||||
exclude group: "org.slf4j", module: "slf4j-api"
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
* This file is part of ViaProxy - https://github.com/RaphiMC/ViaProxy
|
||||
* Copyright (C) 2023 RK_01/RaphiMC and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.raphimc.viaproxy.injection.mixins;
|
||||
|
||||
import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||
import com.viaversion.viaversion.libs.gson.JsonNull;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.util.ComponentConverter;
|
||||
import net.lenni0451.mcstructs.text.ATextComponent;
|
||||
import net.lenni0451.mcstructs.text.serializer.TextComponentCodec;
|
||||
import net.lenni0451.mcstructs.text.serializer.TextComponentSerializer;
|
||||
import net.raphimc.vialegacy.api.util.converter.JsonConverter;
|
||||
import net.raphimc.vialegacy.api.util.converter.NbtConverter;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
|
||||
@Mixin(ComponentConverter.class)
|
||||
public abstract class MixinComponentConverter {
|
||||
|
||||
@Overwrite
|
||||
public static JsonElement tagComponentToJson(final Tag tag) {
|
||||
final ATextComponent textComponent = TextComponentCodec.V1_20_3.deserializeNbtTree(NbtConverter.viaToMcStructs(tag));
|
||||
if (textComponent == null) return JsonNull.INSTANCE;
|
||||
|
||||
return JsonConverter.gsonToVia(TextComponentSerializer.V1_19_4.serializeJson(textComponent));
|
||||
}
|
||||
|
||||
@Overwrite
|
||||
public static Tag jsonComponentToTag(final JsonElement component) {
|
||||
final ATextComponent textComponent = TextComponentSerializer.V1_19_4.deserialize(JsonConverter.viaToGson(component));
|
||||
if (textComponent == null) return null;
|
||||
|
||||
return NbtConverter.mcStructsToVia(TextComponentCodec.V1_20_3.serializeNbt(textComponent));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue