Mirror von
https://github.com/Moulberry/AxiomPaperPlugin.git
synchronisiert 2024-11-17 05:40:06 +01:00
Update to ViaVersion 5.x
Dieser Commit ist enthalten in:
Ursprung
ae6868911a
Commit
2515f2bb38
@ -6,7 +6,7 @@ coreprotect = "22.4"
|
|||||||
paper = "1.20.4-R0.1-SNAPSHOT"
|
paper = "1.20.4-R0.1-SNAPSHOT"
|
||||||
plotsquared = "7.3.9-20240513.192211-13"
|
plotsquared = "7.3.9-20240513.192211-13"
|
||||||
reflection-remapper = "0.1.2-20240315.033304-2"
|
reflection-remapper = "0.1.2-20240315.033304-2"
|
||||||
viaversion-api = "4.10.1-20240505.124211-22"
|
viaversion-api = "5.0.1"
|
||||||
worldguard-bukkit = "7.1.0-20240503.180049-12"
|
worldguard-bukkit = "7.1.0-20240503.180049-12"
|
||||||
zstd-jni = "1.5.5-4"
|
zstd-jni = "1.5.5-4"
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import com.viaversion.viaversion.api.data.MappingData;
|
|||||||
import com.viaversion.viaversion.api.data.Mappings;
|
import com.viaversion.viaversion.api.data.Mappings;
|
||||||
import com.viaversion.viaversion.api.protocol.ProtocolPathEntry;
|
import com.viaversion.viaversion.api.protocol.ProtocolPathEntry;
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
|
import com.viaversion.viaversion.api.type.Types;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
import net.minecraft.SharedConstants;
|
import net.minecraft.SharedConstants;
|
||||||
@ -108,28 +109,28 @@ public class ViaVersionHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static CompoundTag readTagViaVersion(FriendlyByteBuf friendlyByteBuf, int playerVersion) throws Exception {
|
public static CompoundTag readTagViaVersion(FriendlyByteBuf friendlyByteBuf, int playerVersion) throws Exception {
|
||||||
Type<com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag> from = getTagType(playerVersion);
|
Type<com.viaversion.nbt.tag.CompoundTag> from = getTagType(playerVersion);
|
||||||
Type<com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag> to = getTagType(SharedConstants.getProtocolVersion());
|
Type<com.viaversion.nbt.tag.CompoundTag> to = getTagType(SharedConstants.getProtocolVersion());
|
||||||
|
|
||||||
return readTagViaVersion(friendlyByteBuf, from, to);
|
return readTagViaVersion(friendlyByteBuf, from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Type<com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag> getTagType(int version) {
|
private static Type<com.viaversion.nbt.tag.CompoundTag> getTagType(int version) {
|
||||||
if (version < UNNAMED_COMPOUND_TAG_CHANGE_VERSION) {
|
if (version < UNNAMED_COMPOUND_TAG_CHANGE_VERSION) {
|
||||||
return Type.NAMED_COMPOUND_TAG;
|
return Types.NAMED_COMPOUND_TAG;
|
||||||
} else {
|
} else {
|
||||||
return Type.COMPOUND_TAG;
|
return Types.COMPOUND_TAG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CompoundTag readTagViaVersion(FriendlyByteBuf friendlyByteBuf,
|
private static CompoundTag readTagViaVersion(FriendlyByteBuf friendlyByteBuf,
|
||||||
Type<com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag> from,
|
Type<com.viaversion.nbt.tag.CompoundTag> from,
|
||||||
Type<com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag> to) throws Exception {
|
Type<com.viaversion.nbt.tag.CompoundTag> to) throws Exception {
|
||||||
if (from == to) {
|
if (from == to) {
|
||||||
return friendlyByteBuf.readNbt();
|
return friendlyByteBuf.readNbt();
|
||||||
}
|
}
|
||||||
|
|
||||||
com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag tag = from.read(friendlyByteBuf);
|
com.viaversion.nbt.tag.CompoundTag tag = from.read(friendlyByteBuf);
|
||||||
FriendlyByteBuf buffer = new FriendlyByteBuf(Unpooled.buffer());
|
FriendlyByteBuf buffer = new FriendlyByteBuf(Unpooled.buffer());
|
||||||
to.write(buffer, tag);
|
to.write(buffer, tag);
|
||||||
return buffer.readNbt();
|
return buffer.readNbt();
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren