Skip to content

Gamesetting Module

npm versionDownloadsInstall sizenpmBuild Status

Provide function to parse Minecraft game settings

Usage

Parse GameSetting (options.txt)

Serialize/Deserialize the minecraft game setting string.

ts
import { GameSetting } from '@xmcl/gamesetting'
const settingString;
const setting: GameSetting = GameSetting.parse(settingString);
const string: string = GameSetting.stringify(setting);

🏳️ Enums

🏭 Functions

getDefaultFrame

ts
getDefaultFrame(): FullFrame

Get the default values in options.txt.

Return Type

  • FullFrame

Defined in: packages/gamesetting/index.ts:278

parse

ts
parse(str: string, strict: boolean): GameSetting | Frame

Parse raw game setting options.txt content

Parameters

  • str: string the options.txt content
  • strict: boolean strictly follow the current version of options format (outdate version might cause problem. If your options.txt is new one with new fields, don't turn on this)

Return Type

  • GameSetting | Frame

Defined in: packages/gamesetting/index.ts:346

stringify

ts
stringify(setting: any, original: string, eol: string= '\n'): string

Generate text format game setting for options.txt file.

Parameters

  • setting: any The game setting object

  • original: string

  • eol: string The end of line character, default is \n

Return Type

  • string

Defined in: packages/gamesetting/index.ts:410

🏷️ Variables

Graphics

ts
Graphics: Readonly<Object> = ...

Defined in: packages/gamesetting/index.ts:30

RenderClouds

ts
RenderClouds: Readonly<Object> = ...

Defined in: packages/gamesetting/index.ts:32

RenderDistances

ts
RenderDistances: Readonly<Object> = ...

Defined in: packages/gamesetting/index.ts:29

⏩ Type Aliases

Frame

ts
Frame: Partial<FullFrame>

Defined in: packages/gamesetting/index.ts:273

FullFrame

ts
FullFrame: typeof DEFAULT_FRAME

Defined in: packages/gamesetting/index.ts:272

GameSetting

ts
GameSetting: ReturnType<typeof getDefaultFrame>

Defined in: packages/gamesetting/index.ts:429

Graphic

ts
Graphic: boolean

Defined in: packages/gamesetting/index.ts:31

HotKeys

ts
HotKeys: "attack" | "use" | "forward" | "left" | "back" | "right" | "jump" | "sneak" | "sprint" | "drop" | "inventory" | "chat" | "playerlist" | "pickItem" | "command" | "screenshot" | "togglePerspective" | "smoothCamera" | "fullscreen" | "spectatorOutlines" | "swapHands" | "saveToolbarActivator" | "loadToolbarActivator" | "advancements" | "hotbar.1" | "hotbar.2" | "hotbar.3" | "hotbar.4" | "hotbar.5" | "hotbar.6" | "hotbar.7" | "hotbar.8" | "hotbar.9"

Defined in: packages/gamesetting/index.ts:306

MipmapLevel

ts
MipmapLevel: 0 | 1 | 2 | 3 | 4

Defined in: packages/gamesetting/index.ts:27

ModelPart

ts
ModelPart: "cape" | "jacket" | "left_sleeve" | "right_sleeve" | "left_pants_leg" | "right_pants_leg" | "hat"

Defined in: packages/gamesetting/index.ts:285

RenderCloud

ts
RenderCloud: boolean | "fast"

Defined in: packages/gamesetting/index.ts:33

RenderDistance

ts
RenderDistance: 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32

Defined in: packages/gamesetting/index.ts:28

SoundCategories

ts
SoundCategories: "master" | "music" | "record" | "weather" | "block" | "hostile" | "neutral" | "player" | "ambient" | "voice"

Defined in: packages/gamesetting/index.ts:294

Released under the MIT License.