Skip to content

26.2 Game Rule Presets and Controls

Rifa edited this page Aug 21, 2026 · 1 revision

๐ŸŽ›๏ธ Game Rule Presets & Controls

Parameter Specification
Preset Engine Class net.instantgratification.collapsiblegamerules.preset.GameRulePresetEngine
Preset Data Structure record Preset(String id, Component displayName, Map<String, Object> ruleValues)
Interactive Widgets IntegerSliderWidget, BooleanToggleWidget
Slider Helper net.instantgratification.collapsiblegamerules.util.GameRuleSliderHelper
Toggle On Color 0x4400FF00 (Emerald Green Background)
Toggle Off Color 0x44FF0000 (Ruby Red Background)
Built-in Presets builder ("๐Ÿฐ Builder Mode"), fast_play ("โšก Fast Play"), hardcore ("๐Ÿ’€ Hardcore Realism")

๐Ÿ“– Overview

Collapsible Game Rules includes interactive UI controls and built-in Game Rule presets, allowing players to configure complex world settings with single-click profiles or intuitive sliders instead of typing raw integer values into text boxes.


๐Ÿฐ Built-in Presets Matrix

The GameRulePresetEngine provides three pre-configured gameplay presets:

Preset ID Display Title Game Rule Configured Value Gameplay Impact
builder ๐Ÿฐ Builder Mode doDaylightCycle
doWeatherCycle
doMobSpawning
keepInventory
mobGriefing
doFireTick
false
false
false
true
false
false
Ideal for creative building: freezes sun/weather, stops mob spawns, disables creepers/fire spread.
fast_play โšก Fast Play randomTickSpeed
playersSleepingPercentage
keepInventory
10
0
true
Fast-paced survival: accelerates crop growth ($3\times$), allows single-player sleep skipping, keeps inventory.
hardcore ๐Ÿ’€ Hardcore Realism naturalRegeneration
doInsomnia
playersSleepingPercentage
false
true
100
Extreme survival: disables passive health regen (golden apples/potions required), enforces phantom spawns.

๐ŸŽš๏ธ Interactive Slider Widget (IntegerSliderWidget)

The IntegerSliderWidget replaces raw numeric text fields with draggable sliders for smooth integer adjustments.

Mathematical Normalization Formulas

When setting a slider position from an integer value $v$: $$\text{normalized} = \frac{\text{clamp}(v, \text{min}, \text{max}) - \text{min}}{\text{max} - \text{min}}$$

When computing the resulting integer value from the slider position $p \in [0.0, 1.0]$: $$\text{calculatedInt} = \text{min} + \text{round}\left(p \times (\text{max} - \text{min})\right)$$

Vanilla Game Rule Bounds (GameRuleSliderHelper)

GameRule Key Minimum ($\text{min}$) Maximum ($\text{max}$) Vanilla Default
randomTickSpeed 0 100 3
spawnRadius 0 32 10
playersSleepingPercentage 0 100 100
maxEntityCramming 0 100 24
maxCommandChainLength 0 65536 65536
commandModificationBlockLimit 0 65536 32768

๐Ÿ”˜ Boolean Toggle Widget (BooleanToggleWidget)

The BooleanToggleWidget provides instant visual feedback for binary rules:

  • State: TRUE (ON): Renders โœ” ON in ChatFormatting.GREEN over a green background fill (0x4400FF00).
  • State: FALSE (OFF): Renders โœ– OFF in ChatFormatting.RED over a red background fill (0x44FF0000).
  • Mouse Press: Single click toggles state and executes the consumer callback onToggle.accept(newState).
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         โœ” ON            โ”‚     โ”‚         โœ– OFF           โ”‚
โ”‚   (Green Tint 0x4400FF00)โ”‚     โ”‚   (Red Tint 0x44FF0000) โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”— Related Documentation

Clone this wiki locally