Exemplo n.º 1
0
  @Override
  public boolean onBlockDestroyed(
      ItemStack itemstack, World world, Block block, int x, int y, int z, EntityLivingBase player) {
    if (block != null && block.getMaterial() == Material.leaves) return false;

    return AbilityHelper.onBlockChanged(itemstack, world, block, x, y, z, player, random);
  }
Exemplo n.º 2
0
 @Override
 protected boolean useTool(
     World world,
     int x,
     int y,
     int z,
     EntityPlayer player,
     ItemStack stack,
     BlockCrop block,
     TileEntityCrop crop) {
   if (stack.getItem() == TinkerTools.scythe) {
     NBTTagCompound tag = player.getCurrentEquippedItem().stackTagCompound;
     if (tag == null || !tag.hasKey("InfiTool")) {
       // invalid tool
       return true;
     }
     NBTTagCompound toolTag = tag.getCompoundTag("InfiTool");
     for (int xPos = x - 1; xPos <= x + 1; xPos++) {
       for (int zPos = z - 1; zPos <= z + 1; zPos++) {
         if (toolTag.getBoolean("Broken")) {
           break;
         } else if (world.getBlock(xPos, y, zPos) instanceof BlockCrop
             && block.harvest(world, xPos, y, zPos, player)) {
           AbilityHelper.damageTool(player.getCurrentEquippedItem(), 1, player, false);
         }
       }
     }
   }
   return false;
 }
Exemplo n.º 3
0
 public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
   AxisAlignedBB box =
       AxisAlignedBB.getAABBPool()
           .getAABB(
               entity.posX,
               entity.posY,
               entity.posZ,
               entity.posX + 1.0D,
               entity.posY + 1.0D,
               entity.posZ + 1.0D)
           .expand(1.0D, 1.0D, 1.0D);
   List list = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, box);
   for (Object o : list) {
     AbilityHelper.onLeftClickEntity(stack, player, (Entity) o, this);
   }
   return true;
 }