Posted February 20, 201411 yr 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
February 20, 201411 yr Check this out: https://github.com/Draco18s/Artifacts/blob/master/draco18s/artifacts/components/ComponentExcavation.java That's how I achieved it. It does a 3x3x3 cube, simply for the simplistic nature of being easy to calculate. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
February 20, 201411 yr Author 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.
February 20, 201411 yr The blocks that code destroys is based on the blocks that (pickaxe of same material) will destroy. Doesn't matter where they are in relation or what block was originally broken. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
February 20, 201411 yr Author 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; }
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.