2
Datapack functions do not work
I created my first new datapack for the version 1.19.2: Blessed Mode [difficulty]. I created functions in it. When I started minecraft and put the datapack in the world in singleplayer, not a single function that I have in the datapack worked. I tried both /reload and /datapack and it didn't work. So I used the command /function to give one function at a time whether it goes and each function went one by one. I also have load and tick json on the datapack and I have a well-written basis in them. I have the following written in load.mcfunction:
# initialize mined oak wood
scoreboard objectives add mined_oak_wood minecraft.mined:minecraft.oak_log
scoreboard players set @a mined_oak_wood 0
# initialize crafting table
scoreboard objectives add crafting_table minecraft.used:minecraft.crafting_table
scoreboard players set @a crafting_table 0
#initialize timer
scoreboard objectives add effect_timer dummy
scoreboard players set TIMER effect_timer 0
# initialize mined with wood pickaxe
scoreboard objectives add stone_mined_with_wooden_pickaxe minecraft.mined:minecraft.stone_with_wooden_pickaxe
scoreboard players set @a stone_mined_with_wooden_pickaxe 0
# initialize golden apple
scoreboard objectives add used_golden_apple minecraft.used:minecraft.golden_apple
scoreboard players set @a used_golden_apple 0
function blessedmode:blessedmode
schedule function blessedmode:apply_effects 2400
schedule function blessedmode:golden_apple_effect 4800
schedule function blessedmode:stone_mining_effect 6000
And here is tick.mcfunction:
# Increasing the value of the time scoreboard in each tick (20 ticks is 1 second)
scoreboard players add TIMER effect_timer 1
# Time check every 30 minutes (30 minutes = 30 * 60 seconds = 1800 seconds)
execute if score TIMER effect_timer matches 1800 run function blessedmode:ApplyEffects
execute as @a[scores={stone_mined_with_wooden_pickaxe=1..}] run function blessedmode:stone_mining_effect
I do not know what to do. I wouldn't want to put a datapack after every /function command, but for everything to go normally datapack. That if I put a datapack in the world and when I do something (eg: if I eat food, it will add one heart to my heart bar) it will go and I don't have to give commands to the functions. For more than a day I have been looking for the problem, where it is, how to fix it, but I don't know where it is. I read the pages, looked at the forums to see if I could find something similar on YouTube, but I couldn't find anything. Help me with this problem, pls. I will be happy for any help, big or small. If you want, I will also send you pictures of my functions that I have on the datapack.
# initialize mined oak wood
scoreboard objectives add mined_oak_wood minecraft.mined:minecraft.oak_log
scoreboard players set @a mined_oak_wood 0
# initialize crafting table
scoreboard objectives add crafting_table minecraft.used:minecraft.crafting_table
scoreboard players set @a crafting_table 0
#initialize timer
scoreboard objectives add effect_timer dummy
scoreboard players set TIMER effect_timer 0
# initialize mined with wood pickaxe
scoreboard objectives add stone_mined_with_wooden_pickaxe minecraft.mined:minecraft.stone_with_wooden_pickaxe
scoreboard players set @a stone_mined_with_wooden_pickaxe 0
# initialize golden apple
scoreboard objectives add used_golden_apple minecraft.used:minecraft.golden_apple
scoreboard players set @a used_golden_apple 0
function blessedmode:blessedmode
schedule function blessedmode:apply_effects 2400
schedule function blessedmode:golden_apple_effect 4800
schedule function blessedmode:stone_mining_effect 6000
And here is tick.mcfunction:
# Increasing the value of the time scoreboard in each tick (20 ticks is 1 second)
scoreboard players add TIMER effect_timer 1
# Time check every 30 minutes (30 minutes = 30 * 60 seconds = 1800 seconds)
execute if score TIMER effect_timer matches 1800 run function blessedmode:ApplyEffects
execute as @a[scores={stone_mined_with_wooden_pickaxe=1..}] run function blessedmode:stone_mining_effect
I do not know what to do. I wouldn't want to put a datapack after every /function command, but for everything to go normally datapack. That if I put a datapack in the world and when I do something (eg: if I eat food, it will add one heart to my heart bar) it will go and I don't have to give commands to the functions. For more than a day I have been looking for the problem, where it is, how to fix it, but I don't know where it is. I read the pages, looked at the forums to see if I could find something similar on YouTube, but I couldn't find anything. Help me with this problem, pls. I will be happy for any help, big or small. If you want, I will also send you pictures of my functions that I have on the datapack.
Create an account or sign in to comment.
7
Issues vscode tells me:
tick: blessedmode:ApplyEffects should be blessedmode:apply_effects
stone_mining_effect: stone_mining_effect: heart_particle is not an entity type
oak_wood_effect: wrong namespace for function called
load: minecraft.mined:minecraft.stone_with_wooden_pickaxe - idk if thats a 1.19 thing, but that doesnt appear to exist
kill_mob: missing int in front of force
golden_apple_effect: wrong namespace for function called
Also: just semantics, but you dont need to put "true"/"false" in "
From what i can see, get a code editor that recognizes mcfunction code and youll have less problems ^^
tick: blessedmode:ApplyEffects should be blessedmode:apply_effects
stone_mining_effect: stone_mining_effect: heart_particle is not an entity type
oak_wood_effect: wrong namespace for function called
load: minecraft.mined:minecraft.stone_with_wooden_pickaxe - idk if thats a 1.19 thing, but that doesnt appear to exist
kill_mob: missing int in front of force
golden_apple_effect: wrong namespace for function called
Also: just semantics, but you dont need to put "true"/"false" in "
From what i can see, get a code editor that recognizes mcfunction code and youll have less problems ^^
im not rly getting what ur exact problem is. Your functions ALL work when executed ingame? with /function?
Just load and tick functions dont trigger when u enter the world or do /reload?
If thats the case I have encountered that aswell. I dont rly know why it happens, but re-creating the functions (also the minecraft .jsons) [deleting them and making new file] if that doesnt work, try making functions with other names and use them.
Could also be an issue with too many functions running in one tick (altho i doubt thats it)
If the load funciton runs, but tick doesnt, try scheduling tick from load and dont include it in the tick.json
If that doesnt help, no clue what the problem is
Just load and tick functions dont trigger when u enter the world or do /reload?
If thats the case I have encountered that aswell. I dont rly know why it happens, but re-creating the functions (also the minecraft .jsons) [deleting them and making new file] if that doesnt work, try making functions with other names and use them.
Could also be an issue with too many functions running in one tick (altho i doubt thats it)
If the load funciton runs, but tick doesnt, try scheduling tick from load and dont include it in the tick.json
If that doesnt help, no clue what the problem is
can you post a direct download link? might have to see the file structure in its entirety to really pinpoint the problem, because everything seems fine...
Also what I do is make a function that tells the player "Successfully initialized" just so you can save time when using /reload
Also what I do is make a function that tells the player "Successfully initialized" just so you can save time when using /reload
here is download link my datapack: https://www.planetminecraft.com/data-pack/blessed-mode-difficulty-1-19-x/
look on my fuctions on my datapack, pls
look on my fuctions on my datapack, pls
The functions initialize_crafting_table and initialize_golden_apple do not appear to exist.
Ok, and where else am I wrong? I don't have anything to write in load.mcfunction or tick.mcfunction, because I have a lot of functions and I did not write or add much to load and tick if I made so many functions
I think you did everything else right, but I'm not completely sure. Sorry for the late reply.