Move effects out of cubi

This commit is contained in:
2026-11-05 22:37:41 -03:00
parent 0e2d8fdcac
commit 9bc8fd992a
17 changed files with 452 additions and 70 deletions
+8 -2
View File
@@ -48,7 +48,7 @@ showed. These events fire for **every** player's actions, since they all go thro
| `block_place` | ✓ | ✓ | `player`, `block` (`{ id, x, y, z }`), `face` clicked, `hit` where on it (0-1 each axis), `item` held |
| `block_interact` | ✓ | ✓ | `player`, `block`, `item` held. Before fires for every right click on a block, after only when a component's `on_interact` handled it |
| `chat_send` | ✓ | ✓ | `player`, `message`. Before handlers can change `message` |
| `player_damage` | ✓ | ✓ | `player`, `amount`, `cause`. Before handlers can change `amount`, after fires only when they were hurt, with what they took |
| `entity_damage` | ✓ | ✓ | `entity`, `player`, `amount`, `cause`, `bypasses_invulnerability`. See below |
| `player_death` | | ✓ | `player`, `cause`. They've dropped what they carried and respawn right after |
| `player_join` | | ✓ | `player` |
| `player_leave` | | ✓ | `player` |
@@ -56,7 +56,13 @@ showed. These events fire for **every** player's actions, since they all go thro
| `tick` | | ✓ | `dt`, in seconds. 20 times a second |
| `new_day` | | ✓ | `day`. At 06:00, after every block's `on_new_day` |
`cause` is `"fall"`, `"void"`, `"starve"`, or whatever a mod passed to `player.damage(amount, cause)`.
`cause` is `"fall"`, `"void"`, `"starve"`, `"mob_attack"`, or whatever a mod passed to `damage(amount, cause)`.
`entity_damage` fires whenever a player or a mob is hurt, like NeoForge's `LivingIncomingDamageEvent`. `entity` is a
[`LivingRef`](../entities/effects.md#effect-components), and `player` is set when it's a player. Before handlers can
change `amount` or cancel it. They run before the hurt cooldown, so what they leave is what's compared with the last
hit. `bypasses_invulnerability` is set for damage that nothing should stop, like falling out of the world. After fires
only when the entity was hurt, with the amount the before handlers left.
### Order