minecraft.js
Version:
Minecraft data serialization/deserialization and networking
21 lines (18 loc) • 804 B
JavaScript
(function(Minecraft) {
/** @constructor */
Minecraft.DroppedItemEntity = function(args) {
if(typeof args != 'object') args = {};
args.id = 'Item';
Minecraft.Entity.call(this, args);
this.health = args.health || 5;
this.age = args.age || 0;
this.item = args.item || new Minecraft.Item();
};
Minecraft.DroppedItemEntity.prototype = new Minecraft.ItemEntity();
Minecraft.DroppedItemEntity.prototype.constructor = Minecraft.DroppedItemEntity;
Minecraft.DroppedItemEntity.prototype.tagFormat = Minecraft.ItemEntity.prototype.tagFormat.clone().append([
new Minecraft.TagFormat('short', 'Health', 'health'),
new Minecraft.TagFormat('short', 'Age', 'age'),
new Minecraft.TagFormat('compound', 'Item', 'item', Minecraft.Item.prototype.tagFormat)
]);
})(Minecraft);