Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

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

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

  • Author
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.

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.

  • Author
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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.