Posted June 2, 201411 yr 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"); GameRegistry.registerBlock(myblock,"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 () { super(Material.ground); this.setHardness(4F); this.setHarvestLevel("pickaxe", 0); this.setResistance(4F); } } 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 Thanks
June 2, 201411 yr 1) Override Block#getItemDropped(int, Random, int) 2) Change your block Material to one that requires a tool. (Material#setRequiresTool())
June 2, 201411 yr 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.
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.