Code Monkey home page Code Monkey logo

scalanbt's Introduction

ScalaNBT

Scala library for NBT io with some Mojangson support.

Usage

There are ten data tags:

  • Tags for each of the six Java number primitives, byte, short, int, long, float, double, as well as String.
  • A list tag that can hold exactly one type of tag.
  • A compound tag (a map) that maps strings to arbitrary tags.
  • An end tag that exists only to denote a missing tag, and does not exist

General tags can be created with Tag(). If no Tag type exists that can hold the argument TagEnd will be returned.


Primitive tags can be created in one of two ways:

TagString("foo") TagInt(1)

"foo".nbt 1.nbt

These are immutable.


TagLists can be manipulated like Seqs, but types are validated at runtime rather than at compile time.

foo = list(1)

list(2) = 5

TagList will use Tag() to convert non-nbt values into tags.

You can also create TagLists from Traversables:

List(1, 2).nbt


TagCompounds can be manipulated like Maps, but you can use dynamic notation too:

compound.key = "value"

TagCompound will use Tag() to convert non-nbt values into tags.

You can also create them similarly to Maps:

TagCompound("one" -> 1, "2" -> "two")


TagCompounds can be converted to and from binary form via the io.readNBT and io.writeNBT functions, or the .toBytes method.

All tags can be converted to mojangson via the .mojangson method.

scalanbt's People

Contributors

mcy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.