UNPKG

minecraft.js

Version:

Minecraft data serialization/deserialization and networking

19 lines (14 loc) 472 B
var TagFormat = require(__dirname + '/tagFormat.js') /** @constructor */ var Enchantment = module.exports = function(args) { if(typeof args != 'object') args = {}; this.id = args.id || 0; this.level = args.damage || 0; }; Enchantment.prototype.toTag = function() { return this.tagFormat.encode(this); }; Enchantment.prototype.tagFormat = new TagFormat('compound', [ new TagFormat('long', 'id', 'id'), new TagFormat('long', 'lvl', 'level') ]);