Skip to content

Instantly share code, notes, and snippets.

@misode
misode / load.json
Last active January 22, 2020 13:51
{
"values": [
"test:load"
]
}

Loot Table Inherit

This is a proposal for a way to include the loot table that is being overwritten by the new data pack. This can be useful if you want to partially overwrite a vanilla loot table, but want it to be future proof. Or if you also want other data packs to be able to overwrite the same vanilla loot table. This is currently not possible.

The first data pack loads the initial loot table.

{
  "pools": [
{
"condition": "minecraft:inverted",
"term": {
"condition": "minecraft:alternative",
"terms": [
{
"condition": "minecraft:inverted",
"term": {
"condition": "minecraft:location_check",
"offsetY": 0,
## 1.11
https://www.mojang.com/2016/09/minecraft-snapshot-16w35a/
https://www.mojang.com/2016/09/minecraft-snapshot-16w36a/
https://www.mojang.com/2016/09/minecraft-snapshot-16w38a/
https://www.mojang.com/2016/09/minecraft-snapshot-16w39a-the-exploration-update/
https://www.mojang.com/2016/10/minecraft-snapshot-16w40a/
https://www.mojang.com/2016/10/minecraft-snapshot-16w41a/
https://www.mojang.com/2016/10/minecraft-snapshot-16w42a/
https://www.mojang.com/2016/10/minecraft-snapshot-16w43a/
https://www.mojang.com/2016/11/seek-out-the-exploration-update-111-on-pc-mac-now/
{
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": [
"source.mcfunction",
"string.unquoted.mcfunction"
],
"settings": {
"foreground": "#bbbbbb"
# Copy the last stone slot to a temp array
data modify storage temp Items[] set from block ~ ~ ~ Items[{id:"minecraft:stone"}]
# get the count in a scoreboard and remove one
execute store result storage temp Items[0].Count byte 1 run data get storage temp Items[0].Count 0.99
# Copy the last slot to the output items
data modify block ~ ~ ~ Items append from storage temp Items[0]
@misode
misode / events.md
Last active October 10, 2019 19:52

General Structure

{
  "trigger": string // one of the triggers mentioned below
  "predicate": {
    // trigger-specific properties
  },
  "actions": [
    {
 "action": string // one of "function", "advancement", ...
@misode
misode / wishlist.md
Last active March 23, 2020 03:36
Minecraft Technical Wishlist

Minecraft Technical Wishlist

  • Ability to detect block NBT within loot tables
  • Addition of an optional loot table argument in /loot ... mine
  • New entry type in loot tables that runs a function
  • data resolve to resolve text components in NBT
  • Loot table tags. With a new entry type loot_table_tag, similar to tag. It also has expand that acts the same.
  • New entry type in loot tables that drops xp. If the loot table is used in a container, the container will store the xp, like it does currently with furnaces.
  • New entry type in loot tables that will insert the loot table that you are replacing. For example if you want to add a new drop to a vanilla loot table without copying the vanilla loot table. This allows multiple datapacks to each add their own drops to an existing loot table. https://gist.github.com/misode/728b6251adfcdef5f71e50e51e002059
  • Selecting sublists in NBT arrays with nbt paths. This could have the following syntax: Items[2..5]

Preventing Fall Damage

This method is based on PingiPuck's video

You need to run a command once (or on every /reload).

scoreboard objectives add falling minecraft.custom:minecraft.time_since_death 

You need to run these commands for every player every tick

Calculating the sqrt of a number

This method for calculating the square root uses an iterative algorithm known as the Babylonian method.

You need to run some commands once (or on every /reload).

scoreboard objectives add const dummy
scoreboard players set 2 const 2

scoreboard objectives add sqrt dummy