Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add short_grass #101

Merged
merged 4 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ src/include/fmt/format.h
src/include/fmt/format-inl.h
src/include/fmt/color.h
src/include/fmt/format.cc
extracted_blocks/

# Tools byproducts
.gdb_history
Expand Down
37 changes: 35 additions & 2 deletions scripts/average.sh
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although this is a good idea, the implementation of this script will make it harder to run on non-mac platforms. I will rework it to keep all of the code but make it more modular.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,39 @@

set -eo pipefail

install_imagemagick() {
if ! command -v convert &>/dev/null; then
if [[ "${UNAME}" == "Darwin" ]] && command -v brew &>/dev/null; then
brew install imagemagick
fi
fi
}

unpack_minecraft_jar() {
if [[ -z "${MINECRAFT_VER}" ]]; then
return
fi

if [[ -f "extracted_blocks/${MINECRAFT_VER}/assets/minecraft/textures/block/dirt.png" ]]; then
return
fi

if [[ "${UNAME}" == "Darwin" ]]; then
jar_file="${HOME}/Library/Application Support/minecraft/versions/${MINECRAFT_VER}/${MINECRAFT_VER}.jar"
fi

if [[ -n "${jar_file}" ]]; then
mkdir -p "extracted_blocks/${MINECRAFT_VER}"
pushd "extracted_blocks/${MINECRAFT_VER}"
jar xf "${jar_file}" assets/minecraft/textures/block
popd
fi
}

install_imagemagick
unpack_minecraft_jar

printf '%s\t%s\n' \
"$(basename "${1}")" \
"$(convert "${1}" -resize 1x1 txt:- | grep -Po "#[[:xdigit:]]{6}" | tr A-F a-f)"
"$(basename "extracted_blocks/${MINECRAFT_VER}/assets/minecraft/textures/block/${1}.png")" \
"$(convert "extracted_blocks/${MINECRAFT_VER}/assets/minecraft/textures/block/${1}.png" -resize 1x1 txt:- \
| grep -o "#[[:xdigit:]]\{6\}" | tr A-F a-f)"
1 change: 1 addition & 0 deletions src/colors.json
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,7 @@
"minecraft:sea_lantern": "#90b8ad",
"minecraft:sea_pickle": { "color": "#4e531dfe", "type": "Head" },
"minecraft:seagrass": { "color": "#389306fe", "type": "UnderwaterPlant" },
"minecraft:short_grass": { "color": "#426539fe", "type": "Plant" },
"minecraft:shroomlight": "#f2974c",
"minecraft:shulker_box": "#8535c3",
"minecraft:skeleton_skull": { "color": "#969696fe", "type": "Head" },
Expand Down
Loading