mirror of
https://github.com/ViaVersion/ViaLegacy.git
synced 2024-12-22 16:38:16 +01:00
Updated Via API usage
This commit is contained in:
parent
176b6de7c8
commit
162894fd76
@ -97,7 +97,7 @@ public class Protocol1_7_6_10to1_7_2_5 extends AbstractProtocol<ClientboundPacke
|
||||
final GameProfileFetcher gameProfileFetcher = Via.getManager().getProviders().get(GameProfileFetcher.class);
|
||||
|
||||
final String skullName = extraType == null ? "" : extraType.getValue();
|
||||
final CompoundTag newTag = tag.clone();
|
||||
final CompoundTag newTag = tag.copy();
|
||||
|
||||
if (gameProfileFetcher.isUUIDLoaded(skullName)) { // short cut if skull is already loaded
|
||||
final UUID uuid = gameProfileFetcher.getMojangUUID(skullName);
|
||||
|
@ -18,15 +18,15 @@
|
||||
package net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types;
|
||||
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.libs.opennbt.NBTIO;
|
||||
import com.viaversion.viaversion.api.type.types.misc.NamedCompoundTagType;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.io.NBTIO;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.limiter.TagLimiter;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.ByteBufInputStream;
|
||||
import io.netty.buffer.ByteBufOutputStream;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.*;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
@ -45,12 +45,12 @@ public class NBTType extends Type<CompoundTag> {
|
||||
|
||||
final ByteBuf data = buffer.readSlice(length);
|
||||
try (InputStream in = new GZIPInputStream(new ByteBufInputStream(data))) {
|
||||
return NBTIO.readTag(in);
|
||||
return NBTIO.readTag(new DataInputStream(in), TagLimiter.create(NamedCompoundTagType.MAX_NBT_BYTES, NamedCompoundTagType.MAX_NESTING_LEVEL), true, CompoundTag.class);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ByteBuf buffer, CompoundTag nbt) throws Exception {
|
||||
public void write(ByteBuf buffer, CompoundTag nbt) throws IOException {
|
||||
if (nbt == null) {
|
||||
buffer.writeShort(-1);
|
||||
return;
|
||||
@ -59,7 +59,7 @@ public class NBTType extends Type<CompoundTag> {
|
||||
final ByteBuf data = buffer.alloc().buffer();
|
||||
try {
|
||||
try (OutputStream out = new GZIPOutputStream(new ByteBufOutputStream(data))) {
|
||||
NBTIO.writeTag(out, nbt);
|
||||
NBTIO.writeTag(new DataOutputStream(out), nbt, true);
|
||||
}
|
||||
|
||||
buffer.writeShort(data.readableBytes());
|
||||
|
Loading…
Reference in New Issue
Block a user