TheRPGAdventurer Posted July 1, 2017 Posted July 1, 2017 Ok so here is my problem, I have a dragon egg block and it has different types per dragon breed (ruby, sapphire etc.)https://pastebin.com/CqAxD9L8, I have made a dragon nest structure and in the middle is the dragon egg, I want to generate my nest structure and make my dragon egg spawn with different breeds, I tried making 5 different independent structures one by one with different egg breeds in extreme hills biome, but it made it just too common everywhere. So my idea is to make just one structure but make the egg in the middle with a random breed and that's what I have problem with. https://pastebin.com/mgz65BU9 Quote
Jay Avery Posted July 1, 2017 Posted July 1, 2017 Generate a random number from the possible values. Use the Random instance from the World (world.rand), then call nextInt which returns a random integer between 0 (inclusive) and the argument you pass it (exclusive). Quote
TheRPGAdventurer Posted July 1, 2017 Author Posted July 1, 2017 Just now, Jay Avery said: Generate a random number from the possible values. Use the Random instance from the World (world.rand), then call nextInt which returns a random integer between 0 (inclusive) and the argument you pass it (exclusive). Can you please make it simple, what class do I have to edit, what method or show the exact method(if possible). I'm still a newbie tho. Quote
Jay Avery Posted July 1, 2017 Posted July 1, 2017 You want to get a random number to pass as the metadata of your egg block. To get a random number, use world.rand.nextInt(yourNumber). Replace yourNumber with a number that's one bigger than the biggest possible number you want. So if you want a random number between 0 and 3, you would replace yourNumber with 4. 1 Quote
TheRPGAdventurer Posted July 2, 2017 Author Posted July 2, 2017 Just now, Jay Avery said: You want to get a random number to pass as the metadata of your egg block. To get a random number, use world.rand.nextInt(yourNumber). Replace yourNumber with a number that's one bigger than the biggest possible number you want. So if you want a random number between 0 and 3, you would replace yourNumber with 4. It worked but I have another problem, How do I spawn my dragon with property, because when I spawn my dragon in extreme hills using GameRegistry, It spawn in the extreme hills but it just sets it to a default breed state which is (END or ender dragon) and It's just weird seeing enderdragons in the overworld. https://pastebin.com/n8vSFvaf Quote
Recommended Posts
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.