#Ive been working on this datapack for over a month

1 messages · Page 1 of 1 (latest)

young hemlock
#

I Thought I was finally done but i apparently did something wrong because it doesnt show in minecraft when i add it the focus was to give every player 3 random items in the game every minute

muted tulipBOT
#
Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

                        🙇 After a while, hit the Summon Helpers button to ping the helper team. They'll be happy to help you


                        
                        ✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
lusty mulch
#

do you have a pack.mcmeta? if so, what are it's contents?

young hemlock
#

pacl mcmeta?

#

the contents are

#

Void_unriv

#

inside that is data

#

inside that is Random items

#

Inside that is advancements and functions

#

inside advancements is triggers which reads as {
"criteria": {
"trigger": {
"trigger": "minecraft:tick"
}
},
"rewards": {
"function": "random_items:give_items"
}
}

#

that is my function folder

lusty mulch
#

i need the pack.mcmeta file that is in the root project of your datapack

young hemlock
#

there is no pack mcmeta

lusty mulch
#

thats the issue

#

look here under "contents https://minecraft.wiki/w/Data_pack

Minecraft Wiki

The data pack system provides a way for players to further customize their Minecraft experience. Data packs can be used to override or add new advancements, dimensions, functions, loot tables, predicates, item modifiers, recipes, structures, tags, damage types, world generation settings, and biomes without any code modification.

young hemlock
#

Ok i added it but it still doesnt show up for me

#

I cant figure it out

muted tulipBOT
# muted tulip

<@&935561184806060073>

**🙇 Helpers Arise!**

Please note that you still might not immediately get a response since all helpers are human beings and volunteers (and also might be sleeping right now)

terse tree
#

have ya checked the logs?

young hemlock
#

Logs?

#

How?

olive hollyBOT
#
:information_source: Default Launcher Logs

The logs are where Minecraft displays errors when something goes wrong and can thus help you gain information about why something isn't working for you!
To open the logs:

  1. Enable logs in the Minecraft Launcher
  2. Start your game (or restart it if you already have an open instance)
  3. Enjoy spotting errors getting much easier!
terse tree
#

;-;

#

that yeah

young hemlock
#

Oh ok let me check

#

Im very new to this 😅

molten mulch
#

You can't use capital letters

#

the foldere names all have ccapital letters

#

spaces are also not valid

muted tulipBOT
#
Quick Look

Void_unriv/data/Random Items/select_item.mcfunction.txt:

scoreboard players set @a[distance=..30, scores={random_items=1..}] selected_items 0

execute as @a[distance=..30, scores={random_items=1..}] run scoreboard players add @a[distance=..10, scores={random_items=1..}] selected_items 1
young hemlock
#

Missing metadata in pack file/Void_unriv (4).zip

terse tree
#

oh yeah

molten mulch
#

your pack.mcmeta is a txt file

young hemlock
#

Oh

terse tree
#

and so are all the other files

young hemlock
#

how do i fix that

terse tree
#

one sec

young hemlock
#

I feel stupid now o_o lol

terse tree
#

nah it’s fine

#

Using a coding app like visual studio code won’t have this problem

young hemlock
#

I use np++

#

;-;

terse tree
#

fair enough

#

just make sure you turn on that setting so that you can see the actual file name extensions in the file explorer

#

but yeah you need to make sure that all files and folders have no spaces, no capital letters, and aren’t .txt

#

then you should be good to go

young hemlock
#

Missing metadata in pack file/Void_unriv (5).zip 😵‍💫

#

Now im confused

muted tulipBOT
#
Quick Look

Void_unriv/data/Random Items/Functions/give_selected_items.mcfunction.mcfunction:

execute as @a[distance=..30, scores={random_items=3, selected_items=3}] run function random_items:give_selected_item
molten mulch
young hemlock
#

What do i do with this?

#

copy and paste?

terse tree
#

that’s just a viewer so we can look in the zip you sent without needing to download it ourselves

young hemlock
#

Ohhhh

#

Ok

#

I appreciate all the help guys this is for a friend who is trying to make his first youtube video

#

Just wanted to say thank you 😄

