Jump to content

Making Blocks Drop Items


bigfootbasher

Recommended Posts

So, by looking at the title you're probably passing me up as an average Joe that knows no code, but you are wrong! *dun, dun, duuuun!*

 

More seriously, though, I have 3 different ore blocks and I want them all to drop gems of themselves (say RubyOre drops RubyGem) but I refuse to make classes for them just to say I want them to drop these items.

 

rubyOre = new Block(MASS_Info.rubyOreID, Material.rock);

 

That is the example I want to use. I want my ores to just be basic blocks and to Extend Block and not have to create individual classes.

 

My question is can I change what they drop in my base classes init() method?

For example, is there a method or a function to do so?

 

Thanks!

Link to comment
Share on other sites

Nope. Sorry.

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Link to comment
Share on other sites

So my compromise was to make one BlockOre.class and inside put the method:

 

public int idDropped(int par1, Random par2Random, int par3) {
	if (blockID == MyBlocks.myOre1.blockID) {
		return MyItems.myGem1.itemID;
	}
	if (blockID == MyBlocks.myOre2.blockID) {
		return MyItems.myGem2.itemID;
	}
	if (blockID == MyBlocks.myOre3.blockID) {
		return MyItems.myGem3.itemID;
	}

	return blockID;
}

Link to comment
Share on other sites

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.