Jump to content

mankeeey

Members
  • Posts

    3
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

mankeeey's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. How can I see what block is originaly broken? If I know that, I can see if it can harvest or not. Because when I destroy dirt it destroys all stone near it atm. That's bugging me. EDIT: nvm found it and fixed it. This is what I did. @Override public boolean onBlockDestroyed(ItemStack par1ItemStack, World world, int par1, int x, int y, int z, EntityLivingBase player) { int numBlocks = 0; Block firstBlock = Block.blocksList[world.getBlockId(x, y, z)]; if(firstBlock != null) { if(this.canHarvestBlock(firstBlock, par1ItemStack)) { for(int i=-1;i<=1;i++) { for(int j=-1;j<=1;j++) { for(int k=-1;k<=1;k++) { int l = world.getBlockId(x+i, y+j, z+k); Block block = Block.blocksList[l]; if(block != null) { System.out.println("block: " + block.getUnlocalizedName()); System.out.println("can: " + par1ItemStack.canHarvestBlock(block)); System.out.println("numBlocks: " + numBlocks); if(this.canHarvestBlock(block, par1ItemStack)) { int par6 = EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, par1ItemStack); block.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x+i, y+j, z+k), par6); world.setBlockToAir(x+i, y+j, z+k); numBlocks++; } } } } } par1ItemStack.damageItem(numBlocks/3, player); } } //Block block = Block.blocksList[l] return false; }
  2. EDIT: It works, thanks. The only problem is when I destroy dirt with it, it destroys rock material around it. I'm looking into it. If you have a quick fix for it, It's always welcome. EDIT 2: I found why it still deleted stone after breaking dirt. You checked if it could harvest every time, so for stone it would say true. Here is the code I have now. This fix might help you out aswell. @Override public boolean onBlockDestroyed(ItemStack par1ItemStack, World world, int par1, int x, int y, int z, EntityLivingBase player) { int numBlocks = 0; for(int i=-1;i<=1;i++) { for(int j=-1;j<=1;j++) { for(int k=-1;k<=1;k++) { int l = world.getBlockId(x+i, y+j, z+k); Block block = Block.blocksList[l]; if(block != null) { System.out.println("block: " + block.getUnlocalizedName()); System.out.println("can: " + par1ItemStack.canHarvestBlock(block)); if(this.canHarvestBlock(block, par1ItemStack)) { int par6 = EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, par1ItemStack); block.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x+i, y+j, z+k), par6); world.setBlockToAir(x+i, y+j, z+k); numBlocks++; } else { return false; } } } } } par1ItemStack.damageItem(numBlocks/3, player); //Block block = Block.blocksList[l] return false; } What I'm thinking now is. When I destroy stone and there is dirt next to it. it will stop the method.
  3. Hi, I want to make a pickaxe that can mine more than one ore at once. Example: If you mine a block, the blocks next to it will be mined aswell. I have no idea how to implement this into my pickaxe class. Kind regards Mankeeey
×
×
  • Create New...

Important Information

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