2

I was coding my first Minecraft data pack, and everything was working perfectly for the first bit. After some time of coding, the tick file seemed to entirely stop working. I checked in the tick.json file, and it looked exactly the same as the load.json just with the "test:tick" instead of "test:load" on the 3rd line, which should be correct. Somehow, the load.mcfunction still worked because I could see the tellraw command I made still popping up every time I reloaded. Also, if I changed the load.mcfunctcion file up a bit, I could see the results working fine on the minecraft side.

Here's my code:

tick.json file:

{
    "values": [
        "test:tick"
    ]
}

load.json file:

{
    "values": [
        "test:load"
    ]
}

load.mcfunction file:

tellraw @a {"text": "Hello there","italic": true,"color":"#5544FF"}

scoreboard players reset tick
scoreboard objectives add tick dummy {"text":"CurrentTick", "bold": true}
scoreboard objectives setdisplay sidebar tick
scoreboard players set tick tick 0

tick.mcfunction file:

execute at @a run summon sheep
#Trident Lightning
execute at @e[type=trident, nbt={OnGround:0b}] run summon lightning_bolt
#Arrow TNT
execute at @e[type=arrow,nbt={pickup:1b,inGround:0b}] run summon tnt ~ ~ ~ {Fuse:100}
kill @e[type=arrow,nbt={inGround:1b}]
#Egg Leaf Bridge, also can destroy stuff, dropping loot
execute at @e[type=egg] run setblock ~ ~-2 ~ oak_leaves destroy 
#Snowballs damage players in an AOE
execute at @e[type=snowball] run damage @e[distance=..3] 2



#Ticks
scoreboard players add tick tick 1

Screenshot of the file layout in VSCode:

Datapack file layout

I have no mods at all, and no other datapacks. This is on a singleplayer world on 1.20.1.

1
  • Can you run the function with /function test:tick? If not, there is probably a command syntax error in tick.mcfunction.
    – LostXOR
    Jul 30, 2023 at 23:17

1 Answer 1

0

To build on what LostXOR said in the comments, Minecraft mcfunction files simply do not load when there are any syntax errors. I believe you can configure the launcher to use the debug terminal. This should tell you what file failed, and probably what is wrong. From what I am seeing, you forgot to add the location on where to summon the lightning bolt. Change it to this

execute at @e[type=trident, nbt={OnGround:1b}] run summon minecraft:lightning_bolt ~ ~ ~

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .