API reference / @jsprismarine/java-packs / convert
convert
Interfaces
BedrockResourcePack
Defined in: convert.ts:33
One Bedrock resource pack: its files by their path inside it.
Properties
files
readonlyfiles:ReadonlyMap<string,Uint8Array<ArrayBufferLike>>
Defined in: convert.ts:36
name
readonlyname:string
Defined in: convert.ts:35
The pack's name, from its manifest, for the description and the report.
ConversionNote
Defined in: convert.ts:133
One note of the report.
Properties
outcome
readonlyoutcome:ConversionOutcome
Defined in: convert.ts:136
path
readonlypath:string
Defined in: convert.ts:135
A path in the pack, or a sound event's name.
reason
readonlyreason:string
Defined in: convert.ts:137
ConvertedJavaPack
Defined in: convert.ts:162
A converted pack.
Properties
files
readonlyfiles:ReadonlyMap<string,Uint8Array<ArrayBufferLike>>
Defined in: convert.ts:164
The Java pack's files by path, in path order, ready for writeZip.
report
readonlyreport: readonlyPackConversionReport[]
Defined in: convert.ts:171
Per Bedrock pack, in stack order, top first.
textures
readonlytextures:ReadonlyMap<string,string>
Defined in: convert.ts:169
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
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
readonlyblock:string
Defined in: convert.ts:98
The vanilla block, such as minecraft:note_block.
states
readonlystates: readonlyJavaCustomBlockState[]
Defined in: convert.ts:99
JavaCustomBlockState
Defined in: convert.ts:70
A custom block state drawn on a borrowed vanilla state.
Properties
geometry?
readonlyoptionalgeometry?:string
Defined in: convert.ts:82
The Bedrock geometry it draws, such as geometry.lamp; a full cube when absent.
hiddenBones?
readonlyoptionalhiddenBones?: readonlystring[]
Defined in: convert.ts:84
The geometry's bones the state hides, as its bone_visibility says.
materials
readonlymaterials:Readonly<Record<string,string>>
Defined in: convert.ts:80
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
readonlymodel:string
Defined in: convert.ts:74
The block model it draws, such as loopback:block/lamp.
rotation?
readonlyoptionalrotation?: readonly [number,number,number]
Defined in: convert.ts:86
The rotation its minecraft:transformation turns it by, in degrees about x, y and z.
rotationPivot?
readonlyoptionalrotationPivot?: readonly [number,number,number]
Defined in: convert.ts:88
Where that rotation turns about, from the block's center, in blocks.
variant
readonlyvariant:string
Defined in: convert.ts:72
The borrowed state, as a blockstates variant spells it: instrument=bass,note=3,powered=true.
JavaCustomItem
Defined in: convert.ts:51
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?
readonlyoptionalblock?:string
Defined in: convert.ts:60
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?
readonlyoptionalicon?:string
Defined in: convert.ts:55
The icon's short name in textures/item_texture.json, as the item's minecraft:icon gives it.
model
readonlymodel:string
Defined in: convert.ts:53
The model key the stack's minecraft:item_model names, such as loopback:lamp.
JavaPackContent
Defined in: convert.ts:103
What a conversion draws besides the packs' own assets.
Properties
blocks?
readonlyoptionalblocks?: readonlyJavaBorrowedBlock[]
Defined in: convert.ts:107
The vanilla blocks custom blocks borrow states of, each drawn by a blockstates/ override.
items?
readonlyoptionalitems?: readonlyJavaCustomItem[]
Defined in: convert.ts:105
The custom items, each of which gets an item model drawn from its icon.
JavaPackMetadata
Defined in: convert.ts:111
How a converted pack names itself in the client's pack list.
Properties
description?
readonlyoptionaldescription?:string
Defined in: convert.ts:116
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?
readonlyoptionalicon?:Uint8Array<ArrayBufferLike>
Defined in: convert.ts:118
The PNG the pack list shows; by default the highest pack_icon.png in the stack.
JavaPackTarget
Defined in: convert.ts:40
The Java release a conversion is for.
Properties
format
readonlyformat: readonly [number,number]
Defined in: convert.ts:44
The resource pack format its client reads, [major, minor], which pack.mcmeta declares.
release
readonlyrelease:string
Defined in: convert.ts:42
The release id, such as 26.3.
PackConversionReport
Defined in: convert.ts:141
What one Bedrock pack gave the Java pack.
Properties
converted
readonlyconverted:object
Defined in: convert.ts:144
How many of each kind of asset converted.
animations
readonlyanimations:number
blocks
readonlyblocks:number
Custom block models drawn from textures the pack holds.
glyphSheets
readonlyglyphSheets:number
items
readonlyitems:number
Custom items whose icon the pack holds, each drawn by a model.
languages
readonlylanguages:number
sounds
readonlysounds:number
textures
readonlytextures:number
vanillaOverrides
readonlyvanillaOverrides:number
Java's own textures a vanilla Bedrock texture of the pack retextures.
notes
readonlynotes: readonlyConversionNote[]
Defined in: convert.ts:158
Everything else, in path order.
pack
readonlypack:string
Defined in: convert.ts:142
Type Aliases
ConversionOutcome
ConversionOutcome =
"lossy"|"deferred"|"unsupported"|"unreadable"
Defined in: convert.ts:122
What happened to something a pack holds that did not convert as it is.
CubeFace
CubeFace = typeof
CUBE_FACES[number]
Defined in: convert.ts:67
One of CUBE_FACES.
Variables
CUBE_FACES
constCUBE_FACES: readonly ["up","down","north","south","east","west"]
Defined in: convert.ts:64
The six faces of a cube, as Bedrock's material instances and Java's cube model name them.
JAVA_PACK_CONVERTER_VERSION
constJAVA_PACK_CONVERTER_VERSION:5=5
Defined in: convert.ts:30
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
Defined in: convert.ts:380
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[]
Every pack, top first.
target
The Java release.
content
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
The pack, whose report holds a row for each pack of the stack.
convertResourcePacks()
convertResourcePacks(
stack,target,content?,metadata?):ConvertedJavaPack
Defined in: convert.ts:312
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[]
The packs, top first.
target
The Java release.
content?
JavaPackContent = {}
The custom items and blocks the pack draws, which a server that sends one pack per addon draws in convertCustomContent's pack instead.
metadata?
JavaPackMetadata = {}
How the pack names itself in the pack list.
Returns
javaTexturesOf()
javaTexturesOf(
stack):Map<string,string>
Defined in: convert.ts:355
The Java texture each Bedrock texture of a stack becomes, as 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[]
The packs, top first.
Returns
Map<string, string>
realVariantsOf()
realVariantsOf(
pool):Record<string,unknown>
Defined in: convert.ts:811
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.