Guest User

Untitled

a guest
May 24th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.84 KB | None | 0 0
  1. package net.minecraft.src;
  2.  
  3. public class ItemHoe extends Item {
  4.     public ItemHoe(int i, EnumToolMaterial enumtoolmaterial) {
  5.         super(i);
  6.         maxStackSize = 1;
  7.         setMaxDamage(enumtoolmaterial.getMaxUses());
  8.     }
  9.  
  10.     public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) {
  11.         if (!entityplayer.canPlayerEdit(i, j, k)) {
  12.             return false;
  13.         }
  14.         int i1 = world.getBlockId(i, j, k);
  15.         int j1 = world.getBlockId(i, j + 1, k);
  16.         if (l != 0 && j1 == 0 && i1 == Block.grass.blockID || i1 == Block.dirt.blockID) {
  17.             Block block = Block.tilledField;
  18.             world.playSoundEffect((float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, block.stepSound.stepSoundDir2(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
  19.             if (world.multiplayerWorld) {
  20.                 return true;
  21.             } else {
  22.                 for(int one = 0; one < 3; one++) {
  23.                     for(int two = 0; two < 3; two++) {
  24.                         if(world.getBlockId(i + one, j, k + two) == Block.grass.blockID || world.getBlockId(i + one, j, k + two) == Block.dirt.blockID) {
  25.                             world.setBlockWithNotify(i + one, j, k + two, block.blockID);
  26.                         }
  27.                         if(world.getBlockId(i - one, j, k - two) == Block.grass.blockID || world.getBlockId(i - one, j, k - two) == Block.dirt.blockID) {
  28.                             world.setBlockWithNotify(i - one, j, k - two, block.blockID);
  29.                         }
  30.                         if(world.getBlockId(i + two, j, k + one) == Block.grass.blockID || world.getBlockId(i + two, j, k + one) == Block.dirt.blockID) {
  31.                             world.setBlockWithNotify(i + two, j, k + one, block.blockID);
  32.                         }
  33.                         if(world.getBlockId(i - two, j, k - one) == Block.grass.blockID || world.getBlockId(i - two, j, k - one) == Block.dirt.blockID) {
  34.                             world.setBlockWithNotify(i - two, j, k - one, block.blockID);
  35.                         }
  36.                         if(world.getBlockId(i + one, j, k - two) == Block.grass.blockID || world.getBlockId(i + one, j, k - two) == Block.dirt.blockID) {
  37.                             world.setBlockWithNotify(i + one, j, k - two, block.blockID);
  38.                         }
  39.                         if(world.getBlockId(i - one, j, k + two) == Block.grass.blockID || world.getBlockId(i - one, j, k + two) == Block.dirt.blockID) {
  40.                             world.setBlockWithNotify(i - one, j, k + two, block.blockID);
  41.                         }
  42.                         itemstack.damageItem(1, entityplayer);
  43.                     }
  44.                 }
  45.                 return true;
  46.             }
  47.         } else {
  48.             return false;
  49.         }
  50.     }
  51.  
  52.     public boolean isFull3D() {
  53.         return true;
  54.     }
  55. }
Add Comment
Please, Sign In to add comment