Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

HappyKiller1O1

Members
  • Joined

  • Last visited

Everything posted by HappyKiller1O1

  1. Don't worry, I will. I plan to use the QuantityDropped variable and, if it is greater than one; basically don't "smelt" it. Fortune I will just figure out how Minecraft does it and go from there. Thank you for your concern though considering a lot of people tend not to point out potential incompatibilities like that.
  2. Oh no. Lapis has a smelting recipe so it would not fall under the else statement. But, I do understand I need to add the fortune effect and such to make the blocks work right. Still a bit of testing going on.
  3. This is what I did: float xpToDrop = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block, 1, blockMeta)).getItem().getSmeltingExperience(FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block, 1, blockMeta))); This was the result in the console: [21:50:24] [server thread/INFO] [Crew Mod]: XP: -1.0 That's the default for that method. ^
  4. I check the NBT tag of the stack before editing the drops. The silk touch is there for now because I want stone to drop stone considering it's drop can be smelted into stone. I will be editing it to ignore some blocks. It doesn't work on blocks that can not be harvested by a pickaxe.
  5. So console prints "XP: 0.0"? I think it is impossible. Yes, it does. Honestly, I have no clue why considering it SHOULD get the XP value just fine. Maybe I have to register my item in my postInit so it is registered after the crafting? Registering order has been a problem with some things I do. @saxon564 Here is all the methods it uses from my Item class. It gets the block from the onBlockDestroyed method then, depending on the miningSize, checks the blocks around it. NOTE: No blocks drop the XP so it has nothing to do with how I break the extra blocks. public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entity) { fixNBT(stack); EntityPlayer player = (EntityPlayer)entity; if(world != null && player != null) { LogHelper.logInfo("WORLD WAS NOT NULL NOR WAS PLAYER"); MovingObjectPosition mop = EntityHelper.raytraceFromEntity(world, player, true, 5.0D); int sideHit = mop.sideHit; if(player.inventory.getCurrentItem() != null) { if(player.inventory.getCurrentItem().getItem().equals(CrewMod.crewHammer)) { int direction = MathHelper.floor_double((double)(player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; String miningArea = null; if(stack.hasTagCompound()) { miningArea = stack.getTagCompound().getString("MiningSize"); } LogHelper.logInfo(miningArea); this.breakBlock(world, player, stack, x, y, z, direction, miningArea, sideHit); }else { super.onBlockDestroyed(stack, world, block, x, y, z, entity); } }else { super.onBlockDestroyed(stack, world, block, x, y, z, entity); } } return true; } /** * Used for breaking an area of blocks depending on the miningSize. * * @param world Instance of the Minecraft world. * @param player Player breaking the block. * @param stack Stack in the player's hand. * @param x X coordinate of the block to be broken. * @param y Y coordinate of the block to be broken. * @param z Z coordinate of the block to be broken. * @param playerFacing The direction the player is facing: NORTH, SOUTH, EAST or, WEST. * @param miningArea The area of blocks to be destroyed: 1x1 = 0, 3x3 = 1, 5x5 = 2, 7x7 = 3. */ public void breakBlock(World world, EntityPlayer player, ItemStack stack, int x, int y, int z, int playerFacing, String miningArea, int sideHit) { //TODO Address Shift-Clicking error with onCrafted. System.out.println("BREAK BLOCK RUN"); Block block = world.getBlock(x, y, z); int meta = world.getBlockMetadata(x, y, z); LogHelper.logInfo("[CrewHammer] Side Hit: " + sideHit); int refX = x; int refY = y; int refZ = z; if(!isEffective(block, meta, stack)) return; int miningSize = 0; if(miningArea != null) { if(miningArea.equals("3x3")) miningSize = 1; else if(miningArea == "5x5") miningSize = 2; else if(miningArea == "7x7") miningSize = 3; else miningSize = 0; }else { LogHelper.logErr("[CrewHammer] The Mining Area was null!"); } if(playerFacing == 0 || playerFacing == 2) { if(miningSize == 0) { return; }else if(miningSize == 1) { this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); }else if(miningSize == 2) { this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); }else { this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 3, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 3, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 3, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 3, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 3, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 3, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 3, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 3, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 3, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 3, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 3, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 3, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 3, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 3, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing); } }else { if(miningSize == 0) { return; }else if(miningSize == 1) { this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z - 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z + 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z - 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z + 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z - 1, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z + 1, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); }else if(miningSize == 2) { this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z - 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z + 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z - 2, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z + 2, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z - 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z + 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z - 2, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z + 2, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z - 1, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z + 1, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z - 2, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z + 2, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z - 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z + 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z - 2, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z + 2, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z - 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z + 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z - 2, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z + 2, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); }else { this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z - 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z + 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z - 2, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z + 2, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z - 3, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z + 3, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z - 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z + 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z - 2, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z + 2, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z - 3, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z + 3, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z - 1, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z + 1, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z - 2, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z + 2, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z - 3, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z + 3, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z - 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z + 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z - 2, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z + 2, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z - 3, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z + 3, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z - 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z + 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z - 2, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z + 2, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z - 3, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z + 3, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z - 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z + 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z - 2, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z + 2, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z - 3, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z + 3, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z - 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z + 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z - 2, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z + 2, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z - 3, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z + 3, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing); } } } /** * Destroys a block at the given coords if allowed. * * @param world The instance of the World. * @param player The player destroying said block. * @param x X Coordinate of the block to be destroyed. * @param y Y Coordinate of the block to be destroyed. * @param z Z Coordinate of the block to be destroyed. * @param addDrops If true, adds drops to the block broken. * @param refX Reference point X of the center block if destroying multiple ones. * @param refY Reference point Y of the center block if destroying multiple ones. * @param refZ Reference point Z of the center block if destroying multiple ones. * @param Ymodifer Used to determine if the Y variable is added to or, subtracted from. 0 = Nothing, 1 = Added to, 2 = Subtracted from. * @param playerDirection The direction the player is facing: NORTH, SOUTH, EAST or, WEST. */ public void destroyBlockIfAllowed(World world, ItemStack stack, EntityPlayer player, int x, int y, int z, boolean addDrops, int refX, int refY, int refZ, int sideHit, int Ymodifer, int playerDirection) { int actualX = x; int actualY = y; int actualZ = z; if(sideHit == 0 || sideHit == 1) { //System.out.println("Z updated"); actualY = refY; int amountToAdd = refY > y ? refY - y : y - refY; if(playerDirection == 0 || playerDirection == 2) { if(Ymodifer == 0) actualZ += 0; else if(Ymodifer == 1) actualZ += amountToAdd; else actualZ -= amountToAdd; }else { if(Ymodifer == 0) actualX += 0; else if(Ymodifer == 1) actualX += amountToAdd; else actualX -= amountToAdd; } /*System.out.println("Z: " + actualZ); System.out.println(additionZ); System.out.println("Y: " + y); System.out.println("refY: " + refY);*/ } if(world.isAirBlock(actualX, actualY, actualZ)) return; Block block = world.getBlock(actualX, actualY, actualZ); int meta = world.getBlockMetadata(actualX, actualY, actualZ); if(!isEffective(block, meta, stack)) return; Block refBlock = world.getBlock(refX, refY, refZ); float refStrength = refBlock.getBlockHardness(world, refX, refY, refZ); float strength = block.getBlockHardness(world, actualX, actualY, actualZ); float strDifference = strength/refStrength; System.out.println(strDifference); if(!ForgeHooks.canHarvestBlock(block, player, meta) || strength <= -1 || strDifference > 10) return; EntityPlayerMP playerEntity = (EntityPlayerMP)player; if(block.getExpDrop(world, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)) > 0 && !stack.stackTagCompound.getBoolean("AutoSmelt")) block.dropXpOnBlockBreak(world, actualX, actualY, actualZ, block.getExpDrop(world, meta, 0)); if(stack.stackTagCompound.getBoolean("AutoSmelt") == true) { ArrayList<ItemStack> drops = getFurnaceDrops(world, actualX, actualY, actualZ, 0, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack), 1, block, meta, player); LogHelper.logInfo("Drops: " + drops); for(ItemStack item : drops) { dropCustomItems(world, actualX, actualY, actualZ, item); } } world.func_147480_a(actualX, actualY, actualZ, stack.stackTagCompound.getBoolean("AutoSmelt") ? false : addDrops); if(!player.capabilities.isCreativeMode) stack.attemptDamageItem(1, world.rand); } public boolean isEffective(Block block, int meta, ItemStack stack) { if(ForgeHooks.canToolHarvestBlock(block, meta, stack)) return true; return false; } /** * Spawns EntityItem in the world for the given ItemStack if the world is not remote. */ protected void dropCustomItems(World world, int x, int y, int z, ItemStack stack) { if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops") && !world.restoringBlockSnapshots) { // do not drop items while restoring blockstates, prevents item dupe float f = 0.7F; double d0 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; double d1 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; double d2 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; EntityItem entityitem = new EntityItem(world, (double)x + d0, (double)y + d1, (double)z + d2, stack); entityitem.delayBeforeCanPickup = 10; world.spawnEntityInWorld(entityitem); } } /** * This returns a complete list of items dropped from this block. * * @param world The current world * @param x X Position * @param y Y Position * @param z Z Position * @param metadata Current metadata * @param fortune Breakers fortune level * @return A ArrayList containing all items this block drops */ public ArrayList<ItemStack> getFurnaceDrops(World world, int x, int y, int z, int meta, int fortune, int quantity, Block block, int blockMeta, EntityPlayer player) { ArrayList<ItemStack> ret = new ArrayList<ItemStack>(); int count = quantity; for(int i = 0; i < count; i++) { if(FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block, 1, blockMeta)) != null) { int itemMeta = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block, 1, blockMeta)).getItemDamage(); float xpToDrop = FurnaceRecipes.smelting().func_151398_b(new ItemStack(block, 1, blockMeta)); LogHelper.logInfo("XP: " + xpToDrop); Item item = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block, 1, blockMeta)).getItem(); LogHelper.logInfo("Item Meta: " + itemMeta); if (item != null) { ret.add(new ItemStack(item, 1, itemMeta)); } }else { if(block.canSilkHarvest(world, player, x, y, z, meta)) ret.add(new ItemStack(block, 1, meta)); else ret.add(new ItemStack(block.getItemDropped(blockMeta, world.rand, fortune))); } } return ret; }
  6. Ok, the method above is called when the block is destroyed by my item. (I basically have an onBlockDestroyed method that is not showed that calls the method destroyBlockIfAllowed) I also use World#func_147480_a() which destroys the block (adds sounds and such) along with telling the game to drop it's items or not. When the block is destroyed with the CrewHammer, it then destroys the blocks around the block destroyed (calling the method I stated above) and then does all of it's shit. It shouldn't affect any blocks unless the player is holding my hammer. So, it shouldn't affect other mods.
  7. I was testing it with gold ore and, it drops the ingot just fine. But the XP for any block with a smelting recipe seems to return 0.0F
  8. I actually fixed this. I created a new ItemStack ArrayList in my breakBlock method and copied over a spawning method from Block.java. After that, because I use World#func_147480_a to destroy the block (which has a boolean to enable drops or not); I simply cancel the drops and spawn the items. Kinda confusing though so, here's my code. public void destroyBlockIfAllowed(World world, ItemStack stack, EntityPlayer player, int x, int y, int z, boolean addDrops, int refX, int refY, int refZ, int sideHit, int Ymodifer, int playerDirection) { int actualX = x; int actualY = y; int actualZ = z; if(sideHit == 0 || sideHit == 1) { //System.out.println("Z updated"); actualY = refY; int amountToAdd = refY > y ? refY - y : y - refY; if(playerDirection == 0 || playerDirection == 2) { if(Ymodifer == 0) actualZ += 0; else if(Ymodifer == 1) actualZ += amountToAdd; else actualZ -= amountToAdd; }else { if(Ymodifer == 0) actualX += 0; else if(Ymodifer == 1) actualX += amountToAdd; else actualX -= amountToAdd; } } if(world.isAirBlock(actualX, actualY, actualZ)) return; Block block = world.getBlock(actualX, actualY, actualZ); int meta = world.getBlockMetadata(actualX, actualY, actualZ); if(!isEffective(block, meta, stack)) return; Block refBlock = world.getBlock(refX, refY, refZ); float refStrength = refBlock.getBlockHardness(world, refX, refY, refZ); float strength = block.getBlockHardness(world, actualX, actualY, actualZ); float strDifference = strength/refStrength; System.out.println(strDifference); if(!ForgeHooks.canHarvestBlock(block, player, meta) || strength <= -1 || strDifference > 10) return; EntityPlayerMP playerEntity = (EntityPlayerMP)player; if(block.getExpDrop(world, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)) > 0 && !stack.stackTagCompound.getBoolean("AutoSmelt")) block.dropXpOnBlockBreak(world, actualX, actualY, actualZ, block.getExpDrop(world, meta, 0)); if(stack.stackTagCompound.getBoolean("AutoSmelt") == true) { ArrayList<ItemStack> drops = getFurnaceDrops(world, actualX, actualY, actualZ, 0, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack), 1, block, meta, player); LogHelper.logInfo("Drops: " + drops); for(ItemStack item : drops) { dropCustomItems(world, actualX, actualY, actualZ, item); } } world.func_147480_a(actualX, actualY, actualZ, stack.stackTagCompound.getBoolean("AutoSmelt") ? false : addDrops); if(!player.capabilities.isCreativeMode) stack.attemptDamageItem(1, world.rand); } public boolean isEffective(Block block, int meta, ItemStack stack) { if(ForgeHooks.canToolHarvestBlock(block, meta, stack)) return true; return false; } /** * Spawns EntityItem in the world for the given ItemStack if the world is not remote. */ protected void dropCustomItems(World world, int x, int y, int z, ItemStack stack) { if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops") && !world.restoringBlockSnapshots) { // do not drop items while restoring blockstates, prevents item dupe float f = 0.7F; double d0 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; double d1 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; double d2 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; EntityItem entityitem = new EntityItem(world, (double)x + d0, (double)y + d1, (double)z + d2, stack); entityitem.delayBeforeCanPickup = 10; world.spawnEntityInWorld(entityitem); } } /** * This returns a complete list of items dropped from this block. * * @param world The current world * @param x X Position * @param y Y Position * @param z Z Position * @param metadata Current metadata * @param fortune Breakers fortune level * @return A ArrayList containing all items this block drops */ public ArrayList<ItemStack> getFurnaceDrops(World world, int x, int y, int z, int meta, int fortune, int quantity, Block block, int blockMeta, EntityPlayer player) { ArrayList<ItemStack> ret = new ArrayList<ItemStack>(); int count = quantity; for(int i = 0; i < count; i++) { if(FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block, 1, blockMeta)) != null) { int itemMeta = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block, 1, blockMeta)).getItemDamage(); float xpToDrop = FurnaceRecipes.smelting().func_151398_b(new ItemStack(block, 1, blockMeta)); LogHelper.logInfo("XP: " + xpToDrop); Item item = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block, 1, blockMeta)).getItem(); LogHelper.logInfo("Item Meta: " + itemMeta); if (item != null) { ret.add(new ItemStack(item, 1, itemMeta)); } }else { if(block.canSilkHarvest(world, player, x, y, z, meta)) ret.add(new ItemStack(block, 1, meta)); else ret.add(new ItemStack(block.getItemDropped(blockMeta, world.rand, fortune))); } } return ret; }
  9. I believe Flans mod accomplishes this. Maybe check their github?
  10. Please post the stacktrace of the crash. We can't do much with "AL lib: (EE) alc_cleanup: 1 " considering that happens WHENEVER the game crashes.
  11. So, I just need to get the XP set for a blocks furnace recipe but, through the code below, it always seems to return 0.0F. Any ideas of what I am doing wrong? float xpToDrop = FurnaceRecipes.smelting().func_151398_b(new ItemStack(block, 1, blockMeta)); LogHelper.logInfo("XP: " + xpToDrop);
  12. But see, wouldn't that be getting the stack damage as if it is a tool or something of the like?
  13. Check if the player is riding an entity and, if it is your vehicle. Then: disable space for jump and enable it for the vehicle the player is riding. When the player is riding a horse, the space bar contributes to the horse the player is riding, otherwise, the spacebar is for the player's jumping.
  14. Ok so basically, I am using FurnaceRecipes to check if a block has one then getting the output item and such. My problem is, if the output item has metadata then I won't be able to drop the item correctly I believe. So, is there anyway to get an item's metadata from the ItemStack or Item class?
  15. I'd say make a KeyHandler and add a vehicle jump key (So the player can change it if they so choose) and then, handle the jumping. I'm pretty sure the horse does kind of what you're wanting to do so maybe check out that.
  16. So basically, people from previous posts told me I should use the onBlockDestroyed method in the Item class to allow me to destroy extra blocks around the area (I previously used the BreakEvent). In doing this, I put all the breaking code for extra blocks in my Item Class. Here is my entire Item class. It is messy so ignore some parts that are quite long. Still developing it and will make it neater later. CrewHammer.java public class CrewHammer extends ItemPickaxe { public CrewHammer(ToolMaterial tm) { super(tm); this.setCreativeTab(CrewMod.tabCrewTools); this.setUnlocalizedName("CrewHammer"); this.setTextureName(MR.TNAME + "CrewHammer"); this.setFull3D(); this.setMaxStackSize(1); } public void onUpdate(ItemStack stack, World world, Entity entity, int i, boolean flag) { fixNBT(stack); } public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean flag) { list.add(EnumChatFormatting.RED + "Use SHIFT + Right-Click to"); list.add(EnumChatFormatting.RED + "open the modification menu."); list.add(""); list.add(EnumChatFormatting.GREEN + "Right-Click to quickly"); list.add(EnumChatFormatting.GREEN + "change between mining sizes"); } public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if(player.isSneaking()) { FMLNetworkHandler.openGui(player, CrewMod.instance, GuiId.guiCrewHammerID, world, (int)player.posX, (int)player.posY, (int)player.posZ); } return stack; } public static void fixNBT(ItemStack stack){ if(stack.stackTagCompound == null) { LogHelper.logWarn("[CrewHammer] " + "The ItemStack NBTTagCompound was null. Attempting fix..."); stack.stackTagCompound = new NBTTagCompound(); } /*if(!stack.stackTagCompound.hasKey("HammerTag")) { stack.stackTagCompound.setTag("HammerTag", new NBTTagCompound()); LogHelper.logWarn("[CrewHammer] " + "The ItemStack did not contain the key 'HammerTag'. Attempting fix..."); }*/ if(!stack.stackTagCompound.hasKey("MiningSize")) { LogHelper.logWarn("[CrewHammer] " + "The ItemStack did not contain the key 'MiningSize'. Attempting fix..."); stack.stackTagCompound.setString("MiningSize", "3x3"); } if(!stack.stackTagCompound.hasKey("AutoSmelt")) { LogHelper.logWarn("[CrewHammer] " + "The ItemStack did not contain the key 'AutoSmelt'. Attempting fix..."); stack.stackTagCompound.setBoolean("AutoSmelt", true); } if(!stack.stackTagCompound.hasKey("AutoRepair")) { LogHelper.logWarn("[CrewHammer] " + "The ItemStack did not contain the key 'AutoRepair'. Attempting fix..."); stack.stackTagCompound.setBoolean("AutoRepair", false); } if(!stack.stackTagCompound.hasKey("Has3x3")) { LogHelper.logWarn("[CrewHammer] " + "The ItemStack did not contain the key 'Has3x3'. Attempting fix..."); stack.stackTagCompound.setBoolean("Has3x3", false); } if(!stack.stackTagCompound.hasKey("Has5x5")) { LogHelper.logWarn("[CrewHammer] " + "The ItemStack did not contain the key 'Has5x5'. Attempting fix..."); stack.stackTagCompound.setBoolean("Has5x5", false); } if(!stack.stackTagCompound.hasKey("Has7x7")) { LogHelper.logWarn("[CrewHammer] " + "The ItemStack did not contain the key 'Has7x7'. Attempting fix..."); stack.stackTagCompound.setBoolean("Has7x7", false); } } /** * Used for setting the mining size of the Crew Hammer in seperate classes. * * @param stack The Hammer. * @param miningSize The size to be set (3x3, 5x5, 7x7). */ public static void setMiningSize(ItemStack stack, String miningSize) { fixNBT(stack); stack.stackTagCompound.setString("MiningSize", miningSize); LogHelper.logInfo("[CrewHammer#setMiningSize] Method ran successfully! Mining Size is now: " + stack.stackTagCompound.getString("MiningSize")); } /** * Used for setting the mining size of the Crew Hammer in seperate classes. * * @param stack The Hammer. * @param canAutoSmelt True if stack has the Auto Smelt mod. False otherwse. */ public static void setCanAutoSmelt(ItemStack stack, boolean canAutoSmelt) { fixNBT(stack); stack.stackTagCompound.setBoolean("AutoSmelt", canAutoSmelt); LogHelper.logInfo("[CrewHammer#setCanAutoSmelt] Method ran successfully! Auto Smelt is now: " + stack.stackTagCompound.getBoolean("AutoSmelt")); } /** * Used for setting the mining size of the Crew Hammer in seperate classes. * * @param stack The Hammer. * @param canAutoRepair True if stack has the Auto Repair mod. False otherwise. */ public static void setCanAutoRepair(ItemStack stack, boolean canAutoRepair) { fixNBT(stack); stack.stackTagCompound.setBoolean("AutoRepair", canAutoRepair); LogHelper.logInfo("[CrewHammer#setCanAutoRepair] Method ran successfully! Auto Repair is now: " + stack.stackTagCompound.getBoolean("AutoRepair")); } public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entity) { fixNBT(stack); EntityPlayer player = (EntityPlayer)entity; //LogHelper.logInfo("CALLED"); LogHelper.logInfo("STACK: " + stack); LogHelper.logInfo("TAG: " + stack.getTagCompound()); if(world != null && player != null) { LogHelper.logInfo("WORLD WAS NOT NULL NOR WAS PLAYER"); MovingObjectPosition mop = EntityHelper.raytraceFromEntity(world, player, true, 5.0D); int sideHit = mop.sideHit; if(player.inventory.getCurrentItem() != null) { if(player.inventory.getCurrentItem().getItem().equals(CrewMod.crewHammer)) { int direction = MathHelper.floor_double((double)(player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; //ItemStack hammer = stack; //System.out.println("ITEM IN HAND IS CREW HAMMER"); //Block block = event.block; //World world = event.world; //int x = event.x; //int y = event.y; //int z = event.z; //CrewHammer.fixNBT(hammer); //NBTTagCompound cmp = hammer.stackTagCompound; //if(event.isCanceled()) //return; String miningArea = null; if(stack.hasTagCompound()) { miningArea = stack.getTagCompound().getString("MiningSize"); //System.out.println("CMP WAS NOT NULL"); } LogHelper.logInfo(miningArea); this.breakBlock(world, player, stack, x, y, z, direction, miningArea, sideHit); }else { super.onBlockDestroyed(stack, world, block, x, y, z, entity); } }else { super.onBlockDestroyed(stack, world, block, x, y, z, entity); } } return true; } /** * Used for breaking an area of blocks depending on the miningSize. * * @param world Instance of the Minecraft world. * @param player Player breaking the block. * @param stack Stack in the player's hand. * @param x X coordinate of the block to be broken. * @param y Y coordinate of the block to be broken. * @param z Z coordinate of the block to be broken. * @param playerFacing The direction the player is facing: NORTH, SOUTH, EAST or, WEST. * @param miningArea The area of blocks to be destroyed: 1x1 = 0, 3x3 = 1, 5x5 = 2, 7x7 = 3. */ public void breakBlock(World world, EntityPlayer player, ItemStack stack, int x, int y, int z, int playerFacing, String miningArea, int sideHit) { //TODO Address Shift-Clicking error with onCrafted. System.out.println("BREAK BLOCK RUN"); Block block = world.getBlock(x, y, z); int meta = world.getBlockMetadata(x, y, z); /*MovingObjectPosition mop = player.rayTrace(5.0D, 1.0F); if(mop == null) { LogHelper.logErr("[CrewHammer] " + "Ray Trace has failed!"); return; }*/ //int sideHit = -1; //if(world.isRemote) // sideHit = mop.sideHit; //else // return; LogHelper.logInfo("[CrewHammer] Side Hit: " + sideHit); int refX = x; int refY = y; int refZ = z; if(!isEffective(block, meta, stack)) return; int miningSize = 0; if(miningArea != null) { if(miningArea.equals("3x3")) miningSize = 1; else if(miningArea == "5x5") miningSize = 2; else if(miningArea == "7x7") miningSize = 3; else miningSize = 0; }else { LogHelper.logErr("[CrewHammer] The Mining Area was null!"); } System.out.println(miningArea); System.out.println(miningSize); if(playerFacing == 0 || playerFacing == 2) { //System.out.println("PLAYER FACING 0 or 2"); if(miningSize == 0) { return; }else if(miningSize == 1) { System.out.println("MINING IS 3x3"); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); }else if(miningSize == 2) { this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); }else { this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 3, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 3, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 3, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 3, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 3, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 3, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 3, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 3, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 3, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 3, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 3, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 3, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 1, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 1, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 2, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 2, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x - 3, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x + 3, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing); } }else { //System.out.println("PLAYER FACING 1 or 3"); if(miningSize == 0) { return; }else if(miningSize == 1) { this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z - 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z + 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z - 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z + 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z - 1, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z + 1, true, refX, refY, refZ, sideHit, 0, playerFacing); }else if(miningSize == 2) { this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z - 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z + 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z - 2, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z + 2, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z - 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z + 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z - 2, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z + 2, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z - 1, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z + 1, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z - 2, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z + 2, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z - 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z + 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z - 2, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z + 2, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z - 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z + 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z - 2, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z + 2, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); }else { this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z - 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z + 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z - 2, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z + 2, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z - 3, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z + 3, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z - 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z + 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z - 2, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z + 2, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z - 3, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z + 3, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z - 1, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z + 1, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z - 2, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z + 2, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z - 3, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y, z + 3, true, refX, refY, refZ, sideHit, 0, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z - 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z + 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z - 2, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z + 2, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z - 3, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z + 3, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z - 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z + 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z - 2, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z + 2, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z - 3, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z + 3, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z - 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z + 1, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z - 2, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z + 2, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z - 3, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z + 3, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z - 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z + 1, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z - 2, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z + 2, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z - 3, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z + 3, true, refX, refY, refZ, sideHit, 2, playerFacing); this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing); } } } /** * Destroys a block at the given coords if allowed. * * @param world The instance of the World. * @param player The player destroying said block. * @param x X Coordinate of the block to be destroyed. * @param y Y Coordinate of the block to be destroyed. * @param z Z Coordinate of the block to be destroyed. * @param addDrops If true, adds drops to the block broken. * @param refX Reference point X of the center block if destroying multiple ones. * @param refY Reference point Y of the center block if destroying multiple ones. * @param refZ Reference point Z of the center block if destroying multiple ones. * @param Ymodifer Used to determine if the Y variable is added to or, subtracted from. 0 = Nothing, 1 = Added to, 2 = Subtracted from. * @param playerDirection The direction the player is facing: NORTH, SOUTH, EAST or, WEST. */ public void destroyBlockIfAllowed(World world, ItemStack stack, EntityPlayer player, int x, int y, int z, boolean addDrops, int refX, int refY, int refZ, int sideHit, int Ymodifer, int playerDirection) { int actualX = x; int actualY = y; int actualZ = z; if(sideHit == 0 || sideHit == 1) { //System.out.println("Z updated"); actualY = refY; int amountToAdd = refY > y ? refY - y : y - refY; if(playerDirection == 0 || playerDirection == 2) { if(Ymodifer == 0) actualZ += 0; else if(Ymodifer == 1) actualZ += amountToAdd; else actualZ -= amountToAdd; }else { if(Ymodifer == 0) actualX += 0; else if(Ymodifer == 1) actualX += amountToAdd; else actualX -= amountToAdd; } /*System.out.println("Z: " + actualZ); System.out.println(additionZ); System.out.println("Y: " + y); System.out.println("refY: " + refY);*/ } if(world.isAirBlock(actualX, actualY, actualZ)) return; Block block = world.getBlock(actualX, actualY, actualZ); int meta = world.getBlockMetadata(actualX, actualY, actualZ); if(!isEffective(block, meta, stack)) return; Block refBlock = world.getBlock(refX, refY, refZ); float refStrength = refBlock.getBlockHardness(world, refX, refY, refZ); float strength = block.getBlockHardness(world, actualX, actualY, actualZ); float strDifference = strength/refStrength; System.out.println(strDifference); if(!ForgeHooks.canHarvestBlock(block, player, meta) || strength <= -1 || strDifference > 10) return; EntityPlayerMP playerEntity = (EntityPlayerMP)player; if(block.getExpDrop(world, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)) > 0 && !stack.stackTagCompound.getBoolean("AutoSmelt")) block.dropXpOnBlockBreak(world, actualX, actualY, actualZ, block.getExpDrop(world, meta, 0)); if(stack.stackTagCompound.getBoolean("AutoSmelt") == true) { //LogHelper.logInfo("Drops: " + drops); if(FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block)) != null) { block.getDrops(world, actualX, actualY, actualZ, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)).add(stackToDrop1); //drops.clear(); //drops.add(stackToDrop1); LogHelper.logInfo("Drops: " + block.getDrops(world, actualX, actualY, actualZ, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack))); } } world.func_147480_a(actualX, actualY, actualZ, addDrops); int damage = stack.getItemDamage() + 1; if(!player.capabilities.isCreativeMode) stack.setItemDamage(damage); } public boolean isEffective(Block block, int meta, ItemStack stack) { if(ForgeHooks.canToolHarvestBlock(block, meta, stack)) return true; return false; block.getDrops(world, actualX, actualY, actualZ, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)).clear(); ItemStack stackToDrop = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block, 1, meta)).copy(); ItemStack stackToDrop1 = new ItemStack(stackToDrop.getItem(), 1); } /*//Makes it so the item stays in the crafting grid public boolean doesContainerItemLeaveCraftingGrid(ItemStack stack) { return false; } //Tells the game your item has a container item public boolean hasContainerItem() { return true; } //Sets teh container item public ItemStack getContainerItem(ItemStack itemStack) { itemStack.attemptDamageItem(1, itemRand); return itemStack; }*/ }
  17. So, my item destroys a 3x3 area of blocks. To do this, I use the onBlockDestroyed method in Item in my item's class. Within the method, I basically check if it has a certain boolean set true within the Item NBT and, if so remove the drops from the block and add it's smelted variant. When trying this, it does not clear the drops but, still adds the smelted variant. But then, doesn't drop the smelted variant. I am quite confused but I am sure it's something simple I am missing. Here's how I am TRYING to do it: NOTE: I can't use the HarvestBlockEvent because, it doesn't register the blocks I destroy through my class. if(stack.stackTagCompound.getBoolean("AutoSmelt") == true) { ArrayList<ItemStack> drops = block.getDrops(world, actualX, actualY, actualZ, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)); LogHelper.logInfo("Drops: " + drops); if(FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block)) != null) { ItemStack stackToDrop = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block, 1, meta)).copy(); ItemStack stackToDrop1 = new ItemStack(stackToDrop.getItem(), 1); drops.clear(); drops.add(stackToDrop1); LogHelper.logInfo("Drops: " + drops); } } And here's what pops out in the console when destroying it (Happens eight times): [22:38:35] [server thread/INFO] [Crew Mod]: Drops: [1xtile.oreGold@0] [22:38:35] [server thread/INFO] [Crew Mod]: Drops: [1xitem.ingotGold@0] Would appreciate some help!
  18. Actually I did it by running a for loop through the String[] length and saving each string. Thanks for the suggestions though!
  19. Maybe your bounding/collision box is not working? Does it light you on fire?
  20. Now see, I would do that but, I am using a String array to store about ten or twenty messages to be sent to the server.
  21. When does it not have a texture?
  22. Oh! Didn't realize onUpdate had params. Most update functions I use don't carry those.
  23. @TamzOS That could work. But, how would he be able to get the instance of EntityPlayer? He couldn't use Minecraft.getMinecraft() considering it needs to be ran server-side.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.