From 306191fc1dfd9349a4b8e938a1af354de2c73cd8 Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Sun, 30 Aug 2015 20:52:14 +0200 Subject: [PATCH] use prismarine-entity, fix #25 --- doc/api.md | 114 +------------------------------------ lib/entity.js | 25 -------- lib/playerPlugins/login.js | 2 +- package.json | 3 +- 4 files changed, 6 insertions(+), 138 deletions(-) delete mode 100644 lib/entity.js diff --git a/doc/api.md b/doc/api.md index a65550a..616426e 100644 --- a/doc/api.md +++ b/doc/api.md @@ -4,29 +4,7 @@ - [API](#api) - [Classes](#classes) - - [Flying-squid.Entity](#flying-squidentity) - - [entity.id](#entityid) - - [entity.type](#entitytype) - - [entity.username](#entityusername) - - [entity.mobType](#entitymobtype) - - [entity.displayName](#entitydisplayname) - - [entity.entityType](#entityentitytype) - - [entity.kind](#entitykind) - - [entity.name](#entityname) - - [entity.objectType](#entityobjecttype) - - [entity.count](#entitycount) - - [entity.position](#entityposition) - - [entity.velocity](#entityvelocity) - - [entity.yaw](#entityyaw) - - [entity.pitch](#entitypitch) - - [entity.height](#entityheight) - - [entity.onGround](#entityonground) - - [entity.equipment[5]](#entityequipment5) - - [entity.heldItem](#entityhelditem) - - [entity.metadata](#entitymetadata) - - [entity.health](#entityhealth) - - [entity.food](#entityfood) - - [entity.player](#entityplayer) + - [Entity](#entity) - [MCServer](#mcserver) - [Flying-squid.createMCServer(options)](#flying-squidcreatemcserveroptions) - [Properties](#properties) @@ -74,94 +52,8 @@ ## Classes -### Flying-squid.Entity - -Entities represent players, mobs, and objects. They are emitted -in many events, and you can access your own entity with `bot.entity`. - -#### entity.id - -#### entity.type - -Choices: - - * `player` - * `mob` - * `object` - * `global` - lightning - * `orb` - experience orb. - * `other` - introduced with a recent Minecraft update and not yet recognized or used by a third-party mod - -#### entity.username - -If the entity type is `player`, this field will be set. - -#### entity.mobType - -If the entity type is `mob`, this field will be set. - -#### entity.displayName - -Field set for mob and object. A long name in multiple words. - -#### entity.entityType - -Field set for mob and object. The numerical type of the entity (1,2,...) - -#### entity.kind - -Field set for mob and object. The kind of entity (for example Hostile mobs, Passive mobs, NPCs). - -#### entity.name - -Field set for mob and object. A short name for the entity. - -#### entity.objectType - -If the entity type is `object`, this field will be set. - -#### entity.count - -If the entity type is `orb`, this field will be how much experience you -get from collecting the orb. - -#### entity.position - -#### entity.velocity - -#### entity.yaw - -#### entity.pitch - -#### entity.height - -#### entity.onGround - -#### entity.equipment[5] - - * `0` - held item - * `1` - shoes - * `2` - legging - * `3` - torso - * `4` - head - - -#### entity.heldItem - -Equivalent to `entity.equipment[0]`. - -#### entity.metadata - -See http://wiki.vg/Entities#Entity_Metadata_Format for more details. - -#### entity.health -The health of the player, default: 20 - -#### entity.food -The food of the player, default: 20 - -#### entity.player -The player +### Entity +See [prismarine-entity](https://github.com/PrismarineJS/prismarine-entity) ## MCServer diff --git a/lib/entity.js b/lib/entity.js deleted file mode 100644 index 6b057d3..0000000 --- a/lib/entity.js +++ /dev/null @@ -1,25 +0,0 @@ -var Vec3 = require('vec3').Vec3; - -module.exports = Entity; - -function Entity(id) { - this.id = id; - this.type = null; - this.position = new Vec3(0, 0, 0); - this.velocity = new Vec3(0, 0, 0); - this.yaw = 0; - this.pitch = 0; - this.onGround = true; - this.height = 0; - this.effects = {}; - // 0 = held item, 1-4 = armor slot - this.equipment = new Array(5); - this.heldItem = this.equipment[0]; // shortcut to equipment[0] - this.isValid = true; - this.metadata = []; -} - -Entity.prototype.setEquipment = function(index, item) { - this.equipment[index] = item; - this.heldItem = this.equipment[0]; -}; diff --git a/lib/playerPlugins/login.js b/lib/playerPlugins/login.js index 4f22040..ee2930f 100644 --- a/lib/playerPlugins/login.js +++ b/lib/playerPlugins/login.js @@ -1,4 +1,4 @@ -var Entity=require("../entity"); +var Entity=require("prismarine-entity"); var vec3 = require("vec3"); module.exports=inject; diff --git a/package.json b/package.json index d33a365..e7ee184 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,8 @@ "requireindex": "~1.0.0", "prismarine-block": "0.1.0", "minecraft-data": "0.7.0", - "mkdirp":"0.5.1" + "mkdirp":"0.5.1", + "prismarine-entity": "0.1.0" }, "repository": { "type": "git",