Posted September 4, 201312 yr 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!
September 4, 201312 yr 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
September 4, 201312 yr Author Nope. Sorry. Ah, I see. Is there a way in which all three of my ores can share one BlockOre file and use if statements to check what their block ID is then drop the corresponding id of the item?
September 4, 201312 yr You can put a setter for the drop in a custom block class file, so you can chain it into your block initialization line.
September 4, 201312 yr Author 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; }
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.