mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-18 05:51:12 +00:00
use prismarine-entity, fix #25
This commit is contained in:
parent
efab777efb
commit
306191fc1d
4 changed files with 6 additions and 138 deletions
114
doc/api.md
114
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
|
||||
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
var Entity=require("../entity");
|
||||
var Entity=require("prismarine-entity");
|
||||
var vec3 = require("vec3");
|
||||
|
||||
module.exports=inject;
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Reference in a new issue