promotional bannermobile promotional banner

Midnight Thoughts: XP Bonus

An addon for Midnight Thoughts that pays out a small amount of experience for the day that just ended, shows it on the Midnight Thoughts morning summary panel, and writes it to the chat.

Midnight Thoughts: XP Bonus

An addon for Midnight Thoughts that pays out a small amount of experience for the day that just ended, shows it on the Midnight Thoughts morning summary panel, and writes it to the chat.

  • Mod id: midnight_thoughts_xp_gift
  • Author: Plume Jade
  • Minecraft / loader: 1.21.1 / NeoForge 21.1.238
  • Optional dependency: Midnight Thoughts 1.4.2+ — without it this mod stays completely inert

Features

Daily experience rewards

The rewards are settled at the exact moment Midnight Thoughts settles its own "since last sleep" statistics, i.e. when a player sleeps through the night and wakes up in the morning. The data covers everything that happened since the previous sleep.

Reward Rule (default) Config key
Travel reward every 64 blocks travelled → 10 XP blocks_per_distance_exp, distance_exp
Hunt reward every 10 monsters killed → 30 XP kills_per_hunt_exp, hunt_exp
Early bird reward a flat bonus for having slept base_bonus (16)
  • The travelled distance counts every way of moving (walking, sprinting, swimming, flying, riding, being pushed around, ...); it is accumulated from the player's actual position each tick.
  • The amount of slain monsters is read from the vanilla minecraft.mob_kills statistic, so it counts every non-player entity the player killed (hostile monsters as well as animals) — the same counter vanilla uses for the Monster Hunter advancement.
  • The settled experience is granted to the player with Player#giveExperiencePoints.

Morning summary panel entry

Midnight Thoughts' morning summary panel gets one extra entry:

  • Icon: the addon's own experience orb sprite (midnight_thoughts_xp_gift:textures/gui/experience_orb.png, a single 16x16 sprite). The vanilla minecraft:textures/entity/experience_orb.png is deliberately not used: it is a 64x64 sprite sheet holding sixteen 16x16 animation frames, so blitting it as one icon would sample the whole sheet instead of one orb.
  • Label: 经验奖励 (XP Bonus in English)
  • Value: the total experience that was granted for the night
  • Style: identical to the vanilla statistic badges (theme aware badge background and text colour, same roll up animation), drawn as a full width row directly below the six statistic badges

The entry is added with a Mixin into mt.client.ui.summary.PlayerRowRenderer, so it also appears next to the name of any other player on the panel.

Chat summary

After waking up the player receives a chat message:

早安!这是你昨日的冒险总结:
旅途奖励 → X 点经验
猎魔奖励 → X 点经验
早起奖励 → X 点经验
——————————
共获得 X 点经验!

The title is green (§a), the reward lines are gray (§7) and the separator plus the total are aqua (§b). All lines are translatable (midnight_thoughts_xp_gift.message.*) with Chinese fallbacks, so a language file can reword them.


Configuring the thresholds with a data pack

Put a JSON file into data/<your_namespace>/midnight_thoughts_xp_gift/, for example data/mypack/midnight_thoughts_xp_gift/rewards.json:

{
  "blocks_per_distance_exp": 64,
  "distance_exp": 10,
  "kills_per_hunt_exp": 10,
  "hunt_exp": 30,
  "base_bonus": 16
}

Every field is optional — missing fields keep the default shown above. The file shipped by the mod lives at data/midnight_thoughts_xp_gift/midnight_thoughts_xp_gift/rewards.json, so a data pack with a higher priority simply overrides the values it wants to change. Data packs are applied on world load and on /reload.


Requirements

Mod Mod id Built against Required?
Minecraft / NeoForge - 1.21.1 / 21.1.238 Yes
Midnight Thoughts midnightthoughts 1.4.2+ Optional

Midnight Thoughts is declared as an optional mod dependency and this addon guards its Mixins with required: false, so it can be installed with or without Midnight Thoughts present. Without Midnight Thoughts, the addon stays completely inert.


Links

Midnight Thoughts: XP Bonus Team

profile avatar
  • 12
    Projects
  • 3.2K
    Downloads

More from HeartRate75Ott123View all