Jump to content

harvest level


Brightborn

Recommended Posts

Hey i'm relatively new to modding i've been trying to create my own mod, first started on 1.7.10 then i started again for 1.8 but i'm having a small problem with setHarvestLevel with my blocks in that no matter the tool level the block always drops.

I've tried various combinations to try solving it including putting the values into the block init but it doesn't seem to work so i figured i should ask some people who know what they are doing,the help is appreciated heres the code that i've used for the items

 

 

 

kaijuGoldOre class

}

package KaijuMod.init;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;

public class kaijuGoldOre extends Block{
public kaijuGoldOre(Material material){
	super(material);
	this.setHardness(20.0F);
	this.setHarvestLevel("Pickaxe",5);


}

ItemRegistry class

package KaijuMod.init;

import KaijuMod.MainRegistry;
import KaijuMod.Reference;
import KaijuMod.blocks.BlockKaiju;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class KaijuBlocks {
public static Block kaijuGoldOre;

public static void init(){
kaijuGoldOre= new KaijuMod.init.kaijuGoldOre(Material.rock).setUnlocalizedName("kaijuGoldOre").setCreativeTab(MainRegistry.tabKaiju);
}

public static void register(){
GameRegistry.registerBlock(kaijuGoldOre, kaijuGoldOre.getUnlocalizedName().substring(5));
}

public static void registerRenders(){
registerRender(kaijuGoldOre);
}

public static void registerRender(Block block){
	Item item =Item.getItemFromBlock(block);
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5),"inventory"));
}
}

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.