[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/prismarine](https://jsprismarine.dev/api/@jsprismarine/prismarine/index.md) / entity/PortalContact

# entity/PortalContact

## Classes

- [PortalContact](https://jsprismarine.dev/api/@jsprismarine/prismarine/entity/PortalContact/classes/PortalContact.md)

## Variables

### PORTAL\_COOLDOWN\_TICKS

> `const` **PORTAL\_COOLDOWN\_TICKS**: `object`

Defined in: [packages/prismarine/src/entity/PortalContact.ts:33](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/PortalContact.ts#L33)

How long an entity refuses portals after a dimension change.

Java's `Entity.getDimensionChangingDelay` is 300 ticks, and `Player` and `VehicleEntity`
return 10 instead, so a mob waits fifteen seconds and a player half a second. An entity a
player rides in front of takes the player's delay: see [dimensionChangingDelayOf](#dimensionchangingdelayof).

#### Type Declaration

##### entity

> `readonly` **entity**: `300` = `300`

Fifteen seconds, which is what Bedrock writes to `PortalCooldown` on arrival.

##### player

> `readonly` **player**: `10` = `10`

Half a second, long enough to step out of the arrival portal.

#### Java Source

Entity.getDimensionChangingDelay

***

### PORTAL\_TRANSITION\_TICKS

> `const` **PORTAL\_TRANSITION\_TICKS**: `object`

Defined in: [packages/prismarine/src/entity/PortalContact.ts:15](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/PortalContact.ts#L15)

How many consecutive ticks inside a nether portal a traveler waits before it goes through.

Java's `NetherPortalBlock.getPortalTransitionTime` returns 0 for anything that is not a player
and, for a player, the `players_nether_portal_default_delay` game rule (80) or
`players_nether_portal_creative_delay` (0) when the player is in creative. Bedrock's "one tick
in creative" is the same thing seen from the client.

#### Type Declaration

##### creative

> `readonly` **creative**: `0` = `0`

A creative player: goes through on the first contact tick.

##### other

> `readonly` **other**: `0` = `0`

An item, a mob, a projectile: goes through on the first contact tick.

##### player

> `readonly` **player**: `80` = `80`

A player in survival, adventure or spectator mode: four seconds.

#### Java Source

NetherPortalBlock.getPortalTransitionTime

## Functions

### dimensionChangingDelayOf()

> **dimensionChangingDelayOf**(`traveler`): `number`

Defined in: [packages/prismarine/src/entity/PortalContact.ts:50](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/PortalContact.ts#L50)

How long an entity that is not a player refuses portals after a dimension change: a boat, a
raft or a minecart, Java's `VehicleEntity`, and an entity whose first rider is a player wait a
player's half second, and anything else fifteen seconds.

#### Parameters

##### traveler

Whether the entity is a boat, a raft or a minecart, and whether a player
  rides it in front.

###### playerInFront

`boolean`

###### vehicle

`boolean`

#### Returns

`number`

#### Java See

VehicleEntity.getDimensionChangingDelay

#### Java See

Entity.getDimensionChangingDelay

***

### portalCooldownOf()

> **portalCooldownOf**(`ticks`): `number`

Defined in: [packages/prismarine/src/entity/PortalContact.ts:57](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/PortalContact.ts#L57)

A portal cooldown as it is held: whole ticks, never below zero.

#### Parameters

##### ticks

`number`

#### Returns

`number`
