Parrot¶
Parrots in Better Ecology have enhanced behaviors including mimicking hostile mob sounds, dancing to music, detecting music sources, and advanced perching.
Overview¶
| Attribute | Value |
|---|---|
| Health | 6 HP (3 hearts) |
| Tameable | Yes |
| Can Fly | Yes |
| Shoulder Perching | Yes (tamed only) |
Behaviors¶
Mimicking System¶
Implementation: MimicBehavior, ParrotMimicGoal
Parrots mimic hostile mob sounds as a warning system for players.
Base Accuracy: 55-95% (varies by individual parrot)
Mimic Types:
| Mob Type | Sound Event | Rarity |
|---|---|---|
| Zombie | PARROT_IMITATE_ZOMBIE | Common |
| Skeleton | PARROT_IMITATE_SKELETON | Common |
| Spider | PARROT_IMITATE_SPIDER | Common |
| Creeper | PARROT_IMITATE_CREEPER | Uncommon |
| Enderman | PARROT_IMITATE_ENDERMAN | Rare |
| Witch | PARROT_IMITATE_WITCH | Rare |
| Wither Skeleton | PARROT_IMITATE_WITHER_SKELETON | Rare |
| Ravager | PARROT_IMITATE_RAVAGER | Rare |
| Phantom | PARROT_IMITATE_PHANTOM | Rare |
| Hoglin | PARROT_IMITATE_HOGLIN | Rare |
| Piglin | PARROT_IMITATE_PIGLIN | Rare |
| Vindicator | PARROT_IMITATE_VINDICATOR | Rare |
Warning System: - Triggered when hostile mob is within 32 blocks - 80% chance to perform a warning mimic - Accuracy increases by 15% for warnings - Shorter cooldown (100 ticks vs 200 ticks)
Configuration:
{
"mimic": {
"base_accuracy": 0.75,
"accuracy_variation": 0.2,
"mimic_chance": 0.05,
"warning_range": 32.0,
"warning_chance": 0.8
}
}
Dancing Behavior¶
Implementation: DanceBehavior, ParrotMusicGoal
Parrots dance to music with different styles based on the music disc playing.
Dance Styles by Music Disc:
| Disc | Dance Style | Description |
|---|---|---|
| 13, cat | BOUNCE | Rhythmic jumping every 10 ticks |
| blocks, chirp | SPIN | 45-degree rotations every 5 ticks |
| far, mall | WIGGLE | Rapid small movements and head shaking |
| mellohi, stal | HEAD_BOB | Vertical bobbing motion |
| strad, ward | WING_FLAP | Frequent jumping with rotations |
| 11, wait | PARTY | Energetic bouncing and spinning |
| otherside, 5, pigstep, relic | RAVE | Fast spinning with strobe jumping |
| pigstep | DISCO | Smooth rhythmic movements |
Dance Mechanics:
| Style | Behavior |
|---|---|
| BOUNCE | Jump every 10 ticks with slight rotation changes |
| SPIN | Rotate 45 degrees every 5 ticks |
| WIGGLE | Rapid 15-degree rotations and forward/back movement |
| HEAD_BOB | Jump every 8 ticks with head angle changes |
| WING_FLAP | Jump every 6 ticks with 30-degree rotations |
| PARTY | Jump every 5 ticks with random spins |
| RAVE | Spin 30 degrees per tick with strobe jumping |
| DISCO | Smooth sine-wave bobbing and rotation |
Party Effect: - Other parrots within 16 blocks have 30% chance to join - Dancing parrots emit note particles - All parrots dance in sync
Configuration:
{
"dance": {
"show_particles": true,
"enable_party_effect": true,
"party_radius": 16.0,
"party_join_chance": 0.3
}
}
Music Detection¶
Implementation: MusicDetectionBehavior
Parrots detect and respond to music sources.
Detection Range: 64 blocks (configurable)
Music Sources: - Jukeboxes (detects any playing disc) - Note blocks (remembers plays for 5 seconds)
Behavior Sequence: 1. Parrot detects music within range 2. Determines dance style from the disc 3. Flies toward music source at 1.2x speed 4. Perches nearby (within 6 blocks) 5. Starts dancing with appropriate style
Configuration:
Flight and Perching¶
Implementation: PerchBehavior, ParrotPerchGoal
Parrots seek high perches and can ride on player shoulders.
Perch Preferences: - High perches: 5+ blocks above minimum build height - Isolation: Avoid perches near threats (cats, foxes, wolves, ocelots) - Tree coverage: Bonus score for leaf blocks - Block preferences: Fences and logs get bonus points
Perch Scoring Formula:
Score = (height * height_bonus)
- (distance * distance_penalty)
+ (leaf_bonus if leaves)
+ (preferred_block_bonus if preferred block)
- (threat_penalty / threat_distance)
Shoulder Perching: - Only tamed parrots can perch on shoulders - 3-block detection range - Uses vanilla shoulder riding system - Can be spooked off by nearby threats
Flight Patterns:
| Type | Speed | Purpose |
|---|---|---|
| Short bursts | Normal | Direct flight to target perch |
| Gliding | 0.8x | Safe descent to ground |
| Music flights | 1.2x | Flying toward music sources |
Perch Duration: - Maximum: 1200 ticks (60 seconds) - Random adjustment movements every 40 ticks - Leave immediately if threatened
Configuration:
{
"perch": {
"search_radius": 32,
"prefer_high_perches": true,
"min_perch_height": 5,
"spook_radius": 8.0,
"max_perch_ticks": 1200
}
}
Behavior Priorities¶
The ParrotBehaviorGoal orchestrates behaviors in priority order:
| Priority | Behavior | Condition |
|---|---|---|
| 1 (highest) | Shoulder Perching | If riding a player |
| 2 | Dancing | If music is playing and parrot has arrived |
| 3 | Flying to Music | If music detected within range |
| 4 | Perching | If currently on a perch |
| 5 | Flying to Perch | Seeking a new perch |
| 6 | Idle | Random wandering |
Integration¶
Note Block Integration¶
- Mixin intercepts note block plays
- Notifies all parrots within 64 blocks
- Parrots remember note block location and time
- Allows dancing to player-created music
Performance¶
Optimization Strategies¶
- Reduced scanning: Music detection only every 60 ticks
- Early exits: Skip processing if condition not met
- Cached lookups: Component data cached per tick
- Spatial indexing: Uses existing SpatialIndex for neighbor queries
Memory Usage¶
- Component tags store minimal state
- No persistent entity references
- Efficient NBT storage for mimics and perches
Scientific Basis¶
Mimicry¶
Based on real-world parrot ability to mimic sounds. African Grey Parrots can learn 100+ words, and alarm calls warn flock members of predators.
Dancing¶
Based on research into birds responding to music. Cockatoos bob to beats (documented in Snowball the cockatoo), and parrots have an innate sense of rhythm.
Perching¶
Based on wild parrot behavior, including preference for high perches for predator detection and sleeping in roosting flocks for safety.
Troubleshooting¶
Parrots Not Dancing¶
- Check if jukebox has a disc inserted
- Verify parrot is within 64 blocks
- Ensure parrot is not on player's shoulder
- Check that music behavior is enabled
Parrots Not Mimicking¶
- Verify hostile mobs are nearby for warning mimics
- Check mimic cooldown (200 ticks between random mimics)
- Individual parrots have varying accuracy (55-95%)
Parrots Not Perching¶
- Check if parrot is tamed for shoulder perching
- Verify suitable perches exist within 32 blocks
- Parrots may be spooked by nearby threats