forked from feather-rs/feather
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentity.py
More file actions
31 lines (25 loc) · 1.17 KB
/
entity.py
File metadata and controls
31 lines (25 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import common
data = common.load_minecraft_json("entities.json", "1.16.2")
entities = []
ids = {}
internal_ids = {}
names = {}
display_names = {}
bboxes = {}
for entity in data:
variant = common.camel_case(entity['name'])
entities.append(variant)
ids[variant] = entity['id']
internal_ids[variant] = entity['internalId']
names[variant] = entity['name']
display_names[variant] = entity['displayName']
width = entity['width']
height = entity['height']
bboxes[variant] = f"vek::Aabb {{ min: vek::Vec3::zero(), max: vek::Vec3::new({width} as f64, {height} as f64, {width} as f64), }}"
output = common.generate_enum("EntityKind", entities)
output += common.generate_enum_property("EntityKind", "id", "u32", ids, True)
output += common.generate_enum_property("EntityKind", "internal_id", "u32", internal_ids, True)
output += common.generate_enum_property("EntityKind", "name", "&str", names, True, "&'static str")
output += common.generate_enum_property("EntityKind", "display_name", "&str", display_names, True, "&'static str")
output += common.generate_enum_property("EntityKind", "bounding_box", "vek::Aabb<f64>", bboxes)
common.output("src/entity.rs", output)