Jump to content

[1.8] setHarvestLevel undefined (solved)


Chaest

Recommended Posts

Hello! Sorry if it's been asked already but I'd like to know if the method "setHarvestLevel" 's been change or something like that.

Cause however I use it in my code

 

Block.setHarvestLevel([tool], [level]);

this.setHarvestLevel([tool], [level]);

setHarvestLevel([tool], [level]);

And wherever in fact, it just keep on telling me it's not defined. There's no include proposed or anything, it'll only ask me to create a new function with this name.

 

I've been searching for hours now and as I just started it's really annoying. I'm starting to believe I made a mistake while installing the environment, though I've checked I followed this tutorial : "http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2235074-tattys-1-8-modding-tutorial-next-tutorial-blocks" and shouldn't have missed anything...

 

So if you have any idea of what I'm doing wrong, please tell me!

 

Here's some code  :

 

	public Anderosite(){
	super(Material.ground);
	setStepSound(Block.soundTypeStone);
	setHardness(5.0F);
	setUnlocalizedName(Reference.MOD_ID+"_"+name);
	setCreativeTab(CreativeTabs.tabBlock);
	setHarvestLevel("pickaxe",3);
}

 

 

            GameRegistry.registerItem(araitaOre, "AraitaOre");
            araita.setHarvestLevel("pickaxe", 2);
            GameRegistry.registerBlock(araita, "Araita");
            GameRegistry.registerBlock(anderosite, "Anderosite");
            GameRegistry

 

 

Here's the exact error message : "The method setHarvestLevel(String, int) is undefined for the type Block."

 

I'm using eclypse on widows seven (don't think it matters but who knows... not me^^)

 

Thanks for your replies!

Link to comment
Share on other sites

public Anderosite(){

 

I hope this is not all you have on this line.

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.

Link to comment
Share on other sites

setHarvestLevel exists for me in 1.8. Both the version that takes a String and an int and one that takes String, int and IBlockState.

 

Hugh, must be the installation then, that's really weird...

 

 

 

public Anderosite(){

 

I hope this is not all you have on this line.

 

I'm afraid it is. What's missing that seems so important? :S

Here's the whole "Aderosite.java" code. Made using this page :

http://www.wuppy29.com/minecraft/1-8-tutorial/updating-1-7-to-1-8-part-3-basic-blocks/#sthash.sKzccjr4.dpbs

 

 

package ant.belena.start;

import ant.belena.start.reference.Reference;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;

public class Anderosite extends Block {
public final static String name = "Anderosite";
public Anderosite(){
	super(Material.ground);
	setStepSound(Block.soundTypeStone);
	setHardness(5.0F);
	setUnlocalizedName(Reference.MOD_ID+"_"+name);
	setCreativeTab(CreativeTabs.tabBlock);
	setHarvestLevel("pickaxe",3);
}
}

Link to comment
Share on other sites

Ah, there.  No that was fine.  I was having trouble reading it as a constructor not as the class declaration.

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.

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.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.