Jump to content

Recommended Posts

Posted

I'm trying to set harvest levels for my new blocks and some vanilla blocks, but it doesn't seem to work. All the vanilla blocks still have their old harvest levels, and my blocks all have a harvest level of -1 (default value, I think). My tools are working properly, as I can set my wooden pick to have a level of 10 and it can mine everything, but when I put it back to 0, it can only mine the blocks it normally can and any of my new blocks.

 

I have all my .setBlockHarvestLevel() calls in one method in my mod's "Block" class, and I've tried calling it at different points in my code, like before/after my blocks are registered, or in my load or postInit methods.

 

Here's my mod class:

package blourenco.minermetals;

import blourenco.minermetals.handler.FuelHandlerMM;
import blourenco.minermetals.item.crafting.RecipesMM;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;

@Mod(modid = MinerMetals.modid, name = "Miner Metals", version = "0.1a")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class MinerMetals
{
public static final String modid = "BLourenco_MinerMetals";

@Instance(MinerMetals.modid)
public static MinerMetals instance;

@SidedProxy (clientSide="blourenco.minermetals.client.ClientProxy", serverSide="blourenco.MinerMetals.CommonProxy")
public static CommonProxy proxy;

@PreInit
public void preInit(FMLPreInitializationEvent event) 
{
	//Blocks
	MinerMetalsBlock.initBlocks();
	MinerMetalsBlock.setBlockHarvestLevels();
	MinerMetalsBlock.reflectVanillaBlocks();
	MinerMetalsBlock.registerBlocks();

	//Items
	MinerMetalsItem.initItems();
	MinerMetalsItem.reflectVanillaItems();

	//Recipes
	RecipesMM.registerRecipes();

	//Names
	proxy.registerTranslations();
}

@Init
public void load(FMLInitializationEvent event)
{
	proxy.registerRenderInformation();	



	GameRegistry.registerFuelHandler(new FuelHandlerMM());
}

@PostInit
public void postInit(FMLPostInitializationEvent event) 
{
	RecipesMM.removeVanillaRecipes();

}
}

 

Here's my method to set harvest levels:

public static void setBlockHarvestLevels()
{		
	MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.blockCoal, "pickaxe", 0);
	MinecraftForge.setBlockHarvestLevel(Block.oreNetherQuartz, "pickaxe", 1);
	MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.oreCopper, "pickaxe", 1);
	MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.blockCopper, "pickaxe", 1);
	MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.oreTin, "pickaxe", 1);
	MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.blockTin, "pickaxe", 1);
	MinecraftForge.setBlockHarvestLevel(Block.oreIron, "pickaxe", 2);
	MinecraftForge.setBlockHarvestLevel(Block.oreGold, "pickaxe", 2);
	MinecraftForge.setBlockHarvestLevel(Block.blockGold, "pickaxe", 2);
	MinecraftForge.setBlockHarvestLevel(Block.blockIron, "pickaxe", 2);
	MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.oreSilver, "pickaxe", 2);
	MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.blockSilver, "pickaxe", 2);
	MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.blockBronze, "pickaxe", 2);
	MinecraftForge.setBlockHarvestLevel(Block.oreEmerald, "pickaxe", 3);
	MinecraftForge.setBlockHarvestLevel(Block.blockEmerald, "pickaxe", 3);
	MinecraftForge.setBlockHarvestLevel(Block.oreRedstone, "pickaxe", 3);
	MinecraftForge.setBlockHarvestLevel(Block.oreDiamond, "pickaxe", 4);
	MinecraftForge.setBlockHarvestLevel(Block.blockDiamond, "pickaxe", 4);
	MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.obsidian, "pickaxe", 4);
	MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.oreNetherite, "pickaxe", 4);
	MinecraftForge.setBlockHarvestLevel(MinerMetalsBlock.blockNetherite, "pickaxe", 4);	
}

 

I just know it's going to be some stupid small thing, but I've been trying to fix this all day, and I've been Googling it as well, but no luck.

Posted

I tried messing around with it a bit more, still no luck. When I print the block's harvest level before and after setting the harvest levels using .getBlockHarvestLevel(), it first prints the block's default value (-1 for new blocks), but it prints the correct level afterwards. But then when I go in-game, nothing has happened.

  • 8 months later...

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.