
Crystal Leveling - Dynamic Mob Difficulty System
This mod fundamentally changes the combat approach in Minecraft by implementing a progressive difficulty level system for all creatures in the game.
Every creature that appears in the world automatically receives a random difficulty level from 1 to 100. Based on this value, the mod enhances the mob's characteristics, making it a more dangerous opponent. Visually, the difficulty level is displayed using a colored crystal icon next to the creature's name, allowing for instant assessment of its threat level.
Depending on the difficulty level, mobs receive enhancements to:
- Maximum health
- Attack damage
- Armor rating
- Armor toughness
The crystal color coding ranges from green for weak creatures to multicolored for the most dangerous top-level opponents.
Example of difficulty progression (from lowest to highest):
For Developers
The mod adds a syncable difficulty_level
attribute (0–100) to all entities. Other modifications can use this value to create custom logic — for example, configuring loot drops, creating loot tiers, or applying special effects.
@Mod.EventBusSubscriber
public class CustomDropOnDeathWithTiers {
@SubscribeEvent
public static void onLivingDeath(net.minecraftforge.event.entity.living.LivingDeathEvent event) {
LivingEntity entity = event.getEntityLiving();
if (entity == null)
return;
// Reading difficulty level (default to 0 if missing)
double difficulty = 0;
if (entity.getAttributes().hasAttribute(CrystalLevelingModAttributes.DIFFICULTY_LEVEL.get())) {
difficulty = entity.getAttribute(CrystalLevelingModAttributes.DIFFICULTY_LEVEL.get()).getBaseValue();
}
// Determining tier and giving corresponding loot
if (difficulty >= 81) {
// Top tier (multicolored): very rare reward
entity.spawnAtLocation(new ItemStack(Items.NETHER_STAR), 0.0F);
} else if (difficulty >= 65) {
// Dark blue tier: rare reward
entity.spawnAtLocation(new ItemStack(Items.DIAMOND), 0.0F);
} else if (difficulty >= 49) {
// Light purple tier: uncommon reward
entity.spawnAtLocation(new ItemStack(Items.EMERALD), 0.0F);
} else if (difficulty >= 33) {
// Red tier: moderate reward
entity.spawnAtLocation(new ItemStack(Items.IRON_INGOT), 0.0F);
} else if (difficulty >= 17) {
// Yellow tier: common reward
entity.spawnAtLocation(new ItemStack(Items.GOLD_INGOT), 0.0F);
} else {
// Green tier: basic reward
entity.spawnAtLocation(new ItemStack(Items.APPLE), 0.0F);
}
}
}