Skip to content

Instantly share code, notes, and snippets.

rp13

Renames basic block and item texture files from the 1.12 format to 1.13 (the "flattening").

Run rp13update.py (alongside associated JSON files) in the root directory of the resource pack.

Credits to https://redd.it/7f5712 for making it easy to map the old -> new file names.

EntityTickFunction: A function defined via entity data that runs once per tick using the entity as the executor

The title says it all. Similar in ways to the old gameLoopFunction but for individual entities.

Here's some inspiration:

  • Conveniently use @s in the EntityTickFunction to refer to the host entity, bypassing the overhead of running (relatively) expensive @e selectors at 20Hz. Great for systems like custom AI that need to be as responsive as possible while remaining efficient.
  • Trivially - and slightly more efficiently - run one-time initialization functions on newly-spawned mobs by summoning them with an EntityTickFunction that replaces/removes itself once complete.
  • Automatically run multiple (non-nested) functions on an entity every tick by specifying EntityTickFunction to be one of those fancy new function tags.
import itertools
import sys
# requires python 3.6+
#
# usage:
# py benchmarkers.py <file> <entity> <range>
#
# where:
# <file> is the pre-formatted file to print commands to, e.g. '{e}.{r}.mcfunction'
{
"type": "root",
"children": {
"advancement": {
"type": "literal",
"children": {
"grant": {
"type": "literal",
"children": {
"targets": {
# (1) explicitly chained
commands.execute().chain(
commands.execute.at(
target=selectors.entities(type=entities.creeper))
).chain(
commands.execute.unless_entity(
target=selectors.entities(type=entities.ocelot, r=3))
).chain(
commands.execute.if_block(
position=(0, -1, 0),
# Feel free to modify and use this filter however you wish. If you do,
# please give credit to SethBling.
# http://youtube.com/SethBling
#
''' Fixed for MC 1.8 by Rezzing, September 6, 2014
PLEASE READ: The unusable trade won't prevent new trades anymore but I
solved it by adding a very high career level. So only use it if you like
the fancy stop sign. '''
# Reedited by DragonQuiz, November 8, 2014
#
!0::
SendInput /
Sleep 100
SendInput gamemode 0{Enter}
return
!1::
SendInput /
Sleep 100
SendInput gamemode 1{Enter}
while True:
try:
inp = input('>') # input flags in binary, like this: 01110010
except KeyboardInterrupt:
print('\ngoodbye')
break
n = len(inp) # could also be locked (for example, at n=32 for integer capacity)
try:
{
"achievement": {
"usage": "<give|take> <name|*> [player]"
},
"advancement": {
"see": [
"http://minecraft.gamepedia.com/Commands#advancement",
"http://minecraft.gamepedia.com/Advancements"
],
"usage": [
# This demo script prints out a command that summons a spawner minecart with 10
# spawn potentials, each of which is a command block minecart. Each of these
# command block minecarts is numbered `i` from 1 to 10, with a progressively
# greater spawn probability of `i / 55` and a command that prints a message
# including `i`. Note the absolute position of the spawned command block
# minecarts, and the relative position (offset) of the initial spawner minecart.
spawn_potentials = []
for i in range(1, 11):
spawn_potentials.append(SpawnPotential(