Skip to content

Instantly share code, notes, and snippets.

@intsuc
intsuc / tags.yaml
Last active June 3, 2020 13:32
tags
Tag:
EndTag:
id: 0
isValue: true
name: END
prettyName: TAG_End
NumericTag:
ByteTag:
id: 1
isValue: true
# Passenger must be `LivingEntity`
summon minecraft:armor_stand 8.0 0.0 8.0 {Tags: ["vehicle"], Passengers: [{id: "minecraft:armor_stand", Tags: ["passenger"]}]}
# Move passenger to the current world position
execute as @e[x=7.5, y=-0.5, z=7.5, dx=0.0, tag=passenger] run function move_passenger
# Eject passenger
kill @e[x=7.5, y=-0.5, z=7.5, dx=0.0, tag=vehicle]
@intsuc
intsuc / 0.mcfunction
Last active October 13, 2019 18:56
colored bitwise trie
data modify storage trie nodes[0].colored set value true
data modify storage trie nodes[1].colored set value false
execute if score index[2] int matches 0 run function 00
execute if score index[2] int matches 1 run function 01
/// triggers
type BeeNestDestroyedTrigger = {
trigger: "bee_nest_destroyed",
conditions: {
block?: ResourceLocation,
item?: ItemPredicate,
num_bees_inside?: MinMaxBounds
}
}
@intsuc
intsuc / .md
Last active November 14, 2019 11:42
worldborder get_millis
function init
function main
@intsuc
intsuc / 0.mcfunction
Created November 19, 2019 05:45
O(log n)-indexable static array using dynamic dispatch ($i ∈ 0..3)
execute if score index[0] int matches 0 run datapack enable "file/0" last
execute if score index[0] int matches 1 run datapack enable "file/1" last
function ($n + 1)_ge
scoreboard players operation eq _ -= ge _
@intsuc
intsuc / random.json
Last active November 23, 2019 14:20
{
"type": "minecraft:generic",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:tnt",
"functions": [
@intsuc
intsuc / bucket_sort\.mcfunction
Last active November 24, 2019 13:45
a sample of simple bucket sort (^^^ = copy)
# initialize buckets
data modify storage _ sorted set value [{_: 0b}, {_: 0b}, {_: 0b}, {_: 0b}, {_: 0b}, {_: 0b}, {_: 0b}, {_: 0b}]
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# scatter non-empty data
execute if data storage _ data[0] run function scatter/
# remove empty buckets
data remove storage _ sorted[{_: 0b}]