terse tree
#

no problem :)

molten mulch
#

That's what we're here for

young hemlock
#

lmk if you find the problem 😭

young hemlock
#

Really I thought i fixed it

terse tree
#

now its .mcfunction.mcfunction

#

also, rename the folder Random Items to random_items

young hemlock
#

does the zip need to be lowercased too?

#

it still says missing metadata

terse tree
young hemlock
terse tree
#

you can ignore that

#

btw the file doesnt need to be zipped

#

in fact it shouldnt be

young hemlock
#

Oh

#

well damn lmao give me one moment

terse tree
#

it should be world/datapacks/<the datapack>/data

#

<the datapack> can in theory be a zip, but you ziped it so the zip contains a folder, and that folder contains data and pack.mcmeta

#

you would have to zip it so inside the zip is just data and pack.mcmeta, not a folder which contains those two

young hemlock
#

Ok the pack is on now

terse tree
#

does it show up if you run /datapack list enabled?

young hemlock
#

but i dont think it works 😭

terse tree
#

mhm

#

lets have a look

young hemlock
#

its supposed to give every player 3 random items every minute

#

the idea was spawning on one piece of bedrock and then every player tries to survive with 3 items every minute

terse tree
#

hmm

#

oh i see

#

two of your functions aren't in the functions folder

#

these four

#

all functions need to be in functions folder otherwise Minecraft doesnt bother reading them

young hemlock
#

oh so all of them

#

all 4?

terse tree
#

yeah

young hemlock
#

ok ok appreciate it

#

and then reload?

#

or make a new world

terse tree
#

just reload

young hemlock
#

it still apears to not do as planned.

#

appears*

terse tree
#

is there any red text in the logs?

young hemlock
#

Nope

#

Did I mess up the actual code 😭

terse tree
#

Might have done :P

#

If you just want to give them 3 completely random items you can do that with a loot table

young hemlock
#

...How???

#

Lmao is it simpler

#

because if so I feel wasted 💀

#

Lmao

terse tree
#

Bit simpler. You'd need to generate a loot table which gives a random item from a list of items, because youd be there forever if you did it by hand

#

but then you just need to run /loot give @s loot random_item:whatever to get a random item

young hemlock
#

So how would I go about pulling this off? and at the point just redo the pack?

terse tree
#

do you just want to give all players 3 random items every minute? or is there more to it

young hemlock
#

Nope thats it

terse tree
#

welp

#

you'd only need two functions

young hemlock
#

My only goal LMAO

#

;-;

#

oj

#

ok

terse tree
#

one which does the giving of items, and one which tells the other one to run every minute

young hemlock
#

so i can remove the trigger json?

terse tree
#

yeah

#

you can remove everything except init.mcfunction, because you only need that to tell the other function to run

young hemlock
#

AHH

#

NO

#

I alr deleted it

#

Can i undo

terse tree
#

just create it again

#

now i dont suppose you'd know how to generate a loot table very easily right

young hemlock
#

scoreboard objectives add timed_items dummy
scoreboard objectives add random_items dummy

terse tree
#

ill do it for ya

young hemlock
#

😄

#

Yipee!

#

tysm

terse tree
#

ok i did it for ya

young hemlock
#

Just curious for future refrences

#

was there a source for this or did you already make it?

#

because that was fast 😮

terse tree
#

I wrote a very short program just then to generate it myself. I got a list of all the items from a library by HeDeAn

young hemlock
#

Woah sounds badass man one day I hope to be as good as that

terse tree
#

now to use that

terse tree
#

(Discord hides most of the file so make sure you download it, open it, and copy it all from there)

young hemlock
#

Ok gotcha

#

Wait i dont put it in functions?

#

intresting

#

theres so much to learn lmao

terse tree
#

no, this is a loot table

#

bit different

young hemlock
#

I love this

#

so much fun

terse tree
#

indeed

#

a loot table is basically a file which you can use to generate a set of items

#

you can actually change the amount of items it generates by changing this line at the top. I suggest you change 1 to 3

#

lmk when you're done because im kinda overwhelming you with information right now lol

young hemlock
#

Ok lmao

