Fixed for 1.17 support

This commit is contained in:
Nanit 2021-10-30 19:48:42 +03:00
parent e45834c3bc
commit 73f1045a76
5 changed files with 2108 additions and 7 deletions

View File

@ -16,7 +16,7 @@ dependencies {
implementation 'org.spongepowered:configurate-yaml:4.1.2'
implementation 'io.netty:netty-all:4.1.54.Final'
implementation 'net.kyori:adventure-nbt:4.1.1'
implementation 'net.kyori:adventure-nbt:4.9.2'
}
jar {

View File

@ -56,6 +56,10 @@ public class PacketPlayerPositionAndLook implements PacketOut {
msg.writeByte(flags);
msg.writeVarInt(teleportId);
}
if (version.moreOrEqual(Version.V1_17)) {
msg.writeBoolean(false); // Dismount vehicle
}
}
}

View File

@ -1,14 +1,14 @@
package ru.nanit.limbo.world;
import net.kyori.adventure.nbt.BinaryTagIO;
import net.kyori.adventure.nbt.CompoundBinaryTag;
import net.kyori.adventure.nbt.ListBinaryTag;
import net.kyori.adventure.nbt.TagStringIO;
import ru.nanit.limbo.server.LimboServer;
import ru.nanit.limbo.util.Logger;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.stream.Collectors;
public final class DimensionRegistry {
@ -25,12 +25,16 @@ public final class DimensionRegistry {
}
public void load(LimboServer server, String def) throws IOException {
InputStream in = server.getClass().getResourceAsStream("/dimension_registry.nbt");
InputStream in = server.getClass().getResourceAsStream("/dimension_codec.snbt");
if(in == null)
throw new FileNotFoundException("Cannot find dimension registry file");
codec = BinaryTagIO.readCompressedInputStream(in);
String data = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8))
.lines()
.collect(Collectors.joining("\n"));
codec = TagStringIO.get().asCompound(data);
ListBinaryTag dimensions = codec.getCompound("minecraft:dimension_type").getList("value");
CompoundBinaryTag overWorld = (CompoundBinaryTag) ((CompoundBinaryTag) dimensions.get(0)).get("element");

File diff suppressed because it is too large Load Diff