[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/java-packs](https://jsprismarine.dev/api/@jsprismarine/java-packs/index.md) / convert

# convert

## Interfaces

### BedrockResourcePack

Defined in: [convert.ts:33](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L33)

One Bedrock resource pack: its files by their path inside it.

#### Properties

##### files

> `readonly` **files**: `ReadonlyMap`\<`string`, `Uint8Array`\<`ArrayBufferLike`\>\>

Defined in: [convert.ts:36](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L36)

##### name

> `readonly` **name**: `string`

Defined in: [convert.ts:35](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L35)

The pack's name, from its manifest, for the description and the report.

***

### ConversionNote

Defined in: [convert.ts:133](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L133)

One note of the report.

#### Properties

##### outcome

> `readonly` **outcome**: [`ConversionOutcome`](#conversionoutcome)

Defined in: [convert.ts:136](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L136)

##### path

> `readonly` **path**: `string`

Defined in: [convert.ts:135](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L135)

A path in the pack, or a sound event's name.

##### reason

> `readonly` **reason**: `string`

Defined in: [convert.ts:137](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L137)

***

### ConvertedJavaPack

Defined in: [convert.ts:162](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L162)

A converted pack.

#### Properties

##### files

> `readonly` **files**: `ReadonlyMap`\<`string`, `Uint8Array`\<`ArrayBufferLike`\>\>

Defined in: [convert.ts:164](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L164)

The Java pack's files by path, in path order, ready for `writeZip`.

##### report

> `readonly` **report**: readonly [`PackConversionReport`](#packconversionreport)[]

Defined in: [convert.ts:171](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L171)

Per Bedrock pack, in stack order, top first.

##### textures

> `readonly` **textures**: `ReadonlyMap`\<`string`, `string`\>

Defined in: [convert.ts:169](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L169)

The Java texture each Bedrock texture became, by its Bedrock path without an extension:
`textures/blocks/stone` is `bedrock:blocks/stone`. A model a later step writes names these.

***

### JavaBorrowedBlock

Defined in: [convert.ts:96](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L96)

A vanilla block whose states custom blocks borrow, one of BORROWED\_BLOCKS: the pack's
`blockstates/` file for it draws each borrowed state as its custom block, and the states real
blocks are sent as with vanilla's models.

#### Properties

##### block

> `readonly` **block**: `string`

Defined in: [convert.ts:98](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L98)

The vanilla block, such as `minecraft:note_block`.

##### states

> `readonly` **states**: readonly [`JavaCustomBlockState`](#javacustomblockstate)[]

Defined in: [convert.ts:99](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L99)

***

### JavaCustomBlockState

Defined in: [convert.ts:70](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L70)

A custom block state drawn on a borrowed vanilla state.

#### Properties

##### geometry?

> `readonly` `optional` **geometry?**: `string`

Defined in: [convert.ts:82](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L82)

The Bedrock geometry it draws, such as `geometry.lamp`; a full cube when absent.

##### hiddenBones?

> `readonly` `optional` **hiddenBones?**: readonly `string`[]

Defined in: [convert.ts:84](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L84)

The geometry's bones the state hides, as its `bone_visibility` says.

##### materials

> `readonly` **materials**: `Readonly`\<`Record`\<`string`, `string`\>\>

Defined in: [convert.ts:80](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L80)

The texture short name in `textures/terrain_texture.json` each material instance draws, by
its name, with `*` for every instance the state does not name. A cube's faces are the
instances named after them; a geometry's faces name their own.

##### model

> `readonly` **model**: `string`

Defined in: [convert.ts:74](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L74)

The block model it draws, such as `loopback:block/lamp`.

##### rotation?

> `readonly` `optional` **rotation?**: readonly \[`number`, `number`, `number`\]

Defined in: [convert.ts:86](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L86)

The rotation its `minecraft:transformation` turns it by, in degrees about x, y and z.

##### rotationPivot?

> `readonly` `optional` **rotationPivot?**: readonly \[`number`, `number`, `number`\]

Defined in: [convert.ts:88](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L88)

Where that rotation turns about, from the block's center, in blocks.

##### variant

> `readonly` **variant**: `string`

Defined in: [convert.ts:72](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L72)

The borrowed state, as a blockstates variant spells it: `instrument=bass,note=3,powered=true`.

***

### JavaCustomItem

Defined in: [convert.ts:51](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L51)

A custom item the server sends Java clients as a vanilla base item that names its own model, and
which the pack draws.

#### Properties

##### block?

> `readonly` `optional` **block?**: `string`

Defined in: [convert.ts:60](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L60)

A block model the item draws as instead, such as `loopback:block/lamp`, for a block's item
with no icon of its own. An icon wins over it.

##### icon?

> `readonly` `optional` **icon?**: `string`

Defined in: [convert.ts:55](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L55)

The icon's short name in `textures/item_texture.json`, as the item's `minecraft:icon` gives it.

##### model

> `readonly` **model**: `string`

Defined in: [convert.ts:53](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L53)

The model key the stack's `minecraft:item_model` names, such as `loopback:lamp`.

***

### JavaPackContent

Defined in: [convert.ts:103](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L103)

What a conversion draws besides the packs' own assets.

#### Properties

##### blocks?

> `readonly` `optional` **blocks?**: readonly [`JavaBorrowedBlock`](#javaborrowedblock)[]

Defined in: [convert.ts:107](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L107)

The vanilla blocks custom blocks borrow states of, each drawn by a `blockstates/` override.

##### items?

> `readonly` `optional` **items?**: readonly [`JavaCustomItem`](#javacustomitem)[]

Defined in: [convert.ts:105](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L105)

The custom items, each of which gets an item model drawn from its icon.

***

### JavaPackMetadata

Defined in: [convert.ts:111](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L111)

How a converted pack names itself in the client's pack list.

#### Properties

##### description?

> `readonly` `optional` **description?**: `string`

Defined in: [convert.ts:116](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L116)

The description `pack.mcmeta` gives, which the pack list shows. By default the top pack's
manifest name, then its manifest description on a second line.

##### icon?

> `readonly` `optional` **icon?**: `Uint8Array`\<`ArrayBufferLike`\>

Defined in: [convert.ts:118](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L118)

The PNG the pack list shows; by default the highest `pack_icon.png` in the stack.

***

### JavaPackTarget

Defined in: [convert.ts:40](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L40)

The Java release a conversion is for.

#### Properties

##### format

> `readonly` **format**: readonly \[`number`, `number`\]

Defined in: [convert.ts:44](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L44)

The resource pack format its client reads, `[major, minor]`, which `pack.mcmeta` declares.

##### release

> `readonly` **release**: `string`

Defined in: [convert.ts:42](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L42)

The release id, such as `26.3`.

***

### PackConversionReport

Defined in: [convert.ts:141](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L141)

What one Bedrock pack gave the Java pack.

#### Properties

##### converted

> `readonly` **converted**: `object`

Defined in: [convert.ts:144](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L144)

How many of each kind of asset converted.

###### animations

> `readonly` **animations**: `number`

###### blocks

> `readonly` **blocks**: `number`

Custom block models drawn from textures the pack holds.

###### glyphSheets

> `readonly` **glyphSheets**: `number`

###### items

> `readonly` **items**: `number`

Custom items whose icon the pack holds, each drawn by a model.

###### languages

> `readonly` **languages**: `number`

###### sounds

> `readonly` **sounds**: `number`

###### textures

> `readonly` **textures**: `number`

###### vanillaOverrides

> `readonly` **vanillaOverrides**: `number`

Java's own textures a vanilla Bedrock texture of the pack retextures.

##### notes

> `readonly` **notes**: readonly [`ConversionNote`](#conversionnote)[]

Defined in: [convert.ts:158](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L158)

Everything else, in path order.

##### pack

> `readonly` **pack**: `string`

Defined in: [convert.ts:142](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L142)

## Type Aliases

### ConversionOutcome

> **ConversionOutcome** = `"lossy"` \| `"deferred"` \| `"unsupported"` \| `"unreadable"`

Defined in: [convert.ts:122](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L122)

What happened to something a pack holds that did not convert as it is.

***

### CubeFace

> **CubeFace** = *typeof* [`CUBE_FACES`](#cube-faces)\[`number`\]

Defined in: [convert.ts:67](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L67)

One of [CUBE\_FACES](#cube-faces).

## Variables

### CUBE\_FACES

> `const` **CUBE\_FACES**: readonly \[`"up"`, `"down"`, `"north"`, `"south"`, `"east"`, `"west"`\]

Defined in: [convert.ts:64](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L64)

The six faces of a cube, as Bedrock's material instances and Java's cube model name them.

***

### JAVA\_PACK\_CONVERTER\_VERSION

> `const` **JAVA\_PACK\_CONVERTER\_VERSION**: `5` = `5`

Defined in: [convert.ts:30](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L30)

The version of what the conversion writes. It goes up whenever the same stack would convert to
other files, so a cache keyed by it never hands out a pack an older converter wrote.

## Functions

### convertCustomContent()

> **convertCustomContent**(`stack`, `target`, `content`, `description?`): [`ConvertedJavaPack`](#convertedjavapack)

Defined in: [convert.ts:380](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L380)

Converts what custom content draws into one pack of its own, for a server that sends one Java
pack per addon: each custom item's definition and model, each borrowed block's `blockstates/`
file and model, the atlas entries for textures they draw from outside the folders the addons'
packs stitch, and every pack's translations, a higher pack's winning, so an addon's pack is
needed only for what it draws. The models name textures the addons' own packs hold, which Java
resolves across every loaded pack, and the stack resolves texture short names as Bedrock would.

#### Parameters

##### stack

readonly [`BedrockResourcePack`](#bedrockresourcepack)[]

Every pack, top first.

##### target

[`JavaPackTarget`](#javapacktarget)

The Java release.

##### content

[`JavaPackContent`](#javapackcontent)

The custom items and blocks.

##### description?

`string` = `"Custom items, blocks and translations from the server's addons"`

What the pack list says the pack is.

#### Returns

[`ConvertedJavaPack`](#convertedjavapack)

The pack, whose report holds a row for each pack of the stack.

***

### convertResourcePacks()

> **convertResourcePacks**(`stack`, `target`, `content?`, `metadata?`): [`ConvertedJavaPack`](#convertedjavapack)

Defined in: [convert.ts:312](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L312)

Converts a stack of Bedrock resource packs, top first, into one Java resource pack for a release.
A file the stack holds more than once comes from the highest pack that holds it, as Bedrock
resolves it, and so does a language key, a sound event and an item texture name.

#### Parameters

##### stack

readonly [`BedrockResourcePack`](#bedrockresourcepack)[]

The packs, top first.

##### target

[`JavaPackTarget`](#javapacktarget)

The Java release.

##### content?

[`JavaPackContent`](#javapackcontent) = `{}`

The custom items and blocks the pack draws, which a server that sends one pack
  per addon draws in [convertCustomContent](#convertcustomcontent)'s pack instead.

##### metadata?

[`JavaPackMetadata`](#javapackmetadata) = `{}`

How the pack names itself in the pack list.

#### Returns

[`ConvertedJavaPack`](#convertedjavapack)

***

### javaTexturesOf()

> **javaTexturesOf**(`stack`): `Map`\<`string`, `string`\>

Defined in: [convert.ts:355](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L355)

The Java texture each Bedrock texture of a stack becomes, as [convertResourcePacks](#convertresourcepacks) names
it, read from the packs' file names alone, so a pack converted on its own, or read back from a
cache, can be drawn from by another.

#### Parameters

##### stack

readonly [`BedrockResourcePack`](#bedrockresourcepack)[]

The packs, top first.

#### Returns

`Map`\<`string`, `string`\>

***

### realVariantsOf()

> **realVariantsOf**(`pool`): `Record`\<`string`, `unknown`\>

Defined in: [convert.ts:811](https://github.com/JSPrismarine/JSPrismarine/blob/21088b69d7b227110b98eefd29702ff7304762ef/packages/java-packs/src/convert.ts#L811)

The variants a borrowed block's real blocks draw with: vanilla's own, each spelled out with the
values BorrowedBlockPool.real fixes, so no lent state matches one.

#### Parameters

##### pool

`BorrowedBlockPool`

The borrowed block.

#### Returns

`Record`\<`string`, `unknown`\>

Each variant's vanilla model entry, by its full spelling.
