Posted December 24, 20159 yr 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
December 24, 20159 yr 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). 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.
December 24, 20159 yr 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. 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/
December 24, 20159 yr Author 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?
December 24, 20159 yr No, I meant it like this: marble = new Block().whatevermethodsyouwant(); marble.setHarvestLevel(parameters); 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/
December 24, 20159 yr Author 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?
December 25, 20159 yr 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). 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.
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.