Skip to content

Instantly share code, notes, and snippets.

View tryashtar's full-sized avatar

tryashtar tryashtar

View GitHub Profile
@tryashtar
tryashtar / fonts.md
Last active October 27, 2022 09:37
Characters with special consideration in Minecraft fonts

The following characters have special behavior in Minecraft, and care should be taken when retexturing them in a custom font:

Unusable

  • \u0000: NULL �
    • This character cannot be included in a bitmap font, since it's used as a placeholder to skip certain cells of the texture grid.
  • \u000a: LINE FEED ⏎
    • This character can be retextured and appear in text that does not support multiple lines. In chat, it will be invisible and cause a line break.
  • \u00a7: SECTION SIGN §
    • This character is never displayed. It also prevents the next character from displaying, and activates legacy formatting.
@tryashtar
tryashtar / hasitem.md
Last active April 22, 2022 06:58
Attempting to check for empty hand with Bedrock's "hasitem" selector argument

Syntax Errors

hasitem={location=slot.weapon.mainhand}
hasitem={location=slot.weapon.mainhand,quantity=0}

  • Doesn't work: item must be specified

Air Item

hasitem={location=slot.weapon.mainhand,item=air}
hasitem={location=slot.weapon.mainhand,item=air,quantity=1..}

  • Doesn't work: doesn't find player with empty hand or with filled hand
@tryashtar
tryashtar / 8xp-parser.py
Last active August 14, 2023 14:20
Parse 8xp files (poorly)
import os
import bisect
import xmltodict
here = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(here, "tokens.xml"), "r", encoding="utf8") as token_file:
tokens = xmltodict.parse(token_file.read())
token_symbol = {}
@tryashtar
tryashtar / sora in smash.md
Created October 5, 2021 21:49
Sora in smash: my thoughts

Appearance

Idles

Sora has an idle animation of looking left, then right, then left again. This is straight out of his Kingdom Hearts 1 idle combat loop, and returns in Kingdom Hearts 2. He has a bit better posture in Smash Bros., but it's nice to see the return of this animation.

Another idle animation has Sora spin the keyblade in his off-hand, which is somewhat reminiscent of the Wisdom Form idle keyblade spin.

Another idle animation has Sora twirling the keyblade in front of himself. It resembles the beginning of the Tinker Bell summon animation from Kingdom Hearts 1.

All in all, pretty good idle animations! I most appreciate the first one.

@tryashtar
tryashtar / max-enchant.md
Last active April 7, 2022 21:25
Max effective values for enchantments
Beta 1.9 Prerelease 5

⚠️ Any NBT tag type other than short for an item's enchantment level crashes Minecraft. Therefore, no enchantment can have a level above 32767 or below -32768.

Enchantment Formula Effective Range
  • Protection
  • Fire Protection
  • Feather Falling
  • Blast Protection
  • Projectile Protection
Start a running total. For each enchant, add (level² + 6) / 2 if the enchant protects against the taken damage. For feather falling, add twice. Cap the total at 25. Add one, then divide by two. Now add a random number between 0 and the total. Cap the new total at 20. If the total is one or greater, set the new incoming damage equal to (damage * (25 - total)) / 25.

Since the level gets squared, negative levels behave as their absolute value.
0 to 7
  • Lower levels are identical to their absolute value
  • Higher levels are identical to 7
Respiration Take the first respiration
@tryashtar
tryashtar / mcstructure.md
Last active October 23, 2023 23:33
Bedrock mcstructure file format

Bedrock .mcstructure files

Saving and Loading

mcstructure files are created by the Export button in a structure block. To load them in game with a load structure block, the files must be placed in a behavior pack. The path determines the structure identifier, which is typed into the structure block to load the structure.

Examples:

@tryashtar
tryashtar / sounds.md
Last active November 25, 2023 15:56
How sounds work in Bedrock Edition

sound_definitions.json

There are two different ways to format this file:

  • All the sound event keys in the root
  • Sound event keys in an object called sound_definitions, with an additional key format_version set to 1.14.0

You should always use the latter, as using the former prevents fields like pitch from working.

You can reference sounds in OGG or FSB format. FSB sounds do not fade properly with distance, so prefer OGG unless the sound is intended to be global like music.

volume:

@tryashtar
tryashtar / ores.md
Last active July 1, 2020 22:52
How ores generate

 

Block Replaces Size Type
@tryashtar
tryashtar / camera.mcfunction
Created June 8, 2019 20:32
Godlander's modified camera system for kingdom hearts
# @s is the player in the minecart
# 0-0-0-0-1 is the AEC the camera minecart is riding on
# 0-0-0-0-2 is sora's true position marker
# 0-0-0-0-3 is the point the camera focuses on
# 0-0-0-0-4 is the AEC sora's display model rides on
# 0-0-0-0-5 is sora's display model
# 0-0-9-0-8 and 0-0-9-0-9 are temporary markers used for math
# movement
@tryashtar
tryashtar / bedrock block states.txt
Last active August 23, 2022 07:29
List of all blocks and block states in bedrock edition (* means I was unable to place or inspect this block)
air
stone
stone_type
stone
granite
granite_smooth
diorite
diorite_smooth
andesite
andesite_smooth