2ShotKaos Posted December 24, 2015 Share Posted December 24, 2015 I was wondering if someone can tell me how to the the harvest level (.setHarvestLevel("pickaxe",2)) in the constructer because it always seems to give me an error. Some sample code would help. Here is what i have. marble = new Block(Material.rock).setUnlocalizedName("marble").setCreativeTab(MoarMinecraft.tabMM).setHardness(1).setStepSound(Block.soundTypeStone); Thanks Quote Link to comment Share on other sites More sharing options...
jeffryfisher Posted December 24, 2015 Share Posted December 24, 2015 And the error msg is??? Also: Why are you instantiating a new Block instead of something like BlockMarble? Don't you have a unique subclass for this new type of block? With a unique subclass, its constructor could set harvest level (and other properties). Quote The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting. Link to comment Share on other sites More sharing options...
larsgerrits Posted December 24, 2015 Share Posted December 24, 2015 You can't include setHarvestLevel in your 'chain', as that method doesn't have a Block as it's return type. You have to call setHarvestLevel after your block instantiation. Quote Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/ Link to comment Share on other sites More sharing options...
2ShotKaos Posted December 24, 2015 Author Share Posted December 24, 2015 And the error MSG is??? Also: Why are you instantiating a new Block instead of something like BlockMarble? Don't you have a unique subclass for this new type of block? With a unique subclass, its constructor could set harvest level (and other properties). I actually am not using separate classes for all the blocks, is that a better way? Seems more organized. I have one huge mod page with all my blocks and one for items. Then the main mod class. I could set it after the game registry but I don; like that. Should I just start over with each class for one block? Quote Link to comment Share on other sites More sharing options...
larsgerrits Posted December 24, 2015 Share Posted December 24, 2015 No, I meant it like this: marble = new Block().whatevermethodsyouwant(); marble.setHarvestLevel(parameters); Quote Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/ Link to comment Share on other sites More sharing options...
2ShotKaos Posted December 24, 2015 Author Share Posted December 24, 2015 No, I meant it like this: marble = new Block().whatevermethodsyouwant(); marble.setHarvestLevel(parameters); Would it still be better to make a separate class for each block/Item? Quote Link to comment Share on other sites More sharing options...
jeffryfisher Posted December 25, 2015 Share Posted December 25, 2015 Would it still be better to make a separate class for each block/Item? I just looked at where vanilla MC makes its blocks, and none instantiate the parent Block class. I suspect that when you get to defining your marble's behavior, you'll want to override something, so you may as well start by subclassing Block or something like BlockStone (which would let you inherit stone material and behavior). Then you may set the harvest level either inside your constructor or after instantiation (inside is the natural place for such a property setting). Quote The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting. Link to comment Share on other sites More sharing options...
Recommended Posts
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.