78 lines
2.8 KiB
Python
78 lines
2.8 KiB
Python
"""Minecraft 26.3 entity registry data and legacy mob selectors."""
|
|
from mosfet.info import items, mcdata
|
|
|
|
MOBS = {
|
|
'minecraft:' + name: dict(entity, protocol_id=entity['id'])
|
|
for name, entity in mcdata.mcd.entities.items()
|
|
}
|
|
VILLAGER = MOBS['minecraft:villager']['protocol_id']
|
|
|
|
# Villager profession enum values remain the protocol's 0-based profession IDs.
|
|
ARMORER = 1
|
|
BUTCHER = 2
|
|
CARTOGRAPHER = 3
|
|
CLERIC = 4
|
|
FARMER = 5
|
|
FISHERMAN = 6
|
|
FLETCHER = 7
|
|
LEATHERWORKER = 8
|
|
LIBRARIAN = 9
|
|
MASON = 10
|
|
NITWIT = 11
|
|
SHEPHERD = 12
|
|
TOOLSMITH = 13
|
|
WEAPONSMITH = 14
|
|
|
|
TRADES = {
|
|
ARMORER: [items.IRON_INGOT_ID],
|
|
BUTCHER: [items.BERRIES_ID],
|
|
FARMER: [items.PUMPKIN_ID, items.WHEAT_ID, items.POTATO_ID,
|
|
items.CARROT_ID, items.BEETROOT_ID],
|
|
TOOLSMITH: [items.IRON_INGOT_ID],
|
|
WEAPONSMITH: [items.IRON_INGOT_ID],
|
|
}
|
|
|
|
EVIL = [
|
|
'blaze', 'cave_spider', 'creeper', 'drowned', 'elder_guardian',
|
|
'ender_dragon', 'enderman', 'endermite', 'evoker', 'ghast', 'giant',
|
|
'guardian', 'hoglin', 'husk', 'illusioner', 'magma_cube', 'phantom',
|
|
'piglin', 'piglin_brute', 'pillager', 'ravager', 'shulker', 'silverfish',
|
|
'skeleton', 'skeleton_horse', 'slime', 'spider', 'stray', 'vex',
|
|
'vindicator', 'witch', 'wither', 'zoglin', 'zombie', 'zombie_villager',
|
|
]
|
|
EVIL_IDS = {
|
|
MOBS['minecraft:' + name]['protocol_id']
|
|
for name in EVIL if 'minecraft:' + name in MOBS
|
|
}
|
|
MOB_NAMES = {entity['protocol_id']: name.removeprefix('minecraft:')
|
|
for name, entity in MOBS.items()}
|
|
|
|
# Entity registry entries that are not living mobs and cannot be valid melee
|
|
# targets (projectiles can otherwise remain in the entity map after launch).
|
|
_BOAT_TYPES = (
|
|
'acacia', 'bamboo', 'birch', 'cherry', 'dark_oak', 'jungle',
|
|
'mangrove', 'oak', 'pale_oak', 'poplar', 'spruce',
|
|
)
|
|
NON_MOB_ENTITY_NAMES = {
|
|
*(name + suffix for name in _BOAT_TYPES
|
|
for suffix in ('_boat', '_chest_boat')),
|
|
'bamboo_raft', 'bamboo_chest_raft',
|
|
'area_effect_cloud', 'armor_stand', 'arrow', 'block_display',
|
|
'breeze_wind_charge', 'chest_minecart', 'command_block_minecart',
|
|
'dragon_fireball', 'egg', 'end_crystal', 'ender_pearl', 'evoker_fangs',
|
|
'experience_bottle', 'experience_orb', 'eye_of_ender', 'falling_block',
|
|
'fireball', 'firework_rocket', 'fishing_bobber', 'furnace_minecart',
|
|
'glow_item_frame', 'hopper_minecart', 'interaction', 'item',
|
|
'item_display', 'item_frame', 'leash_knot', 'lightning_bolt',
|
|
'lingering_potion', 'llama_spit', 'mannequin', 'marker', 'minecart',
|
|
'ominous_item_spawner', 'painting', 'player', 'shulker_bullet',
|
|
'small_fireball', 'snowball', 'spawner_minecart', 'spectral_arrow',
|
|
'splash_potion', 'text_display', 'tnt', 'tnt_minecart', 'trident',
|
|
'wind_charge', 'wither_skull',
|
|
}
|
|
NON_MOB_ENTITY_IDS = {
|
|
MOBS['minecraft:' + name]['protocol_id']
|
|
for name in NON_MOB_ENTITY_NAMES
|
|
if 'minecraft:' + name in MOBS
|
|
}
|