Skip to content

Commit

Permalink
Add documentation for the explosion damage function (PrismarineJS#2060)
Browse files Browse the repository at this point in the history
* Update api.md

* Update api.md

* Update index.d.ts

* Update api.md
  • Loading branch information
link-discord authored Jul 24, 2021
1 parent aa6ce34 commit 037c643
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
31 changes: 23 additions & 8 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
- ["death"](#death)
- ["health"](#health)
- ["breath"](#breath)
- ["entityAttributes"](#entityattributes-entity)
- ["entitySwingArm" (entity)](#entityswingarm-entity)
- ["entityHurt" (entity)](#entityhurt-entity)
- ["entityWake" (entity)](#entitywake-entity)
Expand Down Expand Up @@ -226,6 +227,7 @@
- [bot.wake([cb])](#botwakecb)
- [bot.setControlState(control, state)](#botsetcontrolstatecontrol-state)
- [bot.getControlState(control)](#botgetcontrolstatecontrol-state)
- [bot.getExplosionDamages(entity, position, radius, [rawDamages])](#botgetexplosiondamages)
- [bot.clearControlStates()](#botclearcontrolstates)
- [bot.lookAt(point, [force], [callback])](#botlookatpoint-force-callback)
- [bot.look(yaw, pitch, [force], [callback])](#botlookyaw-pitch-force-callback)
Expand Down Expand Up @@ -777,7 +779,7 @@ gradually up to 1. When the thunderstorm stops, this value gradually decreases b

Each time `bot.thunderState` is changed, the "weatherUpdate" event is emitted.

This is the same as `bot.rainState`, but for thunderstorms.
This is the same as `bot.rainState`, but for thunderstorms.
For thunderstorms, both `bot.rainState` and `bot.thunderState` will change.

#### bot.chatPatterns
Expand Down Expand Up @@ -888,8 +890,8 @@ This value is of type BigInt and is accurate even at very large values. (more th

The total numbers of ticks since day 0.

Because the Number limit of Javascript is at 2^51 - 1 bot.time.time becomes inaccurate higher than this limit and the use of bot.time.bigTime is recommended.
Realistically though you'll probably never need to use bot.time.bigTime as it will only reach 2^51 - 1 ticks naturally after ~14280821 real years.
Because the Number limit of Javascript is at 2^51 - 1 bot.time.time becomes inaccurate higher than this limit and the use of bot.time.bigTime is recommended.
Realistically though you'll probably never need to use bot.time.bigTime as it will only reach 2^51 - 1 ticks naturally after ~14280821 real years.

#### bot.time.timeOfDay

Expand Down Expand Up @@ -927,8 +929,8 @@ This value is of type BigInt and is accurate even at very large values. (more th

Age of the world, in ticks.

Because the Number limit of Javascript is at 2^51 - 1 bot.time.age becomes inaccurate higher than this limit and the use of bot.time.bigAge is recommended.
Realistically though you'll probably never need to use bot.time.bigAge as it will only reach 2^51 - 1 ticks naturally after ~14280821 real years.
Because the Number limit of Javascript is at 2^51 - 1 bot.time.age becomes inaccurate higher than this limit and the use of bot.time.bigAge is recommended.
Realistically though you'll probably never need to use bot.time.bigAge as it will only reach 2^51 - 1 ticks naturally after ~14280821 real years.

#### bot.quickBarSlot

Expand Down Expand Up @@ -1090,6 +1092,10 @@ Fires when your hp or food change.

Fires when your oxygen level change.

#### "entityAttributes" (entity)

Fires when an attribute of an entity changes.

#### "entitySwingArm" (entity)
#### "entityHurt" (entity)
#### "entityDead" (entity)
Expand Down Expand Up @@ -1544,6 +1550,15 @@ Returns true if a control state is toggled.

Sets all controls to off.

#### bot.getExplosionDamages(entity, position, radius, [rawDamages])

Returns how much damage will be done to the entity in a radius around the position of the explosion.

* `entity` - Entity instance
* `position` - [Vec3](https://github.com/andrewrk/node-vec3) instance
* `radius` - the explosion radius as a number
* `rawDamages` - optional, if true it ignores armor in the calculation

#### bot.lookAt(point, [force], [callback])

This function also returns a `Promise`, with `void` as its argument upon completion.
Expand Down Expand Up @@ -1626,7 +1641,7 @@ dig any other blocks until the block has been broken, or you call

* `block` - the block to start digging into
* `forceLook` - (optional) if true, look at the block and start mining instantly. If false, the bot will slowly turn to the block to mine. Additionally, this can be assigned to 'ignore' to prevent the bot from moving it's head at all.
* `digFace` - (optional) Default is 'auto' looks at the center of the block and mines the top face. Can also be a vec3 vector
* `digFace` - (optional) Default is 'auto' looks at the center of the block and mines the top face. Can also be a vec3 vector
of the face the bot should be looking at when digging the block. For example: ```vec3(0, 1, 0)``` when mining the top. Can also be 'raycast' raycast checks if there is a face visible by the bot and mines that face. Useful for servers with anti cheat.
* `callback(err)` - (optional) called when the block is broken or you
are interrupted.
Expand All @@ -1636,11 +1651,11 @@ dig any other blocks until the block has been broken, or you call
#### bot.digTime(block)

Tells you how long it will take to dig the block, in milliseconds.

#### bot.acceptResourcePack()

Accepts resource pack.

#### bot.denyResourcePack()

Denies resource pack.
Expand Down
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ interface BotEvents {
entitySpawn: (entity: Entity) => void
itemDrop: (entity: Entity) => void
playerCollect: (collector: Entity, collected: Entity) => void
entityAttributes: (entity: Entity) => void
entityGone: (entity: Entity) => void
entityMoved: (entity: Entity) => void
entityDetach: (entity: Entity, vehicle: Entity) => void
Expand Down

0 comments on commit 037c643

Please sign in to comment.