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.

Featured Replies

Posted

Hey, so I have a mod and it was working fine, I could generate blocks without an issue. However it only replaces stone. And so I took a look in 'WorldGenMinable' and there seems to be a magic number for what it replaces, which is only stone. So I tried to do some googling and all that came up were outdated, useless tutorials that use old code for WorldGenMinable that didn't have a magic number.

 

So, can anyone point me in the right direction of how to generate blocks that replaces something other than stone? Even if it's just someone's code on github, anything will help. Thanks!

 

Solution: Add a new parameter for the item to replace, then in your call to WorldGenMinable, use BlockHelper.forBlock(replace)

 

Yea, 1.8 pretty much takes the idea of "Magic Numbers" and hides them.  No more block or item IDs, Entity IDs are almost irrelevant, metadata is now IBlockState...

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Author

Yea, 1.8 pretty much takes the idea of "Magic Numbers" and hides them.  No more block or item IDs, Entity IDs are almost irrelevant, metadata is now IBlockState...

WorldGenMinable actually doesn't have any "magic number". In 1.8 it takes a Predicate<IBlockState> (which you can think of as a method that takes a IBlockState and returns a boolean) that determines whether a certain block should be replaced or not.

If you just want to replace a single Block, Minecraft has a default implementation for this Predicate, called "BlockHelper". Use BlockHelper.forBlock to get an instance of it for a specific block.

Okay thanks. I saw the Predicate but the lack of naming tripped me up. The actual part I got confused on was:

    public WorldGenMinable(IBlockState p_i45630_1_, int p_i45630_2_)
    {
        this(p_i45630_1_, p_i45630_2_, BlockHelper.forBlock(Blocks.stone));
    }

I thought this was the only definition of something to replace. But I now see that I missed

    public WorldGenMinable(IBlockState p_i45631_1_, int p_i45631_2_, Predicate p_i45631_3_)
    {
        this.oreBlock = p_i45631_1_;
        this.numberOfBlocks = p_i45631_2_;
        this.field_175919_c = p_i45631_3_;
    }

 

Thank you guys!

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.