-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocumentation.dok
More file actions
50 lines (33 loc) · 2.59 KB
/
Copy pathdocumentation.dok
File metadata and controls
50 lines (33 loc) · 2.59 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
~
"title": "mc_block_color_mapper",
"description": "Python scripts & libraries for generating and mapping the average colors for each of the Minecraft blocks"
~
@ What does mc_block_color_mapper do?
# What does mc_block_color_mapper do?
mc_block_color_mapper's a collection of Python scripts & libraries for generating and mapping the average colors for each of the Minecraft blocks which is perfect for certain projects for Minecraft related sites, AI projects, etc.! <br/>
The following documentation contains documentation for the scripts and library, with the `mapper_example.py` script acting as both a CLI version of the `blockmodel_avgs_generator.py` library and an example for how to use it!
@ Requirements
# Requirements
All of the Python requirements can be found in requirements.txt
which you can install like this: `pip install -r requirements.txt`
In order to run blockmodel_avgs_generator.py and generate your own `blockmodel_avgs.csv` to store the averages for your version of Minecraft you'll need to follow the steps in https://github.com/RandomGamingDev/minecraft-asset-extractor and drag the `extracted-data` directory into the same directory as the scripts.
@ Scripts
@@ blockmodel_avgs_generator.py
# blockmodel_avgs_generator.py
This generates `blockmodel_avgs.csv` from the `extracted-data` directory (you're told how to get it in **Requirements**) and needs to be called before everything else.
@@ mapper_example.py
# mapper_example.py
This is a script that uses the `blockmodel_avg_mapper.py` library and acts as a CLI for testing the dataset and library as well as an example for how to use it.
@ Libraries
@@ blockmodel_avg_mapper.py
# blockmodel_avgs_generator.py
## Variables
- **blockmodel_avgs**: dict<str, ndarray> = A dictionary containing all of the blocks by name and their corresponding average RGBA color as a numpy array.
## Functions
- **get_block_avg_color(blockname) -> ndarray**: This returns the average RGBA color for a block as a numpy array.
- **get_closest_colored_block(color) -> (closest: str, closest_avg: ndarray, distance: float)**: This returns one of the closest blocks by color average, its average, and distance. However, it only returns one, so if there are multiple with the exact difference in color, they'll be ignored.
- **get_blocks_of_color(color) -> list<str>**: This returns all of the blocks of a specific color.
@ Data
@@ blockmodel_avgs.csv
# blockmodel_avgs.csv
This gets generated by **blockmodel_avgs_generator.py** and contains data on the average color for each block in a block_name, r, g, b, a format for the columns, with each row being its own block.