Skip to content

Instantly share code, notes, and snippets.

View Kas-tle's full-sized avatar
💭
Working on it...

Kas-tle

💭
Working on it...
  • Oakland
View GitHub Profile
@Kas-tle
Kas-tle / bedrock_model.jsonc
Last active December 29, 2020 06:54
Java to Bedrock JQ Mappings
// mappings reference java_model.json below
// note that 2 in the UV mapping multiplcation is derived from dividing .texture_size[0] by 16 for x and .texture_size[1] by 16 for y
{
"format_version": "1.12.0", // arbitrary
"minecraft:geometry": [{
"description": {
"identifier": "geometry.geometry.armor_stand", // arbitrary
"texture_width": 32, // '.texture_size[0]'
"texture_height": 32, // '.texture_size[1]'
@Kas-tle
Kas-tle / converter.sh
Last active December 3, 2023 11:04
Java to Bedrock 3D Model Converter
#!/usr/bin/env bash
: ${1?'Please specify an input resource pack in the same directory as the script (e.g. ./converter.sh MyResourcePack.zip)'}
# ensure input pack exists
if ! test -f "${1}"; then
echo "Input resource pack ${1} is not in this directory"
echo "Please ensure you have entered the filename correctly"
exit 1
else
printf "\e[33m[•]\e[m \e[37mInput file ${1} detected\e[m\n"
@Kas-tle
Kas-tle / converter.sh
Last active December 3, 2023 11:05
Java to Bedrock 3D Model Converter 1.1
#!/usr/bin/env bash
: ${1?'Please specify an input resource pack in the same directory as the script (e.g. ./converter.sh MyResourcePack.zip)'}
# define color placeholders
C_RED='\e[31m'
C_GREEN='\e[32m'
C_YELLOW='\e[33m'
C_BLUE='\e[36m'
C_GRAY='\e[37m'
C_CLOSE='\e[m'
@Kas-tle
Kas-tle / merge.sh
Last active January 22, 2023 02:45
Merge GeyserOptionalPack With Existing Resource Pack
: ${1?'Please specify an input resource pack in the same directory as the script (e.g. ./merge.sh MyResourcePack.zip)'}
# ensure jq is installed
if command jq --version 2>/dev/null | grep -q "1.6"; then
printf "\e[32m[+]\e[m \e[37mDependency jq satisfied\e[m\n"
echo
else
echo "Dependency jq-1.6 is not satisfied"
echo "You must install jq-1.6 before proceeding"
echo "See https://stedolan.github.io/jq/download/"
#XYZ -> ZYX
# Make pi available as constant
def pi: 1 | atan *4;
# Convert degrees to radians
def deg2rad($deg): $deg*(pi/180);
# Convert radians to degrees
def rad2deg($rad): $rad*(180/pi);
@Kas-tle
Kas-tle / book_head.sh
Created December 20, 2021 07:13
Minecraft Book Head Generator
#!/usr/bin/env bash
: ${1?'Please specify a player name (e.g. ./book_head.sh _Kastle)'}
# Config
title='My Cool Title'
author='_Kastle'
# Get player UUID
uuid=$(curl -s https://api.mojang.com/users/profiles/minecraft/${1} | jq -r .id)
{
"format_version": "1.10.0",
"particle_effect": {
"description": {
"identifier": "geyseropt:test_particle",
"basic_render_parameters": {
"material": "particles_alpha",
"texture": "textures/blocks/wool_colored_white"
}
},
@Kas-tle
Kas-tle / atlas_group.jq
Last active July 26, 2022 05:39
JQ Texture Atlas Grouper
def intersects(a;b): any(a[]; . as $x | any(b[]; . == $x));
def mapatlas(set):
(set | unique) as $unique_set
| (map(if intersects(.; $unique_set) then . else empty end) | add + $unique_set | unique) as $new_set
| map(if intersects(.; $new_set) then empty else . end) + [$new_set];
reduce .[] as $entry ([]; mapatlas($entry))
# | to_entries | .[]? | select(any(.value[]; . == "red")) | .key
@Kas-tle
Kas-tle / path_cleaner.jq
Created July 27, 2022 16:36
Clean path for model
def cleanpath(inp):
inp
| split("/")
| del(.[0:2], .[3])
| .[-1] = (.[-1] | split(".") | del(.[-1]) | reduce .[] as $item (""; . + ($item) + ".") | .[:-1])
| reduce .[] as $item (""; . + ($item) + "/")
| .[:-1]
;
cleanpath(.)
@Kas-tle
Kas-tle / mappings.json
Last active July 28, 2022 21:07
Slimefun Item Mappings
{
"PORTABLE_DUSTBIN": {
"type": "HeadTexture",
"slimefun_item": "PORTABLE_DUSTBIN",
"head_enum": "TRASH_CAN",
"head_texture": "32d41042ce99147cc38cac9e46741576e7ee791283e6fac8d3292cae2935f1f",
"category": "usefulItems"
},
"ENDER_BACKPACK": {
"type": "HeadTexture",