minecraft.js
Version:
Minecraft data serialization/deserialization and networking
20 lines (15 loc) • 525 B
JavaScript
var Tag = require(__dirname + '/tag.js');
/** @constructor */
var TileTick = module.exports = function(ticks, block) {
this.ticks = ticks;
this.block = block;
};
TileTick.prototype.toTag = function() {
var tag = new Tag('compound', []);
tag.append(new Tag('int', 'i', this.block.getId()))
.append(new Tag('int', 't', this.ticks))
.append(new Tag('int', 'x', this.block.pos.x))
.append(new Tag('int', 'y', this.block.pos.y))
.append(new Tag('int', 'z', this.block.pos.z));
return tag;
};