Skip to content

Instantly share code, notes, and snippets.

@intsuc
intsuc / _touch.mcfunction
Last active April 20, 2023 10:28
List-Mapped Trie
scoreboard players operation #_index lmt = #index lmt
execute store result score #size lmt if data storage lmt: ""[]
execute if score #size lmt matches 0 run data modify storage lmt: "" append from storage lmt: branch[]
execute if score #size lmt matches 3 if score #index lmt matches 0.. run data remove storage lmt: ""[2]
execute if score #size lmt matches 2 if score #index lmt matches ..-1 run data modify storage lmt: "" append value []
scoreboard players operation #index lmt += #index lmt
execute store result score #size lmt if data storage lmt: ""[-2][]
execute if score #size lmt matches 0 run data modify storage lmt: ""[-2] append from storage lmt: branch[]
execute if score #size lmt matches 3 if score #index lmt matches 0.. run data remove storage lmt: ""[-2][2]
@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
# execute positioned ~ Double.NEGATIVE_INFINITY ~ run summon minecraft:eye_of_ender ~ ~Double.POSITIVE_INFINITY ~ {UUIDMost: 0L, UUIDLeast: 0L}
execute positioned ~ -179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497792 ~ run summon minecraft:eye_of_ender ~ ~179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497792 ~ {UUIDMost: 0L, UUIDLeast: 0L}
kill 0-0-0-0-0
data modify storage _ nan set from entity 0-0-0-0-0 Pos[1]