/** * Gets the type code of a tag class. * * @param clazz The tag class. * @return The type code. * @throws IllegalArgumentException if the tag class is invalid. */ @Deprecated public static int getTypeCode(Class<? extends Tag<?>> clazz) { return TagType.getByTagClass(clazz).getId(); }
/** * Gets the type code of a tag class. * * @param clazz The tag class. * @return The type code. * @throws IllegalArgumentException if the tag class is invalid. */ @Deprecated public static int getTypeCode(Class<? extends Tag<?>> clazz) { return TagType.getByTagClass(clazz).getId(); }
/** * Gets the type code of a tag class. * * @param clazz The tag class. * @return The type code. * @throws IllegalArgumentException if the tag class is invalid. */ @Deprecated public static int getTypeCode(Class<? extends Tag<?>> clazz) { return TagType.getByTagClass(clazz).getId(); }
/** * Writes a {@code TAG_Compound} tag. * * @param tag The tag. * @throws java.io.IOException if an I/O error occurs. */ private void writeCompoundTagPayload(CompoundTag tag) throws IOException { for (Tag<?> childTag : tag.getValue().values()) { writeTag(childTag); } os.writeByte(TagType.TAG_END.getId()); // end tag - better way? }
/** * Writes a {@code TAG_Compound} tag. * * @param tag The tag. * @throws java.io.IOException if an I/O error occurs. */ private void writeCompoundTagPayload(CompoundTag tag) throws IOException { for (Tag<?> childTag : tag.getValue().values()) { writeTag(childTag); } os.writeByte(TagType.TAG_END.getId()); // end tag - better way? }
/** * Writes a {@code TAG_Compound} tag. * * @param tag The tag. * @throws java.io.IOException if an I/O error occurs. */ private void writeCompoundTagPayload(CompoundTag tag) throws IOException { for (Tag<?> childTag : tag.getValue().values()) { writeTag(childTag); } os.writeByte(TagType.TAG_END.getId()); // end tag - better way? }
/** * Writes a tag. * * @param tag The tag to write. * @throws java.io.IOException if an I/O error occurs. */ public void writeTag(Tag<?> tag) throws IOException { String name = tag.getName(); byte[] nameBytes = name.getBytes(NBTConstants.CHARSET.name()); os.writeByte(tag.getType().getId()); os.writeShort(nameBytes.length); os.write(nameBytes); if (tag.getType() == TagType.TAG_END) { throw new IOException("Named TAG_End not permitted."); } writeTagPayload(tag); }
/** * Writes a tag. * * @param tag The tag to write. * @throws java.io.IOException if an I/O error occurs. */ public void writeTag(Tag<?> tag) throws IOException { String name = tag.getName(); byte[] nameBytes = name.getBytes(NBTConstants.CHARSET.name()); os.writeByte(tag.getType().getId()); os.writeShort(nameBytes.length); os.write(nameBytes); if (tag.getType() == TagType.TAG_END) { throw new IOException("Named TAG_End not permitted."); } writeTagPayload(tag); }
/** * Writes a tag. * * @param tag The tag to write. * @throws java.io.IOException if an I/O error occurs. */ public void writeTag(Tag<?> tag) throws IOException { String name = tag.getName(); byte[] nameBytes = name.getBytes(NBTConstants.CHARSET.name()); os.writeByte(tag.getType().getId()); os.writeShort(nameBytes.length); os.write(nameBytes); if (tag.getType() == TagType.TAG_END) { throw new IOException("Named TAG_End not permitted."); } writeTagPayload(tag); }
/** * Writes a {@code TAG_List} tag. * * @param tag The tag. * @throws java.io.IOException if an I/O error occurs. */ @SuppressWarnings ("unchecked") private void writeListTagPayload(ListTag<?> tag) throws IOException { Class<? extends Tag<?>> clazz = tag.getElementType(); List<Tag<?>> tags = (List<Tag<?>>) tag.getValue(); int size = tags.size(); os.writeByte(TagType.getByTagClass(clazz).getId()); os.writeInt(size); for (Tag<?> tag1 : tags) { writeTagPayload(tag1); } }
/** * Writes a {@code TAG_List} tag. * * @param tag The tag. * @throws java.io.IOException if an I/O error occurs. */ @SuppressWarnings ("unchecked") private void writeListTagPayload(ListTag<?> tag) throws IOException { Class<? extends Tag<?>> clazz = tag.getElementType(); List<Tag<?>> tags = (List<Tag<?>>) tag.getValue(); int size = tags.size(); os.writeByte(TagType.getByTagClass(clazz).getId()); os.writeInt(size); for (Tag<?> tag1 : tags) { writeTagPayload(tag1); } }
/** * Writes a {@code TAG_List} tag. * * @param tag The tag. * @throws java.io.IOException if an I/O error occurs. */ @SuppressWarnings ("unchecked") private void writeListTagPayload(ListTag<?> tag) throws IOException { Class<? extends Tag<?>> clazz = tag.getElementType(); List<Tag<?>> tags = (List<Tag<?>>) tag.getValue(); int size = tags.size(); os.writeByte(TagType.getByTagClass(clazz).getId()); os.writeInt(size); for (Tag<?> tag1 : tags) { writeTagPayload(tag1); } }