Hi! I just made a "simple" mod that adds only 3 blocks:
- NBT Reader
- NBT Writer
- "Generic peripheral block" aka. "Colorable block"
Spoiler
Colorable blockSpoiler
- get - gets the color of the block
- set(int color) - sets the color of the block
- getR/getG/getB - gets the red/green/blue color intensity (0-255)
- setR/setG/setB(byte intensity) - sets the red/green/blue color intensity (0-255)
- getHex - gets the color in 6digit Hexadecimal format
- setHex(string hexstring) - sets the color from a hexadecimal string (for example, you have #00FEED, you write "00FEED", or just simply "FEED")
NBT Reader/Writer
(writer-specific functions are marked with italics+bold)
Spoiler
- proxy - returns a proxy object used to query/manipulate the item in the block
- stack - returns nil if no item is in the block, or a table with the item's details
- compound - returns nil if the item doesn't have any special data, or a proxy table if it has
- keys - returns a key list
- typeof(String key):String - returns the type of the item under *key*
- types - returns an ipairs-able table with name + type pairs
- valueof(String key) - returns the key's value, or if a special type, a proxy to it (listwrapper below)
- count - number of elements
- type - list type, 0 or "end" if untyped
- nth(int key) - returns the N-th element of the list
- dump(int key) - returns a Minecraft-compilant JSON string of the given object
- dumpme - dumps this object into a Minecraft-compilant JSON string
- clear - clears the array, and resets its type
- del(int key) - removes the N-th item from the list
- put(mixed stuff, [string/int NBTtype]) - puts *stuff* into the list. if it was untyped, NBTtype is required
- set(int key, mixed stuff, [string/int NBTtype]) - sets *stuff* in the list. if the list was untyped, NBTtype is required
- putCompound - if the list is untyped / compound typed, puts an empty Compound on top of the list
- newCompound(int key) - if the list is untyped / compound typed, sets an empty Compound at the given key
- load(int key, string MC-NBT) - loads the contents of a Minecraft-compilant JSON into the list's given key
- nbt_types - returns a both value-to-key, and a key-to-value table with all the NBT types associated with a number and a string value
- dump(int key) - returns a Minecraft-compilant JSON string of the given object
- dumpme - dumps this object into a Minecraft-compilant JSON string
- del(String index) - removes the index from the compound
- set(String index, mixed stuff, [string/int NBTtype]) - sets *stuff* in the compound. if the index didn't exist before, NBTtype is required
- newCompound(String index) - sets an empty Compound at the given index
- newList(String index) - sets an empty List at the given index
- load(String index, String MC-NBT) - loads the contents of a Minecraft-compilant JSON into the compound's given index
- recipe(boolean ignoreMeta(default=false), boolean ignreNBT(default=true)) - returns a bit complicated table containing the item's recipe(s)
- I'll explain it later
- dumpme - dumps the item's NBT data into a string. if it didn't have one, it returns nil
- dumps - dumps the whole item into a string for later storage
- size(int size) - sets the number of items, -1 means infinite
- damage(short damage) - sets the item's damage value (0-32767*)
- display(string displaystring) - sets the item's display name (use \174\167 in replacement of § or & or \u00a7)
- cpurge - deletes the item's NBT data if it had one
- creset - (re)creates a new NBT data for the item
- loadme(string nbtjson) - loads the contents of a Minecraft-compilant JSON as the item's NBT data
- dump - same functionality as proxy.dumps()
- eject - ejects the contents of the block on top of it in item form
- destroy - sends the contents of the block into the void ;)/>
- forge(string mcid, [int amount, [short metadata]]) - makes an item from the void's dust :P/> similar syntax to /give (for example /minecraft:give MarcusD ComputerCraft:CC-Computer 64 16385, you do writer.forge("ComputerCraft:CC-Computer", 64, 16385) here)
- load(string nbtjson) - creates a stored item from the contents of a Minecraft-compilant JSON
Bugs
Spoiler
- Sometimes NBT Writers turn into NBT Readers. Breaking'n'replacing the block fixes it. Fortunately this doesn't happen vice-versa :P/>
- nbtwriter.forge method can throw a Java exception about it can't cast the third argument from String to Double (number)
Downloads
Screenshot