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

Hi, I am recoding my mod for 1.12.2 and in the past I have made a new "BlockX" glass for each new ore so that I can define what item the ore will drop when mined using a method like the following.

Spoiler

	public Item getItemDropped(IBlockState state, Random rand, int fortune){
		return ModItems.coke;
}

 

However as I continue to expand my mod this is clearly inefficient because I will have a ton of redundant class files. So I'd like to define this when declaring the blocks in my ModBlocks class. However everything I've tried so far has had issues. Ex:

Spoiler

public static BlockOre oreBituminousCoal = new BlockOre("ore_bituminous_coal").setCreativeTab(MoreFuelsMod.creativeTab).getItemDropped(state, rand, fortune);

 

In the case of .getItemDropped(state, rand, fortune) I'm not sure what to input for the state, rand, and fortune. I recognize I need to change my method to something more generic and have it return something else but I'm not sure exactly how to restructure it and if i should mess with the "IBlockState state, Random rand, int fortune)" in the original method from above or if I even can remove things. Is this even possible? Am I overlooking something simple?

Well, getItemDropped returns the item dropped. It is not a method that you use to tell the Block class what item to drop.

 

You're going to have to set up a setItemDropped method yourself.

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.

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.