Posted August 5, 20187 yr So, I am creating a Meme Mod for Minecraft Forge 1.12.2 and decided, to make a item, where if you right click with it, it will play a random meme that I will put in an array. I have the array, and the item class, but I am not sure how I can make it play the random sound from the array. If anyone knows how I can do this, I would be highly appreciated if you could tell me what I have to do. If you could tell me in simple terms, that would be much more helpful but if not, then I will try my best to understand it. Thank You. Edited August 5, 20187 yr by UM3 F0R TH3 W1N
August 5, 20187 yr Just now, UM3 F0R TH3 W1N said: If you could tell me in simple terms, that would be much more helpful but if not, then I will try my best to understand it. Thank You. How much do you know/have. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 5, 20187 yr Author Just now, Animefan8888 said: How much do you know/have. how much what do I know/have
August 5, 20187 yr Just now, UM3 F0R TH3 W1N said: how much what do I know/have How much code for this do you know, have you created the item, have you overrided the method that fires when the item is right clicked, do you know how to play a sound? VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 5, 20187 yr Author yh ik how to do all of that/have done that all, but I just don't know how to make it choose the random sound from array @Animefan8888
August 5, 20187 yr Just now, UM3 F0R TH3 W1N said: yh ik how to do all of that/have done that all, but I just don't know how to make it choose the random sound from array @Animefan8888 List#get(Random#nextInt(List#size())) Or in simpler terms I assume you know how to get an Item out of a ArrayList, so you need to generate a psuedo-random number with the Random class that has a maximum of the lists length. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 5, 20187 yr Author 4 minutes ago, Animefan8888 said: 4 minutes ago, Animefan8888 said: so you need to generate a psuedo-random number with the Random class that has a maximum of the lists length. im quite new to arrays, so I have no clue what this means, but I do kno how to get the item out of the array.yes Edited August 5, 20187 yr by UM3 F0R TH3 W1N
August 5, 20187 yr 1 minute ago, UM3 F0R TH3 W1N said: im quite new to arrays, so I have no clue what this means Create a new Random call nextInt(listLength) and then pass the int returned from that into the get method of List/ArrayList VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 5, 20187 yr Author 4 minutes ago, Animefan8888 said: Create a new Random call nextInt(listLength) and then pass the int returned from that into the get method of List/ArrayList how? is this right? I assume that's wrong, as I said, im very unexperienced with this
August 5, 20187 yr Just now, UM3 F0R TH3 W1N said: how? is this right? I assume that's wrong, as I said, im very unexperienced with this That's partially right, now you just need to pass it into the get method on your list that has the Sounds in it. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 5, 20187 yr Author 4 minutes ago, Animefan8888 said: pass it into the get method on your list that has the Sounds in it. so what do I put for soundIn
August 5, 20187 yr 1 minute ago, UM3 F0R TH3 W1N said: so what do I put for soundIn A SoundEvent that you have to make. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 5, 20187 yr Author 9 hours ago, Animefan8888 said: A SoundEvent that you have to make. but I want it to be the random sound...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.