Описание
# DifficultyEx
> **“Because the game shouldn’t get easier just because *you* got better.”**
**DifficultyEx** is a **Fabric 1.20.1** dynamic difficulty system built around **PlayerEx: Director’s Cut** and **Data Attributes: Director’s Cut**.
Instead of every zombie, skeleton, or custom boss feeling identical in every world, DifficultyEx assigns each mob its own **level**, then scales its **health, damage, armor, and XP rewards** based on:
- The **PlayerEx level** of nearby players
- The **dimension** it’s in
- The **biome** it’s in
- The **structure** it’s near
- Optional **per-entity overrides** and **blacklists**
On top of that, it adds **configurable RPG-style mob nameplates** that show level and health above mobs’ heads, with support for both vanilla and Geckolib-rendered entities and optional integration with **[Traveler’s Titles](https://modrinth.com/mod/travelers-titles)**.
---
## 🔹 Short Summary
> **DifficultyEx** adds configurable, level-based mob scaling tied to **[PlayerEx](https://modrinth.com/mod/playerex-directors-cut)**, with biome/dimension/structure rules, XP/damage/armor/health scaling, and RPG-style mob nameplates.
---
## ✨ Core Features
### 🔧 Level-based mob scaling
Every time a **mob** is loaded into the world, DifficultyEx:
1. Looks at all **nearby players** in a configurable radius.
2. Reads their **PlayerEx level**.
3. Runs those levels through a **configurable formula** (`x` by default, via Crunch/exp4j).
4. Averages the result and applies a small random adjustment.
5. Clamps the final mob level using:
- Global max & min
- Dimension-specific min/max
- Biome-specific min/max
- Structure-specific min/max (nearest configured structure)
- Per-entity min/max rules (by ID or regex)
---
### 📈 Scaled stats (health, damage, armor, XP)
Using mixins on vanilla logic, DifficultyEx scales several stats **per mob level** using configurable percentages:
- **Health** – mobs gain more max HP per level
- **Damage** – mobs hit harder per level
- **Armor** – mobs get tougher to damage per level
- **XP reward** – killing higher-level mobs gives more XP
All of these are controlled under **`scalingLevelSettings`** in the config:
- `entityBaseHealthPercentage`
- `entityBaseDamagePercentage`
- `entityBaseArmorPercentage`
- `entityExperiencePercentage`
There’s also:
- `entityStartingLevels` – per-entity starting level (by ID/regex)
- `entityMaximumLevels` – per-entity max level (by ID/regex)
- `mobBlacklist` – entities that **should never be scaled**
---
### 🌍 Dimension, biome & structure rules
DifficultyEx lets you shape **where** things are dangerous:
#### Per-dimension settings
`dimensionSettings`:
- `startingLevels["minecraft:overworld"]`
- `maximumLevels["minecraft:the_nether"]`, etc.
#### Per-biome settings
`biomeScalingSettings`:
- `startingLevels["minecraft:soul_sand_valley"]`
- `maximumLevels["minecraft:deep_dark"]`
#### Per-structure settings
`structureScalingSettings`:
- `radius` – how far a structure affects mobs around it
- `startingLevels["minecraft:ancient_city"]`
- `maximumLevels["minecraft:ancient_city"]`
The mod uses the **nearest configured structure** within the configured radius to clamp mob level, so you can make, for example:
- **Tiered dungeons** with higher minimum levels
- Specific structures that **cap** level to avoid absurd values
- Dimension/biome “bands” (safe overworld, brutal nether, etc.)
---
### 👁️ RPG-style mob nameplates
DifficultyEx includes a full **nameplate system** rendered through mixins into:
- Vanilla **`MobRenderer`**
- Geckolib’s **`GeoEntityRenderer` / `GeoReplacedEntityRenderer`**
Features (all configurable):
- Toggleable **nameplates**
- **Level text**, via `text.nameplate.level` (e.g. `Lv. 24`)
- Optional **health bar**
- Optional **health text** (current / max HP)
- Customizable:
- Render distance
- Show **hostile mobs only** toggle
- Y-offset above the mob’s head
- Scale
- Text color
- Background color
- Per-mob **nameplate blacklist**
These options live under `client_settings.visualSettings` in the config.
---
### 🧭 Traveler’s Titles integration (optional)
If **Traveler’s Titles** is installed, DifficultyEx adds a small compatibility layer:
- When the biome title is updated, DifficultyEx sends a packet to the server.
- The server calculates a level (based on your current environment & config).
- The client updates the Traveler’s Titles **biome title** to include a level string (e.g. a “Zone Level” style display).
This is fully optional; if Traveler’s Titles is absent, the compat mixins simply never apply.
---
## ⚙️ Configuration
DifficultyEx uses **owo-config** with a generated config class:
- File: `config/difficultyex-config.json5`
- Mod Menu integration (`@Modmenu`) gives you a UI if Mod Menu is installed.
### `global_settings.dimensionSettings`
Map from **dimension ID** to:
- `startingLevels`
- `maximumLevels`
Example:
```json5
"dimensionSettings": {
"minecraft:overworld": {
"startingLevels": 1,
"maximumLevels": 50
},
"minecraft:the_nether": {
"startingLevels": 10,
"maximumLevels": 80
}
}