Jump to content

[1.7.2][Block properties?] return different block when broken?


Recommended Posts

Hi! I made a bunch of new blocks using Minecraft Forge


Making the block in my main class:



public static Block myblock;


myblock= new myblock().setBlockName("myblock").setCreativeTab(myNewTabThingy).setBlockTextureName(modid +":"+ "myblock");






and here is the myblock class:



import net.minecraft.block.Block;

import net.minecraft.block.material.Material;


public class myblock extends Block {


protected myblock () {



this.setHarvestLevel("pickaxe", 0);








The code runs and works fine! There is just 2 things that I need help/teaching with


1) how to make the block drop a different block when you mine it


2) how to make the block drop nothing if its broke with your fist



Link to comment
Share on other sites

public class myblock extends Block {


2) how to... drop nothing if it's broken with your fist


Instead of extending the general Block class, consider extending the BlockOre class that is itself an extension of Block. Then, in your constructor, add a line like:


this.setHarvestLevel ("pickaxe", 2); // Iron or better pick


Look inside BlockOre to see what it adds to Block functionality. If you see something (like quantityDroppedWithBonus) that you want imitate, then override it with code for your subclass of ore.

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.

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.

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.