Represents the game rules for a world experience.

Example

debugEnvironment.ts

import { world } from "@minecraft/server";

world.gameRules.doDayLightCycle = false;
world.gameRules.doEntityDrops = false;
world.gameRules.doFireTick = false;
world.gameRules.doWeatherCycle = false;
world.gameRules.doMobSpawning = false;
world.gameRules.showCoordinates = true;
world.gameRules.showDaysPlayed = true;
world.gameRules.keepInventory = true;

Example

disableDamages.ts

import { world } from "@minecraft/server";

world.gameRules.drowningDamage = false;
world.gameRules.fallDamage = false;
world.gameRules.fireDamage = false;
world.gameRules.freezeDamage = false;
world.gameRules.pvp = false;

Hierarchy

  • GameRules

Constructors

Properties

commandBlockOutput: boolean

Remarks

This property can't be edited in read-only mode.

commandBlocksEnabled: boolean

Remarks

This property can't be edited in read-only mode.

doDayLightCycle: boolean

Remarks

This property can't be edited in read-only mode.

doEntityDrops: boolean

Remarks

This property can't be edited in read-only mode.

doFireTick: boolean

Remarks

This property can't be edited in read-only mode.

doImmediateRespawn: boolean

Remarks

This property can't be edited in read-only mode.

doInsomnia: boolean

Remarks

This property can't be edited in read-only mode.

doLimitedCrafting: boolean

Remarks

This property can't be edited in read-only mode.

doMobLoot: boolean

Remarks

This property can't be edited in read-only mode.

doMobSpawning: boolean

Remarks

This property can't be edited in read-only mode.

doTileDrops: boolean

Remarks

This property can't be edited in read-only mode.

doWeatherCycle: boolean

Remarks

This property can't be edited in read-only mode.

drowningDamage: boolean

Remarks

This property can't be edited in read-only mode.

fallDamage: boolean

Remarks

This property can't be edited in read-only mode.

fireDamage: boolean

Remarks

This property can't be edited in read-only mode.

freezeDamage: boolean

Remarks

This property can't be edited in read-only mode.

functionCommandLimit: number

Remarks

This property can't be edited in read-only mode.

keepInventory: boolean

Remarks

This property can't be edited in read-only mode.

maxCommandChainLength: number

Remarks

This property can't be edited in read-only mode.

mobGriefing: boolean

Remarks

This property can't be edited in read-only mode.

naturalRegeneration: boolean

Remarks

This property can't be edited in read-only mode.

playersSleepingPercentage: number

Remarks

This property can't be edited in read-only mode.

projectilesCanBreakBlocks: boolean

Remarks

This property can't be edited in read-only mode.

pvp: boolean

Remarks

This property can't be edited in read-only mode.

randomTickSpeed: number

Remarks

This property can't be edited in read-only mode.

recipesUnlock: boolean

Remarks

This property can't be edited in read-only mode.

respawnBlocksExplode: boolean

Remarks

This property can't be edited in read-only mode.

sendCommandFeedback: boolean

Remarks

This property can't be edited in read-only mode.

showBorderEffect: boolean

Remarks

This property can't be edited in read-only mode.

showCoordinates: boolean

Remarks

This property can't be edited in read-only mode.

showDaysPlayed: boolean

Remarks

This property can't be edited in read-only mode.

showDeathMessages: boolean

Remarks

This property can't be edited in read-only mode.

showRecipeMessages: boolean

Remarks

This property can't be edited in read-only mode.

showTags: boolean

Remarks

This property can't be edited in read-only mode.

spawnRadius: number

Remarks

This property can't be edited in read-only mode.

tntExplodes: boolean

Remarks

This property can't be edited in read-only mode.

tntExplosionDropDecay: boolean

Remarks

This property can't be edited in read-only mode.