Jump to content

1.10.2 Need Help for making mydragon egg block with breed metadata randomly spawn on with different breeds on the nest structure


Recommended Posts

Posted

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

Posted

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).

Posted
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.

Posted

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.

  • Like 1
Posted
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

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.