mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-02 11:26:42 +00:00
This commit is contained in:
@ -19,6 +19,8 @@
|
||||
|
||||
package com.sk89q.jnbt;
|
||||
|
||||
import com.boydti.fawe.object.io.LittleEndianOutputStream;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.io.Closeable;
|
||||
@ -66,6 +68,15 @@ public final class NBTOutputStream extends OutputStream implements Closeable, Da
|
||||
return os;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use a little endian output stream
|
||||
*/
|
||||
public void setLittleEndian() {
|
||||
if (!(os instanceof LittleEndianOutputStream)) {
|
||||
this.os = new LittleEndianOutputStream((OutputStream) os);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a tag.
|
||||
*
|
||||
@ -79,11 +90,7 @@ public final class NBTOutputStream extends OutputStream implements Closeable, Da
|
||||
checkNotNull(tag);
|
||||
|
||||
int type = NBTUtils.getTypeCode(tag.getClass());
|
||||
byte[] nameBytes = name.getBytes(NBTConstants.CHARSET);
|
||||
|
||||
os.writeByte(type);
|
||||
os.writeShort(nameBytes.length);
|
||||
os.write(nameBytes);
|
||||
writeNamedTagName(name, type);
|
||||
|
||||
if (type == NBTConstants.TYPE_END) {
|
||||
throw new IOException("Named TAG_End not permitted.");
|
||||
|
Reference in New Issue
Block a user