Jump to content

Recommended Posts

Posted

I'm trying to make it so you need an axe to harvest wood and a shovel to harvest dirt.

I have tried to use the line

MinecraftForge.setBlockHarvestLevel(Block.wood, "axe", 2);

 

and also:

                MinecraftForge.setBlockHarvestLevel(Block.wood, 0, "axe", 1);
                MinecraftForge.setBlockHarvestLevel(Block.wood, 1, "axe", 1);
                MinecraftForge.setBlockHarvestLevel(Block.wood, 2, "axe", 1);
                MinecraftForge.setBlockHarvestLevel(Block.wood, 3, "axe", 1);

 

But, none of these have any effect. I can still harvest wood with my hands. I have tried similar code for dirt blocks, but it also had no effect.

However, if I use it on stone:

MinecraftForge.setBlockHarvestLevel(Block.stone, "pickaxe", 2);

Stone can only be mined with Iron or greater.

 

Any ideas on why it would work on stone but not on wood or dirt?

Posted

Man, breaking block by hand != breaking with a tool, that is as simple as that.

By the way, the default ItemAxe harvest most things wooden independently of the block harvest level.

 

You should use the BlockEvent(s) if the conditions are met.

Posted
Man, breaking block by hand != breaking with a tool, that is as simple as that.

 

I guess I wasn't clear on this. I want to be able to break the block with my hands, but don't want the block to drop if I do.

Like breaking stone without a pick, it breaks slower and doesn't drop anything when broken.

 

You should use the BlockEvent(s) if the conditions are met.

I already have it working using events, I was just wondering if there was an easier way to do it.

  • 1 year later...
Posted

The best way I think is changing wood material to material which doesn't let you mine block w/ fists (like rock or iron). The

MinecraftForge.setBlockHarvestLevel(Block.wood, 3, "axe", 1);

code for wood or ground material makes such thing: "Breaking Block.wood:3 is faster w/ only stone+ axe". :)
Posted

Leave vanilla alone. You can do it with events (HarvestDropsEvent or something like that) by checking the event.player's currently equipped item and then adjusting drop list to your needs. Done.

1.7.10 is no longer supported by forge, you are on your own.

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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