private static void readSkipSlot(ByteBuf packet, int protocolVersion) { if ( (protocolVersion >= ProtocolConstants.MINECRAFT_1_13_2) ? packet.readBoolean() : packet.readShort() != -1 ) { if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13_2 ) { DefinedPacket.readVarInt( packet ); } packet.skipBytes( ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 ) ? 1 : 3 ); // byte vs byte, short int position = packet.readerIndex(); if ( packet.readByte() != 0 ) { packet.readerIndex( position ); try { new NBTInputStream( new ByteBufInputStream( packet ), false ).readTag(); } catch ( IOException ex ) { throw Throwables.propagate( ex ); } } } }
CompoundMap compoundTagList = new CompoundMap(); while (true) { Tag tag = readTag(depth + 1); if (tag instanceof EndTag) { break;
try new NBTInputStream( new ByteBufInputStream( packet ), false ).readTag(); } catch ( IOException ex )
CompoundMap compoundTagList = new CompoundMap(); while (true) { Tag tag = readTag(depth + 1); if (tag instanceof EndTag) { break;
/** * Reads an NBT {@link Tag} from the stream. * * @return The tag that was read. * @throws java.io.IOException if an I/O error occurs. */ public Tag readTag() throws IOException { return readTag(0); }
/** * Reads an NBT {@link Tag} from the stream. * * @return The tag that was read. * @throws java.io.IOException if an I/O error occurs. */ public Tag readTag() throws IOException { return readTag(0); }
/** * Reads an NBT {@link Tag} from the stream. * * @return The tag that was read. * @throws java.io.IOException if an I/O error occurs. */ public Tag readTag() throws IOException { return readTag(0); }
public void load(InputStream stream, boolean compressed) throws IOException { NBTInputStream is = new NBTInputStream(stream, compressed); Tag<?> tag = is.readTag(); if (!(tag instanceof CompoundTag)) { throw new IllegalArgumentException("Expected CompoundTag, got " + tag.getClass()); } CompoundTag compound = (CompoundTag) tag; load(compound); } }
public void load(InputStream stream, boolean compressed) throws IOException { NBTInputStream is = new NBTInputStream(stream, compressed); Tag<?> tag = is.readTag(); if (!(tag instanceof CompoundTag)) { throw new IllegalArgumentException("Expected CompoundTag, got " + tag.getClass()); } CompoundTag compound = (CompoundTag) tag; load(compound); } }
public void load(InputStream stream, boolean compressed) throws IOException { NBTInputStream is = new NBTInputStream(stream, compressed); Tag<?> tag = is.readTag(); if (!(tag instanceof CompoundTag)) { throw new IllegalArgumentException("Expected CompoundTag, got " + tag.getClass()); } CompoundTag compound = (CompoundTag) tag; load(compound); } }
Tag tag = input.readTag(); System.out.println("NBT data from file: " + argFile.getCanonicalPath()); System.out.println(tag);
private List<Tag<?>> readRawNBT(File f, boolean compressed) { List<Tag<?>> tags = new ArrayList<Tag<?>>(); try { InputStream is = new FileInputStream(f); NBTInputStream ns = new NBTInputStream(is, compressed); try { boolean eof = false; while (!eof) { try { tags.add(ns.readTag()); } catch (EOFException e) { eof = true; } } } finally { try { ns.close(); } catch (IOException e) { JOptionPane.showMessageDialog(this, "Unable to close file", "File Read Error", JOptionPane.ERROR_MESSAGE); } } } catch (FileNotFoundException e) { JOptionPane.showMessageDialog(this, "Unable to open file", "File Read Error", JOptionPane.ERROR_MESSAGE); } catch (IOException e) { return null; } return tags; }
Tag tag = input.readTag(); System.out.println("NBT data from file: " + argFile.getCanonicalPath()); System.out.println(tag);
Tag tag = input.readTag(); System.out.println("NBT data from file: " + argFile.getCanonicalPath()); System.out.println(tag);
private List<Tag<?>> readRawNBT(File f, boolean compressed) { List<Tag<?>> tags = new ArrayList<Tag<?>>(); try { InputStream is = new FileInputStream(f); NBTInputStream ns = new NBTInputStream(is, compressed); try { boolean eof = false; while (!eof) { try { tags.add(ns.readTag()); } catch (EOFException e) { eof = true; } } } finally { try { ns.close(); } catch (IOException e) { JOptionPane.showMessageDialog(this, "Unable to close file", "File Read Error", JOptionPane.ERROR_MESSAGE); } } } catch (FileNotFoundException e) { JOptionPane.showMessageDialog(this, "Unable to open file", "File Read Error", JOptionPane.ERROR_MESSAGE); } catch (IOException e) { return null; } return tags; }
private List<Tag<?>> readRawNBT(File f, boolean compressed) { List<Tag<?>> tags = new ArrayList<Tag<?>>(); try { InputStream is = new FileInputStream(f); NBTInputStream ns = new NBTInputStream(is, compressed); try { boolean eof = false; while (!eof) { try { tags.add(ns.readTag()); } catch (EOFException e) { eof = true; } } } finally { try { ns.close(); } catch (IOException e) { JOptionPane.showMessageDialog(this, "Unable to close file", "File Read Error", JOptionPane.ERROR_MESSAGE); } } } catch (FileNotFoundException e) { JOptionPane.showMessageDialog(this, "Unable to open file", "File Read Error", JOptionPane.ERROR_MESSAGE); } catch (IOException e) { return null; } return tags; }
NBTInputStream ns = new NBTInputStream(iis, false); try { Tag<?> t = ns.readTag(); list.add(t); } catch (IOException ioe) {
NBTInputStream ns = new NBTInputStream(iis, false); try { Tag<?> t = ns.readTag(); list.add(t); } catch (IOException ioe) {
NBTInputStream ns = new NBTInputStream(iis, false); try { Tag<?> t = ns.readTag(); list.add(t); } catch (IOException ioe) {
public ServerInfo[] loadServers() throws Exception{ final FileInputStream fis = new FileInputStream(file); NBTInputStream nbtIs = new NBTInputStream(fis, false); // the cast should be safe, because compound tag is also a root container of contents in the file... final CompoundTag root = (CompoundTag) nbtIs.readTag(); nbtIs.close(); ListTag serversListTag = (ListTag) root.getValue().get("servers"); if(serversListTag.getElementType() != CompoundTag.class) { throw new Exception("Type of list value in servers file is not tag_compound!"); } List<CompoundTag> serversList = serversListTag.getValue(); ServerInfo[] result = new ServerInfo[serversList.size()]; for(int i = 0; i < serversList.size(); ++i){ result[i] = createServerFromTag(serversList.get(i).getValue()); } return result; }