Merge branch 'dev'

# Conflicts:
#	gradle.properties
This commit is contained in:
FlorianMichael 2024-01-14 23:49:42 +01:00
commit d2cd87c35b
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
11 changed files with 19 additions and 30 deletions

View File

@ -2,7 +2,7 @@
org.gradle.jvmargs=-Xms32M -Xmx4G -XX:+UseG1GC -XX:+UseStringDeduplication
loader_version=0.15.3
viaver_version=4.9.3-SNAPSHOT
viaver_version=4.10.0-23w51b-SNAPSHOT
yaml_version=2.2
publish_mc_versions=1.20.4, 1.19.4, 1.18.2, 1.17.1, 1.16.5, 1.15.2, 1.14.4, 1.8.9

View File

@ -1,8 +1,5 @@
package com.viaversion.fabric.common.util;
import com.viaversion.viaversion.libs.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import com.viaversion.viaversion.libs.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
public class RemappingUtil {
public static int swordId(String id) {
// https://github.com/ViaVersion/ViaVersion/blob/8de26a0ad33f5b739f5394ed80f69d14197fddc7/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/Protocol1_9To1_8.java#L86
@ -21,12 +18,4 @@ public class RemappingUtil {
return 0;
}
private static final LegacyComponentSerializer LEGACY_SERIALIZER = LegacyComponentSerializer.builder()
.character('§')
.extractUrls()
.build();
public static String legacyToJson(String legacy) {
return GsonComponentSerializer.gson().serialize(LEGACY_SERIALIZER.deserialize(legacy));
}
}

View File

@ -1,7 +1,7 @@
package com.viaversion.fabric.mc114.commands;
import com.viaversion.fabric.common.util.RemappingUtil;
import com.viaversion.viaversion.api.command.ViaCommandSender;
import com.viaversion.viaversion.util.ComponentUtil;
import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient;
@ -28,7 +28,7 @@ public class NMSCommandSender implements ViaCommandSender {
}
public static Text fromLegacy(String legacy) {
return Text.Serializer.fromJson(RemappingUtil.legacyToJson(legacy));
return Text.Serializer.fromJson(ComponentUtil.legacyToJsonString(legacy));
}
@Override

View File

@ -1,7 +1,7 @@
package com.viaversion.fabric.mc115.commands;
import com.viaversion.fabric.common.util.RemappingUtil;
import com.viaversion.viaversion.api.command.ViaCommandSender;
import com.viaversion.viaversion.util.ComponentUtil;
import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient;
@ -28,7 +28,7 @@ public class NMSCommandSender implements ViaCommandSender {
}
public static Text fromLegacy(String legacy) {
return Text.Serializer.fromJson(RemappingUtil.legacyToJson(legacy));
return Text.Serializer.fromJson(ComponentUtil.legacyToJsonString(legacy));
}
@Override

View File

@ -1,7 +1,7 @@
package com.viaversion.fabric.mc116.commands;
import com.viaversion.fabric.common.util.RemappingUtil;
import com.viaversion.viaversion.api.command.ViaCommandSender;
import com.viaversion.viaversion.util.ComponentUtil;
import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
import net.minecraft.command.CommandSource;
import net.minecraft.entity.Entity;
@ -25,7 +25,7 @@ public class NMSCommandSender implements ViaCommandSender {
}
public static Text fromLegacy(String legacy) {
return Text.Serializer.fromJson(RemappingUtil.legacyToJson(legacy));
return Text.Serializer.fromJson(ComponentUtil.legacyToJsonString(legacy));
}
@Override

View File

@ -1,6 +1,6 @@
package com.viaversion.fabric.mc117.commands;
import com.viaversion.fabric.common.util.RemappingUtil;
import com.viaversion.viaversion.util.ComponentUtil;
import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
import net.minecraft.command.CommandSource;
import net.minecraft.entity.Entity;
@ -26,7 +26,7 @@ public class NMSCommandSender implements ViaCommandSender {
}
public static MutableText fromLegacy(String legacy) {
return Text.Serializer.fromJson(RemappingUtil.legacyToJson(legacy));
return Text.Serializer.fromJson(ComponentUtil.legacyToJsonString(legacy));
}
@Override

View File

@ -1,6 +1,6 @@
package com.viaversion.fabric.mc118.commands;
import com.viaversion.fabric.common.util.RemappingUtil;
import com.viaversion.viaversion.util.ComponentUtil;
import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
import net.minecraft.command.CommandSource;
import net.minecraft.entity.Entity;
@ -25,7 +25,7 @@ public class NMSCommandSender implements ViaCommandSender {
}
public static Text fromLegacy(String legacy) {
return Text.Serializer.fromJson(RemappingUtil.legacyToJson(legacy));
return Text.Serializer.fromJson(ComponentUtil.legacyToJsonString(legacy));
}
@Override

View File

@ -1,6 +1,6 @@
package com.viaversion.fabric.mc119.commands;
import com.viaversion.fabric.common.util.RemappingUtil;
import com.viaversion.viaversion.util.ComponentUtil;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.command.CommandSource;
import net.minecraft.entity.Entity;
@ -26,7 +26,7 @@ public class NMSCommandSender implements ViaCommandSender {
}
public static MutableText fromLegacy(String legacy) {
return Text.Serializer.fromJson(RemappingUtil.legacyToJson(legacy));
return Text.Serializer.fromJson(ComponentUtil.legacyToJsonString(legacy));
}
@Override

View File

@ -1,6 +1,6 @@
package com.viaversion.fabric.mc120.commands;
import com.viaversion.fabric.common.util.RemappingUtil;
import com.viaversion.viaversion.util.ComponentUtil;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.command.CommandSource;
import net.minecraft.entity.Entity;
@ -26,7 +26,7 @@ public class NMSCommandSender implements ViaCommandSender {
}
public static MutableText fromLegacy(String legacy) {
return Text.Serialization.fromJson(RemappingUtil.legacyToJson(legacy));
return Text.Serialization.fromJson(ComponentUtil.legacyToJsonString(legacy));
}
@Override

View File

@ -1,7 +1,7 @@
package com.viaversion.fabric.mc18.commands;
import com.viaversion.fabric.common.util.RemappingUtil;
import com.viaversion.viaversion.api.command.ViaCommandSender;
import com.viaversion.viaversion.util.ComponentUtil;
import net.minecraft.command.CommandSource;
import net.minecraft.entity.Entity;
import net.minecraft.text.Text;
@ -24,7 +24,7 @@ public class NMSCommandSender implements ViaCommandSender {
@Override
public void sendMessage(String s) {
source.sendMessage(Text.Serializer.deserialize(RemappingUtil.legacyToJson(s)));
source.sendMessage(Text.Serializer.deserialize(ComponentUtil.legacyToJsonString(s)));
}
@Override

View File

@ -4,11 +4,11 @@ import com.viaversion.fabric.common.commands.UserCommandSender;
import com.viaversion.fabric.common.platform.NativeVersionProvider;
import com.viaversion.fabric.common.provider.AbstractFabricPlatform;
import com.viaversion.fabric.common.util.FutureTaskId;
import com.viaversion.fabric.common.util.RemappingUtil;
import com.viaversion.fabric.mc18.ViaFabric;
import com.viaversion.fabric.mc18.commands.NMSCommandSender;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.command.ViaCommandSender;
import com.viaversion.viaversion.util.ComponentUtil;
import io.netty.channel.EventLoop;
import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
@ -106,7 +106,7 @@ public class FabricPlatform extends AbstractFabricPlatform {
runServerSync(() -> {
ServerPlayerEntity player = server.getPlayerManager().getPlayer(uuid);
if (player == null) return;
player.sendMessage(Text.Serializer.deserialize(RemappingUtil.legacyToJson(s)));
player.sendMessage(Text.Serializer.deserialize(ComponentUtil.legacyToJsonString(s)));
});
}