Skip to content

Instantly share code, notes, and snippets.

@intsuc
intsuc / doc.md
Last active August 22, 2019 15:25
usercache map (non-username string -> UUID string)
  • Any entities that extend TameableEntity or AbstractHorseEntity works.

  • To jump to the else branch that performs the lookup:

    • HandItems[0].tag.OwnerUUID must not be TAG_String.
    • HandItems[0].tag.OwnerUUID and HandItems[0].tag.Owner must be assigned to the entity together.
String uuid;
if (tag.containsKey("OwnerUUID", TAG_String) /* This method returns false if an actual tag type is different from the specified type */) {
 uuid = tag.getString("OwnerUUID");
@intsuc
intsuc / init.mcfunction
Last active August 22, 2019 15:24
forceload chunk loader (1.14.4)
scoreboard objectives add _ dummy
tick
commandFunctions
minecraft:tick -> (Server)
minecraft:load -> (Server)
levels
$level
timeSync
tick
world border
weather
@intsuc
intsuc / init.mcfunction
Last active August 22, 2019 15:13
typeof function
scoreboard objectives add typeof dummy
# n @ data get block 0 0 0 RecordItem.tag.tags[n][0] | result
# ----------------------------------------------------------------------------+-------
# 0 (1b) | 1
# 1 (2s) | 2
# 2 (3) | 3
# 3 (4L) | 4
# 4 (5.0f) | 5
# 5 (6.0d) | 6
@intsuc
intsuc / init.mcfunction
Last active August 22, 2019 15:13
5x5 forceload chunk loader (1.14.4)
scoreboard objectives add forceloader dummy
@intsuc
intsuc / init.mcfunction
Last active August 22, 2019 15:13
getblock loader
scoreboard objectives add loader dummy
@intsuc
intsuc / explicit-1-if.mcfunction
Last active August 22, 2019 15:07
if statement with an implicit/explicit stack
execute if score #condition boolean matches 1 run function explicit-1-then
# peek
execute store result score #condition boolean run data get entity @s HandItems[0].tag.boolean_stack[-1]
execute if score #condition boolean matches 0 run function explicit-1-else
# 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]
@intsuc
intsuc / init.mcfunction
Last active September 18, 2019 12:29
dimension chunk loader
execute in minecraft:the_nether run forceload add 0 0
kill @e[tag=removed, predicate=removable]
# the_nether
execute in minecraft:the_nether as @e[distance=0.0.., tag=removed] in minecraft:overworld run teleport @s 8.0 0.0 8.0
execute in minecraft:overworld as @e[x=7.5, y=-0.5, z=7.5, dx=0, tag=removed] in minecraft:the_nether run teleport @s 34359738360.0 0.0 34359738360.0
# overworld
execute in minecraft:overworld as @e[distance=0.0.., tag=removed] in minecraft:the_end run teleport @s 8.0 0.0 8.0
execute in minecraft:the_end as @e[x=7.5, y=-0.5, z=7.5, dx=0, tag=removed] in minecraft:overworld run teleport @s 34359738360.0 0.0 34359738360.0