Hey what’s going on guys turty wordy here and welcome back to the next episode of our forge modding tutorial for minecraft 1.17 in this one we are just going to cover some of the things that i did not manage to do inside of our entity tutorial as It would have taken a lot longer and the video was already getting quite long and three things we are going to go ahead and do is the spawn eggs the loot tables and the sounds so let’s go ahead and get started with that so the first thing we’re going to go Ahead and do is the sounds so we need to as usual go ahead and create a sounds in it in our init package and i’m going to make this final and i’m going to create the private constructor a lot of people have been asking why i’ve been doing this and the reason is Simply so that no one uh either you or anyone collaborating on your mod goes ahead and accidentally initializes this class or instantiates this class um as you know there’s there’s no point in that happening because it’s just holding constants anyways so as usual we need to go ahead And create the deferred register and this time it is of sound event and that is net.minecraft.sounds.soundvent let’s call this sounds and that is equal to deferred register dot create forge registries dot sound events and then your mod id so tutorial mod dot mod id there we go Then we can create the registry object so i’m going to be creating three sounds for our entity that is going to be the hurt death and ambien obviously you can create as many as you want so let’s create registry object and that is of sound event I’m going to have the ambient first so example and spot entity and squat ambient is equal sound dot register example underscore entity underscore ambient and then we want a supplier of a new sound event and that takes in a resource location so let’s put in a new resource location okay And obviously the first parameter will be our mod id that is the identifier so tutorial1.mod id and then it’s going to be entity dot example underscore nt dot ambient and i’ll explain this in a second so i’m just going to go ahead and create the hurt and death as well and then i’ll Explain exactly what’s going on here okay just before i go through all of these i messed this up um it needs to be entity dot example entity dot hurt um so basically it needs to be the same thing both here and here so that should be entity and then dot Your entity name and then dot the action that is happening um so just replace that for all of those there we go i have created all three sounds so let’s explain exactly what’s happening here so as normal we we go ahead and create the registry object by using sounds.register Now in here this is what it is registered as so it’s registered as entity dot example underscore entity dot ambient now if we come down to here we go ahead and create a new sound event which takes in a resource location now the first thing in the resource location Is the identifier so the mod id basically what happens here is it looks in our assets for this uh this string right here so it looks for our mod id inside of assets so it locates assets.tutorialmod then it looks for a file which we’re going to create right now called sounds.json Which is in the root of our assets tutorial mod and inside of assets dot tutorial mob uh inside of the sounds json it looks for an object with the name entity dot example entity dot ambient so if we go into here we can create the normal uh json thing And then it looks for an object with entity.example underscore entity dot ambient okay and obviously this is just an object just a normal json object and it looks for that basically and then this right here is basically the same thing so it’s just a double reference this is This is basically just what it’s registered as but it’s best to keep them the same as each other in order to not cause any confusion so let’s go back into the sound.json that we just created and we need to fill this out a little bit so in here we actually need to specify The sounds so let’s go sounds and this is just an array since you can have multiple different options of the sound that will play and in here you can well you have a few options well you have two options so you can actually create an object for the sound and give It like a name so uh the name of ours would be tutorial mod example entity and then obviously you can give it like a volume a pitch uh all these different things or you can simply just put tutorial mod colon example and you’ve got entity and squat ambient The only reason you would create an object in here for it is if you wanted a different pitch or volume another thing about sounds which i haven’t mentioned yet but i should mention is that you should have them be mono so you should have them as a mono uh channel If you want it to have attenuation so that’s basically attenuation is basically the further away you get the quieter it will get and it needs to be mono for that to happen so only have one audio channel um if it has stereo then it’s always played at the player’s location so It’s more for background music or you know ambient sounds mono is just for other sounds that should have a location and that’s just how the open al library works so that’s what minecraft uses for sounds um obviously the other thing you can specify in here is a subtitle if you want I’m not entirely sure what the subtitle is for but you can specify it if you know what it does let’s just create three of these objects for each of our sounds and let’s replace these right here so let’s do death and death and then hurt so it’s in alphabetical order That’s what we like to see there we go so those are our free sounds inside of here the next thing you need to do is actually create our sound so put them in here and i’m going to do that by creating a new package for dot sounds And in this package we need to go ahead and put uh the sounds so i’m going to go ahead and grab those from my drive here we go so i have three sounds obviously they need to be dot oggs that’s just what minecraft needs uh now these are stupid names so see i Need to make sure i rename them as the same thing we put in the sound station so let’s uh refactor rename example and for entity and we’ve got ambient so it’s basically this name right here but without the tutorial mode of course and let’s refactor rename example underscore entity underscore um hurt and Let’s refactor rename example and it’s got entity underscore that not sure what sounds each of these are they’re going to be really strange but don’t worry about it too much obviously you will choose your own sounds the last thing you need to go ahead and Do is obviously make sure our nc has a reference to these sounds so let’s go into our entity and in this get ambient sound method we can do sound init dot and example entity ambient dot get and obviously the same for death and the same for hurt so let’s do Def there we go and hurt obviously you can make this based on the damage source if you want uh i’m not gonna bother that’s way too much effort to be honest um i’m sure if you’re making a proper fully polished mod you might do that i Guess i can’t think of any vanilla mobs that do that but i guess i know some do it based on like if they’re drowning they have different sounds i guess maybe that’s just what it’s used for um but yeah those are the sounds the next thing is spawn eggs let’s go Ahead and do spawn eggs shall we so let’s go ahead into our core into our in it and into item in it oh wait no we need to register sounds so we need to do that obviously in our main class constructor that’s very important so sound init dot sounds oh And then it sort of sounds register and then the bus just like that okay now we can go ahead and do spawn eggs so if we go into item in it in here we can go ahead and create a spawn egg item so that is just a public static final final registry object And this is going to be of forge spawn egg item and we’ll just call this example and spot entity underscore spawn and squat egg rather long but that’s just how it is obviously that’s item stop register example and squat entity and score spawn underscore egg and then a supplier of a new forge Spawn egg item and this takes in first a supplier of our entity type so for this we can simply just do entity init dot example entity now the reason we can do this is because if we go ahead and look at our example entity you’ll see that this is a registry object Now a registry object is just it’s just a supplier if you look right here it’s it’s literally just a supplier and uh string so if you go into registry object you’ll see that it just implements supplier that’s it it implements supplier and it holds a name And that’s it so we can literally just refer straight to that field we don’t have to call dot get the next thing we can do is the two colors so primary color and the secondary color so i’m going to go ahead and get up a hexadecimal color picker Okay i’m going to turn off dark reader so that we have the correct colors okay and we can just grab a random one so here we go hexadecimal let’s go back into eclipse let’s go to the primary color first so zero x and then that then let’s go back into here let’s Choose another random color let’s go back into eclipse 0x blah blah blah and then the final thing is just the properties so that is uh we can just do a new item dot properties and then we can do dot tab and creative mode tab dot i think they are in miscellaneous right Pretty sure spawn eggs are in miscellaneous um so yeah we can just plunk it in there and obviously we want to make sure the uh stacks 2 which is the max stack size is 16 since that’s what spawn x stack two i think do they stack 16 I think they do but i’m actually going to put it 64 because why not i feel like it just makes more sense for them to be 64 anyways so that is actually a spawn egg we just need to go ahead and do the lang of course so let’s go into our lang And let’s go down here let’s create item dot tutorial mod dot example and for entity underscore spawn and for egg spawn example entity is generally how they do it i’m pretty sure and then we need to actually go ahead and create a item model for this but it’s slightly Different than a normal item model so let’s just go ahead and create a new file in here let’s create example underscore entity underscore spawn and score egg dot json of course okay so yeah this is going to be slightly different so we can just specify the parent as usual But the parent is maybe not what you would think it is so for the parent it is item four slash template underscore spawn underscore egg that is where you need to put for the parent and that will use that will allow you to have the colors now actually if You don’t want the colors you can simply just parent off of item generated and give it a normal model but yeah that is that so that’s actually spawn x done um the final thing we can go ahead and do is loot tables so first let’s actually go ahead and create our loot table So obviously link in the description for this loot table site let’s come in here let’s select entity and i’m going to go to presets and these are not the entity presets are you you good bro type entity presets okay that’s how it’s going to work but let’s look at um I guess we can just do entities forward slash and have a look here so let’s just choose something simple let’s copy the blaze spawn egg that not blaze black the blaze loot table and as you will see is actually somewhat complicated especially since this has a kill by player condition you have obviously Looting right here um yeah i’m just going to change this minecraft blaze rod to tutorial see no let’s do minecraft colon uh let’s make it drop in case your boats sure why not i mean yeah yeah why not um and let’s just copy it that’s what my Loot table is going to be obviously you can make that as complex as you like so now we can come back into uh eclipse go into your data folder into tutorial mod loot tables and entities and in here you can create a new file just call this example underscore entity dot json Okay and just paste it in here i’m just going to format that i actually forgot to format the block one but i think i can do that here too just makes it look a little bit nicer and more official and then we can just go into our entity class So common entity example entity and in here you can just go ahead and you can just override the loot table method so loot ah wait maybe not because it does use oh no we do need we need to override this get default loot table method okay and in here you can just return A new resource location and that will be obviously our mod id so tutorial mod.mod id and then it’s just simply the name of our entity so example and it’s got entity and that will just bring us down into data tutorial mod new tables entities example entity So that is it we can now go ahead and run the game and it should work perfectly fine okay so oh god okay we are now in the game and as you can hear they are making sounds so oh god okay okay okay let’s um let’s try out the death sound then shall We also test our loot table how much health did i give him all right like 30 health didn’t i very sound it seems to be working okay the loot table did not die but that’s fine that’s probably just uh Okay oh we can also try to spawn it can’t we stood let’s go miscellaneous here we go here is our okay it turns out we had it right originally so in the default loot table right here what we need to go ahead and do is actually create a constant for this so Let’s create a private static final resource location dude underscore table is equal to a new resource location and obviously that will take in our mod id so historian or dot mod id and then in here instead of putting our entity name we need to go ahead and put entities forward slash Example and we’ve got entity and that’s the issue previously we just put example and it’s got identity so i’ve i figured it would already navigate to the entities directory but i guess it does not um obviously if we run the game now this will work i’m not gonna run the game i Know it will work um so yeah i hope you guys did enjoy this tutorial if you did please do be sure to smash your face into that like button and subscribe if you really enjoyed please do be sure to share it and uh yeah i will see you guys in the next tutorial Good bye yes i got a new phone today it is the thomas the tank engine phone in hell i don’t think your phone can do this there you go hey yes Video Information
This video, titled ‘1.17/1.18 Minecraft Forge Modding Tutorial – Spawn Eggs, Loot Tables, Sounds’, was uploaded by TurtyWurty on 2021-10-29 16:30:13. It has garnered 3539 views and 111 likes. The duration of the video is 00:22:15 or 1335 seconds.
In this video, I will cover the things that were missed from the entity tutorial including spawn eggs, sounds and loot tables.
Join my Discord Server, to receive support with your modding related questions: https://discord.gg/jCTnnhxc7J My CurseForge where you can find my released mods: https://www.curseforge.com/members/realturtywurty
Loot Table Generator: https://misode.github.io/loot-table/ Hexadecimal Colour Picker: https://www.mathsisfun.com/hexadecimal-decimal-colors.html Sound to OGG Converter: https://audio.online-convert.com/convert-to-ogg
0:00 – Sounds 11:20 – Spawn Eggs 16:20 – Loot Tables 19:30 – Testing 20:30 – Fixing Loot Tables