Skip to content

Instantly share code, notes, and snippets.

@maxov
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxov/5d9a09d0871dbb602481 to your computer and use it in GitHub Desktop.
Save maxov/5d9a09d0871dbb602481 to your computer and use it in GitHub Desktop.
A prototype for an Nbt serialization lib.
public interface BannerData extends NbtStored {
// If no argument is given, the attribute is saved with the name of the method
@Nbt String id();
// The attributes of this compound tag are collapsed into this NBT data
@Nbt.Collapse Vec3i position();
// Could be replaced with a TextColor, I'm not sure
// 'Base' is set as the name
@Nbt(name = "base") String color();
// Typical nested data
@Nbt List<BannerPattern> patterns();
interface BannerPattern extends NbtStored {
// Could be replaced with a TextColor, I'm not sure
@Nbt String color();
// Almost certain this is a string internally
@Nbt String pattern();
}
}
public @interface Nbt {
String name() default "";
String value() default "";
public @interface Collapse {
}
}
public interface Vec3i extends NbtStored {
@Nbt int x();
@Nbt int y();
@Nbt int z();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment