Core Mechanics - TDHunterrr/Farlands-Lifesteal GitHub Wiki

⚔️ Core Mechanics

Farlands Lifesteal turns every player encounter into a strategic gamble. Below is the full technical breakdown of health calculation, death logic, bans, and invulnerability.


🩸 Health System

Metric Value In-Game HP
Default Health 10 Hearts 20.0 HP
Minimum Health 0 Hearts 0.0 HP (Eliminated)
Maximum Health Cap 20 Hearts 40.0 HP
Health Per Heart 1 Heart 2.0 HP
  • Health Attribute: Max health is stored in the player's vanilla generic.max_health attribute base value.
  • Persistence: Health adjustments persist across dimension switching, death/respawn, and server restarts.

💀 Death & Heart Loss

When a player dies (regardless of damage source—PvP, mobs, fall damage, or void):

  1. Health Reduction: Their base max health is reduced by 1 heart (2.0 HP).
  2. Item Drop: A physical Heart item is dropped at the death coordinates.
  3. Pickup Protection: Dropped hearts have a 40-tick (2-second) pickup delay, ensuring the killer or nearby players don't instantly vacuum it without noticing.
  4. Respawn Health: Upon respawning, the player respawns with their new maximum health.

🚫 Elimination & Banning

When a player loses their final heart and reaches 0 max health:

  1. Their generic.max_health attribute is set to 0.0.
  2. An entry is created in the server's official User Ban List (banned-players.json):
    • Reason: "You ran out of hearts!"
    • Source: "Lifesteal"
  3. A personalized Revive Token bound to the eliminated player drops at their death coordinates.
  4. The server disconnects the player with a red kick screen:
    "You lost all your hearts and have been banned!"

🛡️ Spawn & Join Protection

To prevent spawn-camping and trap abuse:

  • Any player rejoining after a revival or login receives Resistance V (100% damage immunity) for 10 seconds (200 ticks).
  • Dynamic Packet Detection:
    • The server records the player's initial join coordinates.
    • The moment the player moves (handleMovePlayer packet), the invulnerability effect is instantly stripped.
    • This guarantees that protected players cannot attack or reposition while immune.