# Mob to Egg

An egg thrown at a mob has a small chance to turn the mob into its spawn egg: the mob vanishes and the egg drops where it stood. A gamble for collectors: the default chance is 0.1 percent, one hit in a thousand. The module ships **switched off**.

## How it works

- When an egg hits a mob, the server rolls the configured chance. On success the mob disappears in a puff of smoke with a sound, and its spawn egg drops there (or goes to the thrower's inventory, see `delivery`). The thrower gets a chat line. That egg does not hatch a chicken on top.
- Only the chance per hit counts; the egg is used up as always, whether it works or not.
- Never converted: players, armor stands, mobs without a spawn egg, the bosses in `blocked-mobs`, tamed animals (the owner may catch their own pet when `allow-tamed` allows it, other players' pets never) and name-tagged mobs (can be allowed in the config), and mobs someone is riding. Mobs spawned from spawn eggs count like spawner mobs for the jobs module.
- Claims stay protected: an animal inside somebody else's claim counts like an attack on it. Without build trust there, it cannot be caught (with the claim module active and `PreventTheft`). The same rule applies to animals inside WorldGuard regions and GriefPrevention claims: no build rights there, no catch; owners and trusted members can still catch their animals.
- Permission `mobtoegg.use` (default: everyone). Without it a hit does nothing special.
- Every setting including `enabled` applies after `/coreengine reload`; no restart needed.

> **Tip:** For events, raise the chance temporarily (say `5`) and lower it again with a reload afterwards.

## Configuration (modules/mobtoegg.yml)

```yaml
# Enables or disables mob to egg.
enabled: false

mobtoegg:
  # Chance in percent for every egg that hits a mob. 0.1 is one hit in a
  # thousand, 0 switches the effect off, 100 catches every mob.
  chance: 0.1
  # Mobs that never turn into an egg, by entity type name. Bosses by default.
  blocked-mobs:
    - ENDER_DRAGON
    - WITHER
    - WARDEN
    - ELDER_GUARDIAN
  # Pets (tamed animals) and mobs wearing a name tag are left alone unless
  # these are true. Even then only the owner can catch their own pet.
  allow-tamed: false
  allow-named: false
  # Where the spawn egg goes: drop = it falls where the mob stood,
  # inventory = it goes to the thrower (and drops at their feet when full).
  delivery: drop
  # Puff of smoke and a sound where the mob vanished. Any Minecraft sound key
  # works (minecraft: prefix optional); volume 0.0 to 1.0, pitch 0.5 to 2.0.
  particles: true
  sound: "entity.experience_orb.pickup"
  volume: 1.0
  pitch: 0.8
  # blacklist = works everywhere except the listed worlds,
  # whitelist = only in the listed worlds.
  world-mode: blacklist
  # World names used by world-mode.
  worlds: []
```

## Complete example config

```yaml
enabled: true

mobtoegg:
  chance: 0.5
  blocked-mobs: [ENDER_DRAGON, WITHER, WARDEN, ELDER_GUARDIAN, VILLAGER]
  allow-tamed: false
  allow-named: true
  delivery: inventory
  particles: true
  sound: "entity.player.levelup"
  volume: 0.8
  pitch: 1.2
  world-mode: whitelist
  worlds: ["world", "resource"]
```
