Closed BJTMastermind closed 8 months ago
This should be good now.
Also please explain me what's the purpose of this command? It basically just allows you to get the file name of a custom sound item. It can't be used anywhere, so I don't really see a point of this at all.
35883d6c4b50fd0d6a2a8d5f0067084ed7aab980 should properly implement file names that can be actually used for applying them to items.
I apologize that the code is a little messy.
This is the first time im contributing to a project so im sure there's a lot for me to learn in making better contributions and code in general.
The main feature from this I would have used is the nbt file database as I was recently converting a world that used this mod for custom audio to bedrock edition and since all the sounds are just uuids it makes it hard to know whats what, so the database of mappings would allow me to setup a script to rename them to their original uploaded name to better know what the files are just by the name, this is most helpful when there are a lot of audio files.
I added the filename
command along with it for when there are only a few audio files the command could be used to copy the original name and rename the file based on it id from the id
command. but I can see from an in game point of view this command doesn't do much.
I thought about maybe having the file name be the default display if you don't give the item one but i figured that some might want it to be blank so i didn't end up do this.
I apologize that the code is a little messy.
This is the first time im contributing to a project so im sure there's a lot for me to learn in making better contributions and code in general.
No worries.
Basically how I implemented it, is pretty similar. The file names are stored in a json, which is also more human readable as NBT. Theres also a command that gives you the file name of an item and additionally lets you apply audio to an item by file name.
I was just checking it out. Looks great! I did noticed the apply command that pops up when you click [Put on item]
might be broken a bit as it was given me the error No audio with name '<uuid>' found or more then one found
but when I used the musicdisc command instead I was able to apply the sound to the disc.
That's not happening for me. Are you sure, you tried the latest commit?
Yeah its on the latest commit. I could make a bug report to give more detail about it and maybe a short clip of running the commands. If thats easier for you.
You can post that here. I'll also do some testing.
https://youtu.be/LzArcTJaBtU The test i did here is before the audio_player_data
folder is generated. I used the filebin
command here because i had already setup the download before with upload
but same thing happens when using upload
Thanks, that might be an issue that doesn't happen in my development environment.
Can you try if it works for you now?
Looks to be working now.
Alright, thanks for testing that out!
This pull request introduces a new
filename
subcommand to/audioplayer
.Overview
It operates by utilizing a new file named
filename_mappings.dat
, which resides in the existingaudio_player_data
folder of the world. This file is structured as a GZipped NBT file, containing a list of mappings between original filenames and their corresponding UUID names.File Structure
The structure of
filename_mappings.dat
is as follows:Functionality
Whenever a new audio file is uploaded, regardless of the method used, an entry is added to
filename_mappings.dat
. Conversely, if a file is deleted the mappings associated with that file will be removed the next time thefilename
command is ran or when another audio file is uploaded.Motivation
I implemented this feature to enhance the usability and maintainability of the users audio files. By introducing the
filename
subcommand and associated functionality, users can easily manage audio file mappings, whether its with the command itself for a couple of files or externally with user made scripts for a larger number of files.