Skip to main content

Comfort system

The mod introduces a comfort system that affects sleep quality. When a player goes to bed, their rest level after waking depends on the comfort level around the bed.

Comfort is influenced by nearby elements such as furniture, plants in pots, glass, carpets, and lanterns. Some blocks increase comfort, while others decrease it.

The whole system is configured in one block:

"comfort": {
"enabled": true,
"scanRadius": 5,
"weights": {
"lighting": 1,
"carpet": 1,
"furniture": 1,
"decoration": 1,
"structure": 1,
"macabre": -1,
"hostile": -1,
"dark": -1
},
"nightmareThreshold": -1,
"sleepBlockThreshold": -2,
"nightmareEnabled": true,
"sleepBlockEnabled": true
}
ParameterDefaultDescription
enabledtrueSet to false to switch the comfort system off entirely
scanRadius5How many blocks around the bed are scanned, 0–8
weightssee belowHow much each category contributes
nightmareThreshold-1Comfort at or below this triggers nightmares
sleepBlockThreshold-2Comfort at or below this prevents sleep entirely
nightmareEnabledtrueSet to false to never trigger nightmares
sleepBlockEnabledtrueSet to false to always allow sleeping, however grim the room
tip

A bigger scanRadius means a larger area is checked, which makes high comfort easier to reach — a lantern three rooms away still counts. Lowering it to 2 or 3 forces players to build a genuinely cosy bedroom rather than a cosy house.


Comfort tags

You can extend the comfort system using data packs by adding blocks to special tags.

Place your tag files in:

data/midnightthoughts/tags/block/

Each file must contain a JSON list of blocks:

{
"replace": false,
"values": [
"minecraft:example_block"
]
}

Setting "replace": false ensures that new blocks are added without overriding the default ones. Tags in Minecraft are used to group blocks together through datapacks and mods.


How comfort is scored

Each category is checked once. Either at least one matching block was found within the scan radius, or none was — a room with twenty lanterns scores exactly the same as a room with one.

Every category that was found adds its weight from the config. The sum is the comfort level.

TagConfig weightDefault
comfort_lightingweights.lighting+1
comfort_carpetweights.carpet+1
comfort_furnitureweights.furniture+1
comfort_decorationweights.decoration+1
comfort_structureweights.structure+1
comfort_negative_macabreweights.macabre-1
comfort_negative_hostileweights.hostile-1
comfort_negative_darkweights.dark-1

With the default weights that gives a range from -3 to +5. The positive result becomes the Well Rested level, so all five positive categories present means level 5.

Designing your own balance

Weights are the main balancing lever. Making structure worth 2 rewards enclosed bedrooms; making dark worth -3 turns an unlit room into an automatic nightmare no matter what furniture is in it. Any weight can be negative or positive, from -100 to 100.


Nightmares and blocked sleep

Two thresholds are checked against the final comfort level:

ConditionResult
comfort ≤ sleepBlockThresholdThe player cannot sleep at all and is told why
comfort ≤ nightmareThresholdThe player sleeps, but gets a nightmare
otherwiseA normal night

With the defaults (-1 and -2) that works out as:

ComfortOutcome
+1 and aboveNormal sleep, Rested effect at that level
0Normal sleep, no Rested effect
-1Nightmare
-2 and belowCannot sleep
warning

The sleep block is checked first. If comfort is low enough to hit both thresholds, the player simply cannot go to bed — there is no nightmare, because there is no sleep.

note

Both behaviours can be turned off independently. "nightmareEnabled": false keeps the comfort scoring but never shows nightmares; "sleepBlockEnabled": false lets players sleep anywhere while still getting nightmares in bad places.


Checking comfort in-game

Rather than guessing which category is missing, ask the mod:

/midnightthoughts comfort

It prints every category, whether it was found, the weight it contributed, the total, and how that total compares to both thresholds. Operators can also check another player with /midnightthoughts comfort <name>. See commands.


Full block list

{
"replace": false,
"values": [
"minecraft:torch",
"minecraft:wall_torch",
"minecraft:soul_torch",
"minecraft:soul_wall_torch",
"minecraft:lantern",
"minecraft:soul_lantern",
"minecraft:glowstone",
"minecraft:sea_lantern",
"minecraft:redstone_lamp",
"minecraft:shroomlight",
"minecraft:end_rod",
"minecraft:candle",
"minecraft:white_candle",
"minecraft:orange_candle",
"minecraft:magenta_candle",
"minecraft:light_blue_candle",
"minecraft:yellow_candle",
"minecraft:lime_candle",
"minecraft:pink_candle",
"minecraft:gray_candle",
"minecraft:light_gray_candle",
"minecraft:cyan_candle",
"minecraft:purple_candle",
"minecraft:blue_candle",
"minecraft:brown_candle",
"minecraft:green_candle",
"minecraft:red_candle",
"minecraft:black_candle"
]
}