PrismarineJS / prismarine-entity

Represent a minecraft entity
23 stars 15 forks source link

prismarine-entity

NPM version Build Status

Represent a minecraft entity

Usage

const Entity = require("prismarine-entity")('1.8.9')

const entity = new Entity(0)
console.log(entity)

API

Entity

Entities represent players, mobs, and objects.

entity.id

entity.type

Choices:

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.width

entity.onGround

entity.equipment[5]

Version dependent.

1.8 Layout:

1.9 and later:

entity.heldItem

Equivalent to entity.equipment[0].

entity.metadata

See http://wiki.vg/Entities#Entity_Metadata_Format for more details.

entity.noClip

entity.vehicle

Entity that this entity is riding on

entity.passenger

Entity that is riding on this entity

entity.health

The health of the player, default: 20

entity.food

The food of the player, default: 20

entity.elytraFlying

Whether or not the entity is elytra flying.

entity.player

The player

entity.getCustomName()

returns a prismarine-chat ChatMessage object for the name of the entity or null if there isn't one

entity.getDroppedItem()

returns a prismarine-item Item object for the dropped item, if this is a dropped item, or it will return null

History

2.4.0

2.3.1

2.3.0

2.2.0

2.1.1

2.1.0

2.0.0

1.2.0

1.1.0

1.0.0

0.2.0

0.1.0