#

And what about the timed what do I do for that?

#

Im such a noob :<

terse tree
#

nah its fine

#

this is the easy part

#

you need to create another mcfunction file (in the functions folder), call this something like every_minute.mcfunction

#

in this function we want to give all players the 3 items, then tell Minecraft to run itself again in one minute

young hemlock
#

Ok mmhmm

terse tree
#

so when the function is run for the first time it creates a loop

#
loot give @a loot random_item:random
schedule function random_item:every_minute 60s```
#

that's the commands you'll want

young hemlock
#

is that it 😮

terse tree
#

for this function yes

#

in init.mcfunction all you need is function random_item:every_minute

young hemlock
#

ok gotcha

#

I did it

terse tree
#

then the final thing

#

is to make init.mcfunction run when you /reload

#

so every time you /reload it will start the loop

young hemlock
#

Ohhh Ok

terse tree
#

you can do this by creating a file in data/minecraft/tags/functions/load.json, and putting this in it:json { "values":[ "random_items:init" ] }

#

then you should be finally done

young hemlock
#

data/minecraft/tags/functions/load.json???

#

How do I find this

terse tree
#

you need to create those folders

#

data should already exist

young hemlock
#

oh ok

terse tree
#

(data should contain random_items already)

#

in data create the minecraft folder, in the minecraft folder create the tags folder, in the tags folder create the functions folder, in the functions folder create load.json and put that code i sent in it

young hemlock
#

Ok gotcha

#

and just curious

terse tree
#

sure

young hemlock
#

is there a way to add a custom command so it runs init when typed /start lucky_void

#

Just curious

#

if that was possible and easy to do

terse tree
#

You can't add custom commands with datapacks. The closest we have is /trigger start or /function random_items:start

#

But right now it starts automatically when you run /reload

young hemlock
#

Oh ok

#

so all he has to do is /reload

terse tree
#

yep

young hemlock
#

Well I really really appreciate it

terse tree
#

make sure you test it first to make sure it works

young hemlock
#

Ok

#

all I need to do is /reload or do i need function init

terse tree
#

just reload

#

/reload should run the init function automatically because of the load.json thingy we just added

young hemlock
#

Oh I dont think it is working 😦

muted tulipBOT
#
Quick Look

Void_unriv/data/random_items/functions/init.mcfunction:

function random_item:every_minute```
terse tree
#

oh thats my bad

#

i said to put random_item instead of random_items

#

in every_minute.mcfunction

#

change that and it should be fine

young hemlock
#

oh so just add a s

terse tree
#

and also in init.mcfunction

#

yeah

young hemlock
#

ok

#

it doesnt appear to auto give every 60s like you had tried to make

#

it does give the items now thou 😄

terse tree
#

send the new zip rq

young hemlock
#

Ok give me one sex

#

sec

muted tulipBOT
#
Quick Look

Void_unriv/data/random_items/functions/init.mcfunction:

function random_items:every_minute```
lusty mulch
terse tree
#

it should run every minute hmm

#

maybe change 60s to 5s just so you can test it

young hemlock
#

k

#

Ignore this C:\Users\PC\AppData\Local\Temp\mcworld-13896809138572996272

#

that works

#

maybe 59 seconds would work

terse tree
#

try it

#

change to 59s

#

then /reload

#

it'll update automaticaly

young hemlock
#

Wait

#

so do I just change the original file

#

how do I get it back into mc

terse tree
#

just /reload

#

well

young hemlock
#

Ive been making a new world

terse tree
#

lol you dont need to do that

young hemlock
#

and re adding the new folder

#

;-;

terse tree
#

just put the folder in one world and edit the folder

young hemlock
#

how do I find the world ;-;

terse tree
#

in minecraft, click on world -> edit -> open world folder

young hemlock
#

It works yipeee

#

let me wait another minute

#

just to double check

#

IT WORKS

#

Tysm

#

I really really appreciate it and if I ever get good at this ill apply to this server

#

I will try to become a professional :>

terse tree
#

practise makes perfect :)

#

if you're done with this question make sure to run /resolve or click the button at the top of the thread (/